Commit bbff4468 authored by Patrick José Pereira's avatar Patrick José Pereira

MissionController: Add takeoff only with supported vehicles

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent 79b32cc0
...@@ -340,7 +340,10 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i) ...@@ -340,7 +340,10 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
newItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT); newItem->setCommand(MavlinkQmlSingleton::MAV_CMD_NAV_WAYPOINT);
_initVisualItem(newItem); _initVisualItem(newItem);
if (_visualItems->count() == 1) { if (_visualItems->count() == 1) {
newItem->setCommand(_controllerVehicle->vtol() ? MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF : MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF); MavlinkQmlSingleton::Qml_MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF : MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF;
if (_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)takeoffCmd)) {
newItem->setCommand(takeoffCmd);
}
} }
newItem->setDefaultsForCommand(); newItem->setDefaultsForCommand();
if ((MAV_CMD)newItem->command() == MAV_CMD_NAV_WAYPOINT) { if ((MAV_CMD)newItem->command() == MAV_CMD_NAV_WAYPOINT) {
...@@ -1033,7 +1036,8 @@ void MissionController::_recalcWaypointLines(void) ...@@ -1033,7 +1036,8 @@ void MissionController::_recalcWaypointLines(void)
// If we still haven't found the first coordinate item and we hit a takeoff command, link back to home // If we still haven't found the first coordinate item and we hit a takeoff command, link back to home
if (firstCoordinateItem && if (firstCoordinateItem &&
item->isSimpleItem() && item->isSimpleItem() &&
(qobject_cast<SimpleMissionItem*>(item)->command() == MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF || (!_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains(MAV_CMD_NAV_TAKEOFF) ||
qobject_cast<SimpleMissionItem*>(item)->command() == MavlinkQmlSingleton::MAV_CMD_NAV_TAKEOFF ||
qobject_cast<SimpleMissionItem*>(item)->command() == MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF)) { qobject_cast<SimpleMissionItem*>(item)->command() == MavlinkQmlSingleton::MAV_CMD_NAV_VTOL_TAKEOFF)) {
linkStartToHome = true; linkStartToHome = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment