Skip to main content

Setup SITL on Mac

Setup SITL using vagrant

http://dev.ardupilot.com/wiki/simulation-2/sitl-simulator-software-in-the-loop/setting-up-sitl-using-vagrant/

Install VirtualBox and Vagrant

brew cask install virtualbox
brew install vagrant

Start Ubuntu VirtualBox VM

vagrant up

Login to the VM and start the simulator

vagrant ssh
sim_vehicle.sh -j 2
# OR
vagrant ssh -c "sim_vehicle.sh -j 2"

When starting simulator for the first time, reset and load the parameters

sim_vehicle.sh -w -j 2

The default is ArduCopter. To use other variants, use

vagrant ssh -c "sim_vehicle.sh -j 2 -v ArduPlane"

Use --aircraft option to specify the log directory. This will keep the logs in separate directory and keep each flight and it’s parameters separate.

sim_vehicle.sh -j 2 --aircraft sitlquad

The APM code will be automatically shared from your local machine and loaded to the VM. Any changes you make to the local files will be compiled by the sim_vehicle.sh script on the VM.

Once sim is running, connect to the simulator using MAVProxy

mavproxy.py --master=127.0.0.1:14550 --sitl=127.0.0.1:5501 --out=10.0.0.100:14555

# To forward mavlink messages to APM Planner, etc., use `--out` option or issue the following command at MAVProxy prompt and add a UDP connection to the port from APM Planner.
output add 10.0.0.100:14555

Once finished, suspend the VM

vagrant suspend
# To resume a supended VM
vagrant resume
# OR to shutdown the VM
vagrant halt
# OR to remove the VM from your machine
vagrant destroy

Load RCSetup module to do RC Calibration in MAVProxy

module load rcsetup

Now help should list rccal as one of the options.

rccal start
rccal done

To use a joystic or RC transmitter, install pygame

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
# make sure hg is installed
brew install mercurial
pip install hg+http://bitbucket.org/pygame/pygame

In MAVProxy, load joystick module

module load joystick

To make things easier, disable arm checking

arm safetyoff
arm uncheck all

wp load some_wp_file.txt

# Finally, arm the motors.
arm throttle
mode auto

log list
log download log# filename.bin