Changing Home Location on SITL?

So this is a continumation from this discussion here:

Except I have found away to remove the AUTO setting error, now I do not know how to change the SITL home location of SITL_START_LOCATION from ardupilot/Tools/autotest/arducopter.py at master · ArduPilot/ardupilot · GitHub . As I do not use a map and do not want to start the drone in Australia. I want the home drone to be 0,0,0.

I tried to change it in my local source code, but that did nothing, the next was change CMAC2 and CMAC of locations.txt, but that also did nothing. Then I came across this Setting the home at the start of SITL , however I do not understand how “No rebuild is required. Try using a file in your home directory instead
of modifying locations.txt:” would be done. Anyone have any suggestions?
I am very new to ArduPilot so any suggestions would be very helpful!. Thank you.

Usually I just set home location in the plan screen and then boot up the SITL through Mission Planner. It then uses the set home location as the SITL Home Location.

Another option is loading up your mission (with correct home location) - and then starting the SITL through MP.

Ah, I am using MAVProxy as a GCS, plus I am not using a map as the simulation is not meant to be anywhere specific in the world. Thank you for the suggestion though.

In case you don’t know you can get a full list of commands by adding --help
./Tools/autotest/sim_vehicle.py -j 16 -v ArduCopter -D --help

Here is the dirty way I was it doing until your post.

./Tools/autotest/sim_vehicle.py -j 16 -v ArduCopter -D -l 42.73380516730135,-86.20706791790283,188,5

-L LOCATION, --location=LOCATION
                    use start location from Tools/autotest/locations.txt
-l CUSTOM_LOCATION, --custom-location=CUSTOM_LOCATION
                    set custom start location (lat,lon,alt,heading)

From now on though I’m going to be using it like Peter suggested.

If you create a file the following file, in the given location, and fill it with your location you can use it using the -L command!

/home/USERNAME/.config/ardupilot/locations.txt
DUNE=42.73380516730135,-86.20706791790283,188,5

If I call SITL now my command is much less prone to user error.
./Tools/autotest/sim_vehicle.py -j 16 -v ArduCopter -D -L DUNE

2 Likes

be aware that location 0,0,0 is a bad idea as we filter it on some case as a bad location to prevent issue with 0 division.

Yes this do it, thank you so much! It changed the location. And as Khancyr warned about using 0,0,0, I used 1,1,1 instead. The waypoint list does print to something more manageable.

However, the iris drone does fly to a random location. I let it go for 15mins and ended up at x=-1055, y=1054, z=8.9 according to gazebo pose (it was still flying, I just told to to RTL). Anyone know why this happens and actually make it go to 1,1,1 as its first waypoint?

I never had this problem.

I set to -L to my location.
I used mavlink and mavproxy to set it.
For each mission which I set. the first waypoint is always 0,0. This drone usually do ignore any home position. There is not home position also doesn’t have much of an issue.

Maybe if you are using mavlink you can use the MAV_CMD_DO_SET_HOME (179 )
if you are using mission planner, its even easily to do it.