I’m picking up some old code and looking to tidy it up.
The current code looks to modify a long mission so it can be flown in short chunks with many landings and power cycles throughout. It would be really convenient to remove already past waypoints from the mission.
The examples show adding and editing but not removing.
Is there an easy way to remove a single waypoint(s) or would it be better to write a modified mission that omits the un unneeded waypoints to the sd card then just load it back in as the current mission?
You can’t remove waypoints, only write. So you would have to save, clear, modify and reload. We have examples for both load and save to file.
That is the exact response I was hoping for thank you.
You say save then modify, the lua scripts can interact with missions saved on the SD card in that manner? My idea was to just write the needed waypoints to the SD card and load that back. Editing the fully saved mission feels like it. Iggy offer more flexibility though.
I could be lazy and just modify all the un-needed waypoints into do set speeds I guess also lol, would rather do it nicely though
If you want to be really lazy you could just monitor the current active way point and advance past the one you want to skip without editing the mission at all. This sort of thing:
mission:set_current_cmd(mission:get_current_nav_index() + 1)
The AC gets power cycled between each update. In that case I could store the last waypoint in a param so it saved between boots and just have the script update after boot. The missions get really bloated as a set of waypoints gets added each time the mission is stopped so clearing them out is the best way to do everything.
I’m about to jump on a long haul flight, can you point me to any documentation on modifying missions saved to the SD card so I can read and tinker while in transit
Slightly off topic but related to the overall use, is it possible for the autopilot to push the changed mission to Mission Planner or is that an item that needs to be requested from MP?
Might need a script in MP as well to auto pull the updated mission when it sees fresh data come through the comms