No, that’s the way that script is working. It stops counting Missions as soon as the Mission with the following number is not existing. You have to assure that the Missions you want to use are in ascending order without a gap.
It would be possible, but that’s not the aim of that script.
To create a Mission you should e.g. use MissionPlanner at home or use a GCS at the airfield.
Thank you for your suggestion, but in my case this isn’t possible => I use the pix in a small boat for fishing, I create waypoints when I am at the water. I could manage waypoints in a mission over some apps, the whole point of my question was about not “fiddling” around with any device e.g. after finding 6 fishing spots send the boat to a single one of them by only pushing a button on the remote and without using some app on phone or tablet.
@HaBa Hallo Harald, now I understand what you are aiming to do. That’s a very special task, but it should be easy to realize as an additional option in the script. I still have it in mind, but give me a little while to put it in the code.
@Quaxwilly@Yuri_Rage could you give hints on creating a script that could save (on an sd card) the current position as a mission with one waypoint.
I didn’t find this in the examples.
hi @Target0815
thanks for the link! As I understand it, this script saves the mission to the controller’s memory? The next step is to use saving the current mission to the SD card.
I improved the return structure and avoided the return of a nil-value.
For test and using you should download that updated Script (14.12.2022) : SM_SwitchMission.lua (11.3 KB)
Hi @Quaxwilly!
I tested your last script. Everything works fine!
Tested on Pixhawk 2.4.8 and the latest stable version for the rover. The radio was a Radiomaster TX16S. Thank you so much for your hard work!
Hi all, i just stumbled upon this. I was asking late 2022 about exactly this function and wondering how i might be able to achieve the switching of pre loaded missions via the transmitter without connecting a GCS. Is it difficult to implement this script? Or has it been added into the ardupilot code? Do scrips like this just run on the transmitter and somehow send a mavlink command to select missions or is it new code on the fc which makes this possible?
LUA scripts run with Arduplane on the flight controller. Not every controller has enough memory capacity to run LUA scripting. It works very well e.g. with the Mateksys F765 and H743 boards.
Thank you @Rolf for the really quick response @Scott_Nunan It would be great if you would post a feedback here after your try, because the developers are waiting for positive feedback of testers before they will merge that PR in the example-code.