Commit e0caee43 authored by Nate Weibley's avatar Nate Weibley

Confirm retasking command before altering active waypoint

parent b7ea870f
......@@ -48,6 +48,7 @@ FlightMap {
property bool _activeVehicleCoordinateValid: _activeVehicle ? _activeVehicle.coordinateValid : false
property var activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
property var _gotoHereCoordinate: QtPositioning.coordinate()
property int _retaskSequence: 0
Component.onCompleted: {
QGroundControl.flightMapPosition = center
......
......@@ -286,6 +286,7 @@ Item {
readonly property int confirmEmergencyStop: 6
readonly property int confirmChangeAlt: 7
readonly property int confirmGoTo: 8
readonly property int confirmRetask: 9
property int confirmActionCode
property string confirmText
......@@ -322,6 +323,9 @@ Item {
case confirmGoTo:
_activeVehicle.guidedModeGotoLocation(_flightMap._gotoHereCoordinate)
break;
case confirmRetask:
_activeVehicle.setCurrentMissionSequence(_flightMap._retaskSequence)
break;
default:
console.warn("Internal error: unknown confirmActionCode", confirmActionCode)
}
......@@ -355,6 +359,9 @@ Item {
case confirmGoTo:
_guidedModeBar.confirmText = "move"
break;
case confirmRetask:
_guidedModeBar.confirmText = "active waypoint change"
break;
}
guidedModeButtons.visible = false
guidedModeConfirm.visible = true
......
......@@ -42,7 +42,10 @@ MapItemView {
z: QGroundControl.zOrderMapItems
missionItem: object
sequenceNumber: object.sequenceNumber
onClicked: object.tryMakingCurrent()
onClicked: {
parent._retaskSequence = object.sequenceNumber
parent.flightWidgets.guidedModeBar.confirmAction(parent.flightWidgets.guidedModeBar.confirmRetask)
}
// These are the non-coordinate child mission items attached to this item
Row {
......
......@@ -103,8 +103,3 @@ void VisualMissionItem::setAzimuth(double azimuth)
_azimuth = azimuth;
emit azimuthChanged(_azimuth);
}
void VisualMissionItem::tryMakingCurrent()
{
_vehicle->setCurrentMissionSequence(sequenceNumber());
}
......@@ -92,8 +92,6 @@ public:
/// are shown next to the exitCoordinate indidcator in the ui.
Q_PROPERTY(QmlObjectListModel* childItems READ childItems CONSTANT)
Q_INVOKABLE void tryMakingCurrent();
// Property accesors
double altDifference (void) const { return _altDifference; }
......
......@@ -1136,16 +1136,6 @@ void Vehicle::setFlightMode(const QString& flightMode)
}
}
void Vehicle::setCurrentMissionSequence(int seq)
{
if (!_firmwarePlugin->sendHomePositionToVehicle()) {
seq--;
}
mavlink_message_t msg;
mavlink_msg_mission_set_current_pack(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, id(), _compID, seq);
sendMessage(msg);
}
bool Vehicle::hilMode(void)
{
return _base_mode & MAV_MODE_FLAG_HIL_ENABLED;
......@@ -1500,6 +1490,16 @@ void Vehicle::emergencyStop(void)
sendMessage(msg);
}
void Vehicle::setCurrentMissionSequence(int seq)
{
if (!_firmwarePlugin->sendHomePositionToVehicle()) {
seq--;
}
mavlink_message_t msg;
mavlink_msg_mission_set_current_pack(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, id(), _compID, seq);
sendMessage(msg);
}
void Vehicle::doCommandLong(int component, MAV_CMD command, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
mavlink_message_t msg;
......@@ -1521,6 +1521,7 @@ void Vehicle::doCommandLong(int component, MAV_CMD command, float param1, float
sendMessage(msg);
}
const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
......@@ -356,6 +356,9 @@ public:
/// Command vehicle to kill all motors no matter what state
Q_INVOKABLE void emergencyStop(void);
/// Alter the current mission item on the vehicle
Q_INVOKABLE void setCurrentMissionSequence(int seq);
bool guidedModeSupported(void) const;
bool pauseVehicleSupported(void) const;
......@@ -430,7 +433,6 @@ public:
QString flightMode(void) const;
void setFlightMode(const QString& flightMode);
void setCurrentMissionSequence(int seq);
bool hilMode(void);
void setHilMode(bool hilMode);
......
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