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 sim-vehicle.py 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 arducopter.py in this:

You can create a test procedure like this.
You can edit arducopter.py 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.

Try

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

https://ardupilot.org/dev/docs/the-ardupilot-autotest-framework.html

1 Like