Switch Missions 'on the fly'

To abbreviate all the text is a good idea. I also use the Yaapu-Script on a Taranis X9E and it still has a smaller display than your Radiomaster transmitter :+1:
For cleanliness I would prefer to have the missions in a subdir, but it should have a very short name - e.g. just “/m”. Maybe it improves the radability to display just the Mission# instead of the path+filename - I’ll have a look on that.

The idea of @Yuri_Rage is very nice and I will implement the proposal of him the next days.

Btw. I guess you are using OpenTX? Here it’s easy to use a stepped Curve to bring the output of a 6-step-switch or a slider/poti to the desired steps. E.g. I use a slider as a simulated 5-step switch to select the flight-MODE.

I agree that the names of folders and files can be shortened to one letter.

Yes I use OpenTX. that’s exactly how it is, I use curves. I also added a few more switches, one of them is 5-step (6 is possible). I use the standard one to switch flight modes, and the second one is for switching missions. But if it is possible to switch “infinitely”(as @Yuri_Rage suggested) with a conventional switch, then it will be much better.

The code to do that already exists above, including some brief instructions as to how to fully implement it.

Yes Yuri, that’s very helpful, but some things I will realize in a bit different way. And not just to copy your code will bring me forward :wink:
The journey is the reward :slightly_smiling_face:

1 Like

Here is the script with short GCS-messages and all options I consider to be convenient.
Ideas to make it more convenient are very welcome.

Because I love the minimalist way to go flying (just model, accu, transmitter+Yaapu-script - without GCS) I used the still existing SCR_USERx parameters that I can prepare at home (and if necessary change via WLAN/cellphone on airfield).

SM_SwitchMission(1.4.1).lua (12.4 KB)

1 Like

You can set custom parameters at home just the same. Their values are saved in non-volatile memory.

I haven’t been sure and tested it - they’ve gone. Maybe that’s a behavior in SITL? Or do I have to do an extra step?
If the self-defined parameters are permanent, I would surely prefer to use them.

They are permanent, as are their values. The script must execute to initialize them before you’ll see them in the GCS, but their values remain as previously configured.

Tested the latest version with an “infinite” choice. Everything works fine. This is simply incomparable!

1 Like

I don’t have a clue what I made wrong at my test - using of SCR_USERx is just obsolete.

Now a script-specific table of parameters is used:
SM_SwitchMission(1.4.2).lua (13.0 KB)

1 Like

Is there any chance to select waypoints within on mission?

e.g. I set 6 waypoints and want to drive/fly to point 1 so set e.g. one of the 6 “mode”-buttons on the TX16 and “activate” with another switch?

That would be easier as you could use all the common tools to create the mission with 6 WP without the need for a laptop / other computer

Hi @Quaxwilly!

  • I have a question about the script. If you use names ***#1, ***#2, ***#3 then everything is fine, but if it is ***#1, ***#2, ***#3, and the next one will be ***#5 then it won’t load. Can this be fixed?

  • In the examples there is an example of saving a mission to a memory card. Is it possible to save the current position as a mission (there is only one point in the mission)?
    ardupilot/mission-save.lua at APMrover2-stable · ArduPilot/ardupilot · GitHub

At home use e.g. MissionPlanner and create 6 Missions with one waypoint of your choice.
Name the Missions Mission#1.waypoints, Mission#2.waypoints … Mission#6.waypoints.
Start the script and set SM_POSITIONS to 1 to select the Missions via pushbutton.

So you are able to select every waypoint as a destination.


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.