Automatically start SITL with a specific mission file

Hello guys,
What I want to achieve:
Run SITL simulator on linux programmatically with different mission files each time I invoke the simulator. The program should start SITL with a specific mission, let the simulator finish and then start SITL again with a different mission.

What I already did:
I configured some parameters to enable arming in auto-mode and I created a small lua script to automatically arm the drone.

The problem:
Everytime I load SITL the drone will just start the last mission that I loaded with wp load mission.txt .

I’m pretty new to ardupilot and SITL in general and I could not find any information on how to fulfill my wanted outcome so maybe you guys know better and can help me out here :slight_smile:

I am running SITL on Linux using the provided in the ardupilot repository.

Lacking deeper knowledge of SITL command line options, I’d incorporate a mission load function into your Lua script. Have it look for mission files in sequence until it finds one - like “0.waypoints”, “1.waypoints”, etc. Once it has found and loaded a mission, have it delete the file (or save a user parameter with the file sequence number) so that it will step to the next one one a subsequent boot.

You can easily do what you want using auto test tools of ardupilot.
Take a look changes in in this:

You can create a test procedure like this.
You can edit like you want.

1 Like

Or simply copy the eeprom.bin file with the mission you want to load.

You’re after the autotest framework.


./Tools/autotest/ build.Copter test.Copter.CopterMission

1 Like