After setting up the ArduPilot’s Software In The Loop (SITL) simulation environment on your device, you can able to simulate the behavior of your desired vehicle type present in the ArduPilot’s firmware.1 The ArduPilot supported vehicle type includes,
- Multicopter (ArduCopter)
- Fixed-Wing (ArduPlane)
- Submarine (ArduSub)
- Rover (Rover)
ArduPilot - Directory
You can able to simulate the desired vehicle by navigating to the respective vehicle folder present in the ardupilot
directory. Each time the following location will be selected as the default by the ArduPilot SITL when you try to simulate the desired vehicle from the ArduPilot firmware.
Even though changing the location in the SITL doesn’t affect the vehicle’s behavior, there will be a requirement to change the location of the simulation in some cases. You can able to change the home location of the SITL simulation on your device in that case.
Changing Home Location on SITL
To start the simulator, change the directory to the vehicle directory.[^fn-nth-2] For example, to simulate the multi-copter, change the directory to ardupilot/ArduCopter, by executing the following command on your terminal:
1
$ cd ardupilot/ArduCopter
You can also open the terminal window using the keyboard shortcut Ctrl + Alt + T
Then start the simulator by executing the sim_vehicle.py
.
1
$ sim_vehicle.py --console --map
ArduPilot - SITL
The above action will lead to starting the simulation of the copter in the default location. But to start the simulation at a particular home location, you need to call the sim_vehicle.py
with the -L
parameter and a named location in the ardupilot/Tools/autotest/locations.txt file.
Advertisement
For example, to start Copter in Unalga (a named location in locations.txt
), execute the following command on your terminal. But, Before that, kill the sim_vehicle.py
you are already running, using the keyboard shortcut Ctrl + C and then:
1
$ sim_vehicle.py -L Unalga --console --map
Adding New Locations
Also, you can add a new location to the SITL simulation environment by updating the locations.txt
file.
For example, if you want to add a location named Backyard, then add the Backyard’s Latitude, Longitude, Mean Sea Level, and Heading to the locations.txt
file.
1
2
Unalga=51.578,-179.0483,42.0,270.0
Backyard=51.578,-179.0483,42.0,270.0
By adding your location on the last line of the locations.txt
file, you can now able to call this location on your SITL by executing the following command on your terminal. But, Before that, kill the sim_vehicle.py you are already running:
1
$ sim_vehicle.py -L Backyard --console --map
Yay, now you’ve learned to change the home location of your simulated vehicle on ArduPilot SITL simulation!!!
Advertisement
List of available Locations in SITL
The following is the list of already available locations present in the locations.txt
file, adding for your reference:
S. No | Name | Latitude | Longitude | Absolute Altitude | Heading |
---|---|---|---|---|---|
1 | OSRF0 | 37.4003371 | -122.0800351 | 0 | 353 |
2 | OSRF0_PILOTSBOX | 37.4003371 | -122.0800351 | 2 | 270 |
3 | CMAC | -35.363261 | 149.16523 | 584 | 353 |
4 | CMAC2 | -35.362889 | 149.165221 | 584 | 270 |
5 | CMAC_South | -35.363261 | 149.16523 | 584 | 173 |
6 | CMAC_PILOTSBOX | -35.362734 | 149.1653 | 586 | 270 |
7 | CMAC_PILOTSBOX2 | -35.362749 | 149.165359 | 584 | 270 |
8 | Kingaroy | -26.583528 | 151.84044 | 444 | 169 |
9 | AVC | 40.0713749 | -105.2297889 | 1583.702759 | 246 |
10 | AVC_copter | 40.072842 | -105.230575 | 1586 | 0 |
11 | AVC_plane | 40.072842 | -105.230575 | 1586 | 80 |
12 | McMillan | 35.718719 | -120.769818 | 275 | 295 |
13 | McMillan_East | 35.7168007 | -120.7644466 | 275 | 295 |
14 | TomCarpark | 26.04895 | -80.254219 | 6 | 270 |
15 | Ballarat | -37.598705 | 143.881744 | 485 | 165 |
16 | CRAMS | -27.675284 | 152.519307 | 58 | 285 |
17 | 3DRBerkeley | 37.872991 | -122.302348 | 20 | 260 |
18 | BMAC | -35.226343 | 149.132122 | 588 | 301 |
19 | LGAT | 37.889063 | 23.731863 | 21 | 330 |
20 | BHV | 53.547767 | 8.62644 | 0 | 324 |
21 | QMAC | -35.363724 | 149.430011 | 740 | 312 |
22 | Karuizawa | 36.324306 | 138.639282 | 938 | 0 |
23 | Dalby | -27.274439 | 151.290064 | 343 | 8.7 |
24 | RFRanch | 37.118079 | -2.77369 | 1297.88 | 180 |
25 | KSFO | 37.619373 | -122.376637 | 5.3 | 118 |
26 | NFSC | 53.637561 | 9.9298 | 13 | 345 |
27 | Rotherham | 53.275131 | -1.19404 | 21 | 360 |
28 | LeeField | 32.42553 | -84.79109 | 75 | 260 |
29 | Sterling | 38.98248 | -77.439567 | 88 | 90 |
30 | EPIgijon | 43.521902 | -5.62431 | 22 | 0 |
31 | PerkinsField | 36.163609 | -78.806864 | 137 | 20 |
32 | KNUI | 38.145322 | -76.426652 | 7 | 70 |
33 | Range11 | 41.360461 | -74.032838 | 220 | 180 |
34 | Flicker | 39.018801 | -104.893081 | 2158 | 180 |
35 | ElliottField | 34.458281 | -84.180209 | 450 | 130 |
36 | CobbCountyRC | 34.013819 | -84.724446 | 280 | 105 |
37 | GrupoSicoss | 19.316518 | -99.220255 | 0 | 0 |
38 | Garrawarra | -34.159752 | 150.967395 | 293 | 165 |
39 | Snarbyeidet | 69.775839 | 19.548929 | 87 | 170 |
40 | Breivikeidet | 69.624025 | 19.414047 | 55 | 235 |
41 | Hata | 35.671497 | 140.083934 | 6 | 165 |
42 | TagusPark | 38.740195 | -9.301843 | 151 | 0 |
43 | Marcopter | 44.806968 | 11.610389 | 0 | 90 |
44 | HMAS | -33.6615 | 150.841431 | 18 | 0 |
45 | RATBeach | 33.810313 | -118.393867 | 0 | 270 |
46 | Carstensz | -35.331302 | 149.132103 | 606 | 60 |
47 | Skyrocket | 33.982069 | -118.426372 | 11 | 134 |
48 | SkyViperFactory | 23.021754 | 114.073139 | 13 | 0 |
49 | KazakoshiPark | 36.321909 | 138.596021 | 932 | 0 |
50 | SKT | 44.850687 | -0.684029 | 45 | 0 |
51 | UChicago | 41.7886079 | -87.5987133 | 191 | 0 |
52 | Yachiyo | 35.770481 | 140.107929 | 36 | 90 |
53 | Tyndall | 30.0142232 | -85.4984701 | 7 | 0 |
54 | Elvenes | 68.871422 | 17.98669 | 17 | 256 |
55 | Kawachi | 35.879129 | 140.339683 | 7 | 0 |
56 | SpringValley | -35.280252 | 149.005821 | 597.3 | 5 |
57 | SpringValley2 | -35.28240059 | 149.0054204 | 582 | 10 |
58 | Pyramid | 29.9764 | 31.1339 | 0 | 0 |
59 | AAMEastField | 39.842288 | -105.212928 | 1809 | 106 |
60 | HachinoheMine | 40.4539496 | 141.5419051 | 56 | 270 |
61 | HighwayField | -33.950458 | 22.977709 | 240 | 300 |
62 | AAMWestField | 39.842218 | -105.219375 | 1814 | 90.5 |
63 | EliField | 40.059488 | -88.551314 | 206 | 37 |
64 | Goretovka | 55.9689 | 37.1101 | 200 | 290 |
65 | Kris | 22.7400596 | 120.3097528 | 21 | 0 |
66 | ARACE_copter | 47.5211929 | 18.8082355 | 198 | 55 |
67 | ARACE_plane | 47.5210876 | 18.8083948 | 198 | 55 |
68 | ARACE_hand | 47.5211516 | 18.8081607 | 198 | 55 |
69 | NDRCC | 33.24065965 | -96.93759168 | 163.5 | 167 |
70 | Boquig | 16.090473 | 120.361478 | 3 | 0 |
71 | Semisopochnoi | 51.9634 | 179.756 | 120 | 90 |
72 | Unalga | 51.578 | -179.0483 | 42 | 270 |
73 | Rabi | -16.51273251 | 179.9764202 | 7.5 | 90 |
74 | KFC | 34.841292 | 136.2154873 | 196.36 | 338 |
75 | KawaguchiLake | 35.4712023 | 138.7450261 | 965 | 90 |
76 | GrandCanyon | 36.146 | -113.89 | 1425.6 | 90 |
77 | YPG | 32.976658 | -114.266699 | 252.97 | 235 |
78 | Yuma | 32.638083 | -114.403104 | 95 | 0 |
79 | Williams | 39.16417503 | -122.1317562 | 0 | 0 |
80 | SCCMAS | 37.1730398 | -121.6815865 | 102 | 315 |
81 | ARPstrip_NZ | -43.6544343 | 172.5031829 | 0 | 156 |
82 | ARPstrip_NZ_S | -43.6541316 | 172.5029844 | 0 | 156 |
83 | ARPstrip_NZ_N | -43.6545022 | 172.5031883 | 0 | 336 |
84 | CMAC_NZ_E | -43.47493266 | 172.318144 | 0 | 84 |
85 | CMAC_NZ_W | -43.47493266 | 172.318144 | 0 | 264 |
Source: locations.txt
Conclusion
In this article, I’ve tried to explain how to change the home location on the ArduPilot’s Software In the Loop (SITL) simulation. I’m expectantly waiting for your valuable feedback and suggestions regarding this topic.
At last, Sharing is Caring, feel free to share with your friends if you’ve liked this article. Thank you!
References
Using SITL, ArduPilot. ↩
Comments
Just what I was looking for! I’m able to save the new location to the locations.txt, but when I attempt to start SITL with the new location, I get the following error: “SIM_VEHICLE: Start SIM_VEHICLE: Killing tasks geocoder not installed SIM_VEHICLE: Killing tasks”
Loading other locations from the locations.txt file works just fine, so why do I need to install this geocoder?
Thanks!
Dave, It’ll work if we add a new location on locations.txt file, need to investigate more on the geocoder.
Also, on which OS you’re trying these changes?
hello , At first thank you for your tutorial. I tried your codes all worked well. Ardupilot started at my new location. But after ı did that ı cant watch it on gazebo. It broke connection with gazebo. Do you have any idea for how can ı connect gazebo and ardupilot again with my new added location?
Thank you, Bilal. I’ve never used Gazebo till now.
Is there anywhere the scenery you’re loading in the Gazebo has coordinates mentioned?
If so, then you can try to match the scenery’s coordinated to the actual simulation coordinates.
But not sure, how we can do that! 😕