Switch Missions 'on the fly'

@McKey

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 :slight_smile: 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.

thanks for the clarification

@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.

It seems that @HaBa has the same usecase :wink: (pls see the two posts obove)

Look here: Setting LAND waypoint via LUA script?

P.S. Hallo Willy :wink:

Hallo Reinhard, die Welt ist ein Dorf :smile:

It seems that’s not a new idea. Before I will start coding, I will have a look there, if it’s still open.

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.

TESTERS WANTED!

Hello @Target0815 @McKey @Yuri_Rage @HaBa @Allister and all other users of that script.
I started a PR for pulling that script into ArduPilot codebase.

Therefor I tuned the code a little and prepared a document.

Please see last posts for last lua-file.
SM_SwitchMission-md.txt (3.3 KB)

It would be great if you could test the latest version and leave a comment in GitHub or here.
Thank you in advance

1 Like

I wish I could offer some help but winter has set in here with vengeance so only hangar flying for me for the foreseeable future.

@Allister No clue where you are living, but here in Germany it’s just the same :o(
One hour a week in a tripe gym is the only possible activity.

I will test on Pixhawk 2.4.8 version of rover.

1 Like

I’m in Canada so spring is a long way off still. If I have any luck bench testing I’ll let you know.

1 Like

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)

1 Like

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!

1 Like

@McKey Thank you for testing and the positive Feedback.

1 Like

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?

I don’t think so, if you read the introduction in the WIKI ( Lua Scripts — Plane documentation ) and regarding this script the thread here. Willy Zehnder @Quaxwilly has written a detailed script guide: Switch Missions 'on the fly' - #44 by Quaxwilly

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.

Rolf

1 Like

Thanks for the reply, I cant wait to try it. Ardupilot is completely addictive and exciting, but can be very frustrating aswell.

Thank you @Rolf for the really quick response :smile:
@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.