Wednesday, June 27, 2018

Starting Ardupilot

The Command


python ~/ardupilot/Tools/autotest/sim_vehicle.py -v ArduCopter -f gazebo-iris --console -L $LOCATION -m --mav10 -I0

Note on GPS initialization


This should start SITL and link it to an available iris quadcopter in Gazebo.  You just have to replace '~' with the filepath to where you downloaded the ardupilot folder from GitHub, and $LOCATION with a certain codename.

GPS is critical to navigating our quadcopter in the simulation.  Therefore, we need to choose a single  GPS source to work from, and sync SITL and Gazebo's coordinate systems so that they both believe that the quadcopter is at the same location. In our simulation, we decided to use the GPS tied to SITL rather than another external one that could be installed into the Gazebo simulation (like 'hector').

We then need to override Gazebo's default behavior (to make the origin represent 0 latitude and 0 longitude).  To do this, we will add a line to ardupilot/Tools/autotest/locations.txt.  This file contains a list of names with corresponding lat, lon, alt specifications.  Create a new name at the bottom of the file, and give it the desired GPS location that you want the origin of your Gazebo simulation to represent.  Then, using the command above, replace $LOCATION with the name you chose for that location.  This will make sure SITL and Gazebo are on the same page with their coordinate systems.


Other Notes


*The "-I0" tells SITL which quadcopter we are starting.  For example, if we have two quadcopters in our simulation, then you would need two of these statements, one ending in -I0, and the other ending in -I1.  The IDs of these quadcopters are 0 and 1 respectively.  There is a spacing of "10" in between UDP ports that these quadcopters will use with each new quadcopter.  For example, if I0 uses a UDP port of 14550, then I1 would use a UDP port of 14560 and I2 would use 14570 see Starting Mavproxy for more details on this topic.

*If you are starting SITL fresh or after a "wipe" (the -w flag), it may have to reload all of its parameters. In this case it can take a little time (30 seconds or so) to initialize.

No comments:

Post a Comment