|
|
|
@ -35,8 +35,6 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) :
@@ -35,8 +35,6 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) :
|
|
|
|
|
ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); |
|
|
|
|
|
|
|
|
|
// Add commands to combo box
|
|
|
|
|
ui->editCommandComboBox->addItem("DO: Control Video", MAV_CMD_DO_CONTROL_VIDEO); |
|
|
|
|
ui->editCommandComboBox->addItem("PREFLIGHT: Calibration", MAV_CMD_PREFLIGHT_CALIBRATION); |
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 0", 0); |
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 1", 1); |
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 2", 2); |
|
|
|
@ -53,21 +51,35 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) :
@@ -53,21 +51,35 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) :
|
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 13", 13); |
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 14", 14); |
|
|
|
|
ui->editCommandComboBox->addItem("CUSTOM 15", 15); |
|
|
|
|
ui->editCommandComboBox->addItem("NAV_WAYPOINT", 16); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_UNLIM", 17); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_TURNS", 18); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_TIME", 19); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_RETURN_TO_LAUNCH", 20); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LAND", 21); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_TAKEOFF", 22); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_ROI", 80); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_PATHPLANNING", 81); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_MODE", 176); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_CHANGE_SPEED", 178); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_HOME", 179); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_RELAY", 181); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_REPEAT_RELAY", 182); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_SERVO", 183); |
|
|
|
|
ui->editCommandComboBox->addItem("NAV_WAYPOINT", MAV_CMD_NAV_WAYPOINT); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_UNLIM", MAV_CMD_NAV_LOITER_UNLIM); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_TURNS", MAV_CMD_NAV_LOITER_TURNS); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LOITER_TIME", MAV_CMD_NAV_LOITER_TIME); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_RETURN_TO_LAUNCH", MAV_CMD_NAV_RETURN_TO_LAUNCH); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_LAND", MAV_CMD_NAV_LAND); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_TAKEOFF", MAV_CMD_NAV_TAKEOFF); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_ROI", MAV_CMD_NAV_ROI); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_NAV_PATHPLANNING", MAV_CMD_NAV_PATHPLANNING); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_CONDITION_CHANGE_ALT", MAV_CMD_CONDITION_CHANGE_ALT); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_CONDITION_DISTANCE", MAV_CMD_CONDITION_DISTANCE); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_CONDITION_YAW", MAV_CMD_CONDITION_YAW); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_CONDITION_LAST", MAV_CMD_CONDITION_LAST); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_MODE", MAV_CMD_DO_SET_MODE); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_JUMP", MAV_CMD_DO_JUMP); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_CHANGE_SPEED", MAV_CMD_DO_CHANGE_SPEED); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_HOME", MAV_CMD_DO_SET_HOME); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_PARAMETER", MAV_CMD_DO_SET_PARAMETER); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_RELAY", MAV_CMD_DO_SET_RELAY); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_REPEAT_RELAY", MAV_CMD_DO_REPEAT_RELAY); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_SET_SERVO", MAV_CMD_DO_SET_SERVO); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_REPEAT_SERVO", MAV_CMD_DO_REPEAT_SERVO); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_DO_CONTROL_VIDEO", MAV_CMD_DO_CONTROL_VIDEO); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_PREFLIGHT_CALIBRATION", MAV_CMD_PREFLIGHT_CALIBRATION); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS", MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_PREFLIGHT_STORAGE", MAV_CMD_PREFLIGHT_STORAGE); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OVERRIDE_GOTO); |
|
|
|
|
ui->editCommandComboBox->addItem("MAV_CMD_MISSION_START", MAV_CMD_MISSION_START); |
|
|
|
|
ui->editCommandComboBox->setEditable(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -78,22 +90,37 @@ QGCCommandButton::~QGCCommandButton()
@@ -78,22 +90,37 @@ QGCCommandButton::~QGCCommandButton()
|
|
|
|
|
|
|
|
|
|
void QGCCommandButton::sendCommand() |
|
|
|
|
{ |
|
|
|
|
if (QGCToolWidgetItem::uas) { |
|
|
|
|
int index = ui->editCommandComboBox->itemData(ui->editCommandComboBox->currentIndex()).toInt(); |
|
|
|
|
MAV_CMD command = static_cast<MAV_CMD>(index); |
|
|
|
|
int confirm = (ui->editConfirmationCheckBox->isChecked()) ? 1 : 0; |
|
|
|
|
float param1 = ui->editParam1SpinBox->value(); |
|
|
|
|
float param2 = ui->editParam2SpinBox->value(); |
|
|
|
|
float param3 = ui->editParam3SpinBox->value(); |
|
|
|
|
float param4 = ui->editParam4SpinBox->value(); |
|
|
|
|
float param5 = ui->editParam5SpinBox->value(); |
|
|
|
|
float param6 = ui->editParam6SpinBox->value(); |
|
|
|
|
float param7 = ui->editParam7SpinBox->value(); |
|
|
|
|
int component = ui->editComponentSpinBox->value(); |
|
|
|
|
|
|
|
|
|
QGCToolWidgetItem::uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component); |
|
|
|
|
qDebug() << __FILE__ << __LINE__ << "SENDING COMMAND" << index; |
|
|
|
|
} else { |
|
|
|
|
if (QGCToolWidgetItem::uas) |
|
|
|
|
{ |
|
|
|
|
// Check if command text is a number
|
|
|
|
|
bool ok; |
|
|
|
|
int index = 0; |
|
|
|
|
index = ui->editCommandComboBox->currentText().toInt(&ok); |
|
|
|
|
if (!ok) |
|
|
|
|
{ |
|
|
|
|
// Command was not a number, assume it was one of the text items
|
|
|
|
|
index = ui->editCommandComboBox->itemData(ui->editCommandComboBox->currentIndex()).toInt(&ok); |
|
|
|
|
if (ok) |
|
|
|
|
{ |
|
|
|
|
// Text item found, proceed
|
|
|
|
|
MAV_CMD command = static_cast<MAV_CMD>(index); |
|
|
|
|
int confirm = (ui->editConfirmationCheckBox->isChecked()) ? 1 : 0; |
|
|
|
|
float param1 = ui->editParam1SpinBox->value(); |
|
|
|
|
float param2 = ui->editParam2SpinBox->value(); |
|
|
|
|
float param3 = ui->editParam3SpinBox->value(); |
|
|
|
|
float param4 = ui->editParam4SpinBox->value(); |
|
|
|
|
float param5 = ui->editParam5SpinBox->value(); |
|
|
|
|
float param6 = ui->editParam6SpinBox->value(); |
|
|
|
|
float param7 = ui->editParam7SpinBox->value(); |
|
|
|
|
int component = ui->editComponentSpinBox->value(); |
|
|
|
|
|
|
|
|
|
QGCToolWidgetItem::uas->executeCommand(command, confirm, param1, param2, param3, param4, param5, param6, param7, component); |
|
|
|
|
qDebug() << __FILE__ << __LINE__ << "SENDING COMMAND" << index; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
qDebug() << __FILE__ << __LINE__ << "NO UAS SET, DOING NOTHING"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|