Commit 3345db1e authored by Danny Schrader's avatar Danny Schrader

added Abort button (for abort landing). button sends MAV_CMD_DO_GO_AROUND.

parent d48c0084
......@@ -16,6 +16,7 @@
static FirmwarePluginFactoryRegister* _instance = NULL;
const char* guided_mode_not_supported_by_vehicle = "Guided mode not supported by Vehicle.";
const char* landing_aborted = "Landing aborted.";
const char* FirmwarePlugin::px4FollowMeFlightMode = "Follow Me";
......@@ -231,6 +232,12 @@ void FirmwarePlugin::pauseVehicle(Vehicle* vehicle)
qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
}
void FirmwarePlugin::abortLanding(Vehicle* vehicle)
{
Q_UNUSED(vehicle);
qgcApp()->showMessage(landing_aborted);
}
void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle)
{
// Not supported by generic vehicle
......
......@@ -105,6 +105,9 @@ public:
/// If not, vehicle will be left in Loiter.
virtual void pauseVehicle(Vehicle* vehicle);
/// Command vehicle to abort landing
virtual void abortLanding(Vehicle* vehicle);
/// Command vehicle to return to launch
virtual void guidedModeRTL(Vehicle* vehicle);
......
......@@ -191,6 +191,7 @@ Item {
readonly property int confirmGoTo: 8
readonly property int confirmRetask: 9
readonly property int confirmOrbit: 10
readonly property int confirmAbort: 11
property int confirmActionCode
property real _showMargin: _margins
......@@ -238,6 +239,9 @@ Item {
//-- Center on current flight map position and orbit with a 50m radius (velocity/direction controlled by the RC)
//_activeVehicle.guidedModeOrbit(QGroundControl.flightMapPosition, 50.0)
break;
case confirmAbort:
_activeVehicle.abortLanding()
break;
default:
console.warn(qsTr("Internal error: unknown confirmActionCode"), confirmActionCode)
}
......@@ -289,6 +293,9 @@ Item {
case confirmOrbit:
guidedModeConfirm.confirmText = qsTr("enter orbit mode")
break;
case confirmAbort:
guidedModeConfirm.confirmText = qsTr("abort landing")
break;
}
_guidedModeBar.visible = false
guidedModeConfirm.visible = true
......@@ -356,6 +363,13 @@ Item {
onClicked: _guidedModeBar.confirmAction(_guidedModeBar.confirmOrbit)
}
QGCButton {
pointSize: _guidedModeBar._fontPointSize
text: qsTr("Abort")
visible: _activeVehicle && _activeVehicle.flying
onClicked: _guidedModeBar.confirmAction(_guidedModeBar.confirmAbort)
}
} // Row
} // Column
} // Rectangle - Guided mode buttons
......
......@@ -1838,6 +1838,16 @@ void Vehicle::pauseVehicle(void)
_firmwarePlugin->pauseVehicle(this);
}
void Vehicle::abortLanding(void)
{
sendMavCommand(defaultComponentId(),
MAV_CMD_DO_GO_AROUND,
true, // show error if fails
50);
//_firmwarePlugin->abortLanding(this);
}
bool Vehicle::guidedMode(void) const
{
return _firmwarePlugin->isGuidedMode(this);
......
......@@ -355,6 +355,9 @@ public:
/// Command vehicle to kill all motors no matter what state
Q_INVOKABLE void emergencyStop(void);
/// Command vehicle to abort landing
Q_INVOKABLE void abortLanding(void);
/// Alter the current mission item on the vehicle
Q_INVOKABLE void setCurrentMissionSequence(int seq);
......
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