You can clone the repo at this link: https://github.com/ArduPilot/ardupilot
My fork of the repository is here:
You need to build, compile, and set up your environment, the instructions can be found here: http://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html
There are also tutorials for setting up in Windows natively and in a VM. I choose to run it on Linux natively.
I added the coordinates to UH Manoa in the locations.txt file to run these simulations.
Ultimately, the command I run to open the simulator is: ./sim_vehicle.py -L UHManoa --console --map -v ArduCopter
The simulator allows us to control almost everything. An initial test you can do is to disable the GPS entirely using the command: param set SIM_GPS_DISABLE 1
- An interesting observation is that in order to takeoff, it seems we need to have a 3DFix, the following error comes up if not APM: PreArm: Need 3D Fix
- Disabling the GPS mid flight gives the console output:
APM: EKF variance
Mode LAND
APM: EKF2 IMU0 has stopped aiding
APM: EKF2 IMU1 has stopped aiding
height 50
APM: SmartRTL deactivated: bad position
height 40
height 30
height 20
height 10
APM: Disarming motors
Flight battery 80 percent
DISARMED
It seems like we end up landing.
The source code for the update_gps function is here: