Skip to content

Commit 3cfdead

Browse files
committed
mission_raw: fix sequence for ArduPilot
We need to enter the home item before adding the sequence numbering. Signed-off-by: Julian Oes <[email protected]>
1 parent 5143e87 commit 3cfdead

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/mavsdk/plugins/mission_raw/mission_import.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ MissionImport::import_mission(const Json::Value& root, Autopilot autopilot)
112112
mission_items[0].current = 1;
113113
}
114114

115-
// Don't forget sequence number
116-
unsigned sequence = 0;
117-
for (auto& mission_item : mission_items) {
118-
mission_item.seq = sequence++;
119-
}
120-
121115
// Add home position at 0 for ArduPilot
122116
if (autopilot == Autopilot::ArduPilot) {
123117
const auto home = mission["plannedHomePosition"];
@@ -146,6 +140,12 @@ MissionImport::import_mission(const Json::Value& root, Autopilot autopilot)
146140
}
147141
}
148142

143+
// Don't forget sequence number
144+
unsigned sequence = 0;
145+
for (auto& mission_item : mission_items) {
146+
mission_item.seq = sequence++;
147+
}
148+
149149
// Returning an empty vector is ok here if there were really no mission items.
150150
return {mission_items};
151151
}

0 commit comments

Comments
 (0)