Skip to content

Commit b7f115e

Browse files
create first item as takeoff item with initial drone location, then add waypoints as items then add landing location
1 parent 909489b commit b7f115e

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

src/components/menus/visualization-wizard/visualizations/mission/MissionPlanner.vue

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,37 @@ function generateQGroundControlPlan() {
246246
]
247247
248248
249-
const items = waypoints.value.map((wp, index) => {
250-
// const isFirstWaypoint = index === 0;
249+
// send takeoff
250+
const takeoffLocation = initialDroneLocation.value ?? waypoints.value[0];
251251
252-
return {
252+
const items: any[] = [{
253+
AMSLAltAboveTerrain: null,
254+
Altitude: 50,
255+
AltitudeMode: 1,
256+
autoContinue: true,
257+
command: 22, // 22 = takeoff
258+
doJumpId: 1,
259+
frame: 3,
260+
params: [
261+
0,
262+
0,
263+
0,
264+
null,
265+
takeoffLocation.lat,
266+
takeoffLocation.lon,
267+
takeoffLocation.alt,
268+
],
269+
type: "SimpleItem"
270+
}];
271+
272+
waypoints.value.forEach((wp, index) => {
273+
items.push({
253274
AMSLAltAboveTerrain: null,
254275
Altitude: 50,
255276
AltitudeMode: 1,
256277
autoContinue: true,
257-
command: 16, // 22 = takeoff, 16 = waypoint, 21 = landing
258-
// command: isFirstWaypoint ? 22 : 16, // 22 = takeoff, 16 = waypoint, 21 = landing
259-
doJumpId: index + 1,
278+
command: 16, // 16 = waypoint
279+
doJumpId: index + 2,
260280
frame: 3,
261281
params: [
262282
0,
@@ -265,13 +285,12 @@ function generateQGroundControlPlan() {
265285
null,
266286
wp.lat,
267287
wp.lon,
268-
wp.alt
288+
wp.alt,
269289
],
270290
type: "SimpleItem"
271-
}
291+
});
272292
});
273293
274-
// return to home item:
275294
items.push({
276295
AMSLAltAboveTerrain: null,
277296
Altitude: 0,

0 commit comments

Comments
 (0)