Commit a3683701 authored by Don Gagne's avatar Don Gagne

Merge pull request #2986 from NaterGator/missionclicks

Implement click-to-retask via MISSION_SET_CURRENT in flight view for #2275
parents 90170eb1 e0caee43
......@@ -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,6 +42,10 @@ MapItemView {
z: QGroundControl.zOrderMapItems
missionItem: object
sequenceNumber: object.sequenceNumber
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 {
......@@ -55,8 +59,6 @@ MapItemView {
label: object.sequenceNumber
isCurrentItem: object.isCurrentItem
z: 2
onClicked: setCurrentItem(object.sequenceNumber)
}
}
}
......
......@@ -1490,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;
......@@ -1511,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,6 +433,7 @@ public:
QString flightMode(void) const;
void setFlightMode(const QString& flightMode);
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