Home How to change Home Location on ArduPilot SITL simulation?
Post
Cancel

How to change Home Location on ArduPilot SITL simulation?

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 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 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. NoNameLatitudeLongitudeAbsolute AltitudeHeading
1OSRF037.4003371-122.08003510353
2OSRF0_PILOTSBOX37.4003371-122.08003512270
3CMAC-35.363261149.16523584353
4CMAC2-35.362889149.165221584270
5CMAC_South-35.363261149.16523584173
6CMAC_PILOTSBOX-35.362734149.1653586270
7CMAC_PILOTSBOX2-35.362749149.165359584270
8Kingaroy-26.583528151.84044444169
9AVC40.0713749-105.22978891583.702759246
10AVC_copter40.072842-105.23057515860
11AVC_plane40.072842-105.230575158680
12McMillan35.718719-120.769818275295
13McMillan_East35.7168007-120.7644466275295
14TomCarpark26.04895-80.2542196270
15Ballarat-37.598705143.881744485165
16CRAMS-27.675284152.51930758285
173DRBerkeley37.872991-122.30234820260
18BMAC-35.226343149.132122588301
19LGAT37.88906323.73186321330
20BHV53.5477678.626440324
21QMAC-35.363724149.430011740312
22Karuizawa36.324306138.6392829380
23Dalby-27.274439151.2900643438.7
24RFRanch37.118079-2.773691297.88180
25KSFO37.619373-122.3766375.3118
26NFSC53.6375619.929813345
27Rotherham53.275131-1.1940421360
28LeeField32.42553-84.7910975260
29Sterling38.98248-77.4395678890
30EPIgijon43.521902-5.62431220
31PerkinsField36.163609-78.80686413720
32KNUI38.145322-76.426652770
33Range1141.360461-74.032838220180
34Flicker39.018801-104.8930812158180
35ElliottField34.458281-84.180209450130
36CobbCountyRC34.013819-84.724446280105
37GrupoSicoss19.316518-99.22025500
38Garrawarra-34.159752150.967395293165
39Snarbyeidet69.77583919.54892987170
40Breivikeidet69.62402519.41404755235
41Hata35.671497140.0839346165
42TagusPark38.740195-9.3018431510
43Marcopter44.80696811.610389090
44HMAS-33.6615150.841431180
45RATBeach33.810313-118.3938670270
46Carstensz-35.331302149.13210360660
47Skyrocket33.982069-118.42637211134
48SkyViperFactory23.021754114.073139130
49KazakoshiPark36.321909138.5960219320
50SKT44.850687-0.684029450
51UChicago41.7886079-87.59871331910
52Yachiyo35.770481140.1079293690
53Tyndall30.0142232-85.498470170
54Elvenes68.87142217.9866917256
55Kawachi35.879129140.33968370
56SpringValley-35.280252149.005821597.35
57SpringValley2-35.28240059149.005420458210
58Pyramid29.976431.133900
59AAMEastField39.842288-105.2129281809106
60HachinoheMine40.4539496141.541905156270
61HighwayField-33.95045822.977709240300
62AAMWestField39.842218-105.219375181490.5
63EliField40.059488-88.55131420637
64Goretovka55.968937.1101200290
65Kris22.7400596120.3097528210
66ARACE_copter47.521192918.808235519855
67ARACE_plane47.521087618.808394819855
68ARACE_hand47.521151618.808160719855
69NDRCC33.24065965-96.93759168163.5167
70Boquig16.090473120.36147830
71Semisopochnoi51.9634179.75612090
72Unalga51.578-179.048342270
73Rabi-16.51273251179.97642027.590
74KFC34.841292136.2154873196.36338
75KawaguchiLake35.4712023138.745026196590
76GrandCanyon36.146-113.891425.690
77YPG32.976658-114.266699252.97235
78Yuma32.638083-114.403104950
79Williams39.16417503-122.131756200
80SCCMAS37.1730398-121.6815865102315
81ARPstrip_NZ-43.6544343172.50318290156
82ARPstrip_NZ_S-43.6541316172.50298440156
83ARPstrip_NZ_N-43.6545022172.50318830336
84CMAC_NZ_E-43.47493266172.318144084
85CMAC_NZ_W-43.47493266172.3181440264

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

  1. Using SITL, ArduPilot. 

Advertisement

This post is licensed under CC BY-SA 4.0 by the author.

Advertisement

Contents

Advertisement

Dhulkarnayn - Elucidate Drones

Dhulkarnayn

I am 25 years old drone developer, holds a postgraduate degree in Avionics. I've worked on a few complex projects like drone swarms, drone light shows, autonomous landing of drones using computer-vision algorithms, etc. Since childhood, I'm much passionate about electronics, aerospace & engineering.

Please consider supporting this project!

If this article has been of help to you, and you feel generous at the moment, don’t hesitate to buy me a coffee. ☕

Buy me a coffee

How to set up ArduPilot SITL on Linux?

Drone Programming - Autonomous Take-off and Landing of Drones using DroneKit-Python


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!

Author Dhulkarnayn October 18th, 2022 23:33

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?

Author Dhulkarnayn October 9th, 2022 21:59

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! 😕