Пример #1
0
void UASActionsWidget::setShortcutMode()
{
    QLOG_INFO() << "    UASActionsWidget::setShortcutMode()";

    if(!activeUas())
        return;

    QLOG_INFO() << "Set Mode to "
                << ui.shortcutButtonGroup->checkedButton()->text();
    QString modeString;
    modeString = ui.shortcutButtonGroup->checkedButton()->text();
    int index = ui.modeComboBox->findText(modeString);
    QLOG_DEBUG() << "index: "
                << index;

    if (modeChangeWarningBox(modeString) == QMessageBox::Abort){
        return;
    }

    ui.modeComboBox->setCurrentIndex(index);
    m_uas->setMode(MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
                   ui.modeComboBox->itemData(ui.modeComboBox->currentIndex()).toInt());
}
Пример #2
0
void UASActionsWidget::sendApmRoverCommand(MAV_CMD command)
{
    QLOG_INFO() << "UASActionWidget::sendApmRoverCommand";
    switch(command) {

    case MAV_CMD_NAV_RETURN_TO_LAUNCH: {
        /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty|  */
        Q_ASSERT(command == MAV_CMD_NAV_RETURN_TO_LAUNCH);
        QLOG_INFO() << "MAV_CMD_NAV_RETURN_TO_LAUNCH";

        int confirm = 1;    // [TODO] Verify This is what ArduRover Does.
        float param1 = 0.0; // Empty
        float param2 = 0.0; // Empty
        float param3 = 0.0; // [NOT USED] Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise
        float param4 = 0.0; // Desired yaw angle.|
        float param5 = 0.0; // Latitude
        float param6 = 0.0; // Longitude
        float param7 = 0.0; // Altitude
        int component = MAV_COMP_ID_ALL;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    case MAV_CMD_PREFLIGHT_CALIBRATION: {
        // Trigger calibration. This command will be only accepted if in pre-flight mode.
        Q_ASSERT(command == MAV_CMD_PREFLIGHT_CALIBRATION);
        QLOG_INFO() << "MAV_CMD_PREFLIGHT_CALIBRATION";

        if (preFlightWarningBox() == QMessageBox::Abort)
            return;

        int confirm = 1;
        float param1 = 1.0; // Gyro calibration: 0: no, 1: yes
        float param2 = 0.0; // Magnetometer calibration: 0: no, 1: yes
        float param3 = 0.0; // Ground pressure: 0: no, 1: yes
        float param4 = 0.0; // Radio calibration: 0: no, 1: yes
        float param5 = 0.0; // Accelerometer calibration: 0: no, 1: yes
        float param6 = 0.0; // | Empty|
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_ALL;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);
    } break;

    case MAV_CMD_MISSION_START: {
        // start running a mission last_item:
        Q_ASSERT(command == MAV_CMD_MISSION_START);
        QLOG_INFO() << "MAV_CMD_MISSION_START";

        if (modeChangeWarningBox("Mission Start") == QMessageBox::Abort)
            return;

        int confirm = 1;
        float param1 = 1.0; // first_item: the first mission item to run
        float param2 = 0.0; // the last mission item to run (after this item is run, the mission ends)|
        float param3 = 0.0; // | Empty|
        float param4 = 0.0; // | Empty|
        float param5 = 0.0; // | Empty|
        float param6 = 0.0; // | Empty|
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_ALL;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    case MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: {
        // Request the reboot or shutdown of system components.
        Q_ASSERT(command == MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN);
        QLOG_INFO() << "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN";

        if (preFlightWarningBox() == QMessageBox::Abort)
            return;

        int confirm = 1;
        float param1 = 1.0; // | 0: Do nothing for autopilot 1: Reboot autopilot, 2: Shutdown autopilot.
        float param2 = 1.0; // | 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer.
        float param3 = 0.0; // | Reserved|
        float param4 = 0.0; // | Reserved|
        float param5 = 0.0; // | Empty|
        float param6 = 0.0; // | Empty|
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_ALL;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    default:
        QLOG_INFO() << "sendApmRoverCommand: Unknown Command " << command;
    }
}
Пример #3
0
void UASActionsWidget::sendApmRoverCommand(MAV_CMD command)
{
    QLOG_INFO() << "UASActionWidget::sendApmRoverCommand";
    switch(command) {

    case MAV_CMD_NAV_RETURN_TO_LAUNCH: {
        /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty|  */
        Q_ASSERT(command == MAV_CMD_NAV_RETURN_TO_LAUNCH);
        QLOG_INFO() << "MAV_CMD_NAV_RETURN_TO_LAUNCH";

        int confirm = 1;    // [TODO] Verify This is what ArduRover Does.
        float param1 = 0.0; // Empty
        float param2 = 0.0; // Empty
        float param3 = 0.0; // [NOT USED] Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise
        float param4 = 0.0; // Desired yaw angle.|
        float param5 = 0.0; // Latitude
        float param6 = 0.0; // Longitude
        float param7 = 0.0; // Altitude
        int component = MAV_COMP_ID_PRIMARY;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    case MAV_CMD_PREFLIGHT_CALIBRATION: {
        // Trigger calibration. This command will be only accepted if in pre-flight mode.
        showPreflightCalibrationDialog();
    } break;

    case MAV_CMD_MISSION_START: {
        // start running a mission last_item:
        Q_ASSERT(command == MAV_CMD_MISSION_START);
        QLOG_INFO() << "MAV_CMD_MISSION_START";

        if (modeChangeWarningBox("Mission Start") == QMessageBox::Abort)
            return;

        int confirm = 1;
        float param1 = 1.0; // first_item: the first mission item to run
        float param2 = 0.0; // the last mission item to run (after this item is run, the mission ends)|
        float param3 = 0.0; // | Empty|
        float param4 = 0.0; // | Empty|
        float param5 = 0.0; // | Empty|
        float param6 = 0.0; // | Empty|
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_PRIMARY;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    case MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: {
        // Request the reboot or shutdown of system components.
        Q_ASSERT(command == MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN);
        QLOG_INFO() << "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN";

        if (preFlightWarningBox(this) == QMessageBox::Abort)
            return;

        int confirm = 1;
        float param1 = 1.0; // | 0: Do nothing for autopilot 1: Reboot autopilot, 2: Shutdown autopilot.
        float param2 = 1.0; // | 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer.
        float param3 = 0.0; // | Reserved|
        float param4 = 0.0; // | Reserved|
        float param5 = 0.0; // | Empty|
        float param6 = 0.0; // | Empty|
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_PRIMARY;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    case MAV_CMD_DO_DIGICAM_CONTROL: {
        // Take a photo
        Q_ASSERT(command == MAV_CMD_DO_DIGICAM_CONTROL);
        QLOG_INFO() << "MAV_CMD_DO_DIGICAM_CONTROL";

        int confirm = 1;
        float param1 = 0.0; // | Session control e.g. show/hide lens
        float param2 = 0.0; // | Zoom's absolute position
        float param3 = 0.0; // | Zooming step value to offset zoom from the current position
        float param4 = 0.0; // | Focus Locking, Unlocking or Re-locking
        float param5 = 1.0; // | Shooting Command
        float param6 = 0.0; // | Command Identity
        float param7 = 0.0; // | Empty|
        int component = MAV_COMP_ID_PRIMARY;
        m_uas->executeCommand(command,
                              confirm, param1, param2, param3,
                              param4, param5, param6, param7, component);

    } break;

    default:
        QLOG_INFO() << "sendApmRoverCommand: Unknown Command " << command;
    }
}