Browse Source

Merge pull request #6538 from DonLakeFlyer/CopterStartMission

Fix ArduCopter Start Mission support
QGC4.4
Don Gagne 7 years ago committed by GitHub
parent
commit
9fad53c6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      src/FirmwarePlugin/APM/APMFirmwarePlugin.cc

36
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc

@ -987,33 +987,25 @@ void APMFirmwarePlugin::startMission(Vehicle* vehicle)
return; return;
} }
if (vehicle->fixedWing()) { if (!vehicle->armed()) {
// Fixed wing will automatically start a mission if you switch to Auto while armed // First switch to flight mode we can arm from
if (!vehicle->armed()) { if (!_setFlightModeAndValidate(vehicle, "Guided")) {
// First switch to flight mode we can arm from
if (!_setFlightModeAndValidate(vehicle, "Guided")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Guided mode."));
return;
}
if (!_armVehicleAndValidate(vehicle)) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to arm."));
return;
}
}
} else {
// Copter will automatically start a mission from the ground if you change to Auto and do a START+MIS
if (!_setFlightModeAndValidate(vehicle, "Auto")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Guided mode.")); qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Guided mode."));
return; return;
} }
vehicle->sendMavCommand(vehicle->defaultComponentId(), MAV_CMD_MISSION_START, true /*show error */); if (!_armVehicleAndValidate(vehicle)) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to arm."));
return;
}
} }
// Final step is to go into Auto if (vehicle->fixedWing()) {
if (!_setFlightModeAndValidate(vehicle, "Auto")) { if (!_setFlightModeAndValidate(vehicle, "Auto")) {
qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode.")); qgcApp()->showMessage(tr("Unable to start mission: Vehicle failed to change to Auto mode."));
return; return;
}
} else {
vehicle->sendMavCommand(vehicle->defaultComponentId(), MAV_CMD_MISSION_START, true /*show error */);
} }
} }

Loading…
Cancel
Save