# Setting up VM & start SITL using Vagrant (Mac) ###### tags: `Drone` ## Install Virtual machine [Click to install VirtualBox](https://www.virtualbox.org/wiki/Downloads) ## Install Vagrant [Click to install Vagrant](https://www.vagrantup.com/downloads.html) ## Manual Intrustions ### Setup * Download Ardupilot repository from GitHub ``` git clone https://github.com/ArduPilot/ardupilot.git ``` * Change directory to ardupilot file ``` cd ardupilot ``` * Start Vagrant ``` vagrant up ``` * Initialise git submodules ``` vagrant ssh ``` ``` cd /vagrant ``` ``` git submodule update --init --recursive ``` ``` exit ``` ### Start running SITL * MultiCopter ``` vagrant ssh -c "sim_vehicle.py -j 2 -v ArduCopter" ``` * Plane ``` vagrant ssh -c "sim_vehicle.py -j 2 -v ArduPlane" ``` * Vehicle ``` vagrant ssh -c "sim_vehicle.py -j 2 -v Rover" ``` ### Shut down simulator ==Ctrl + d== OR ``` vagrant suspend ``` ### Restarting the simulator ``` vagrant up ``` ``` vagrant ssh -c "sim_vehicle.py -j 2" ``` ## SITL Visualization ### Install [Click to install Xquartz](https://www.xquartz.org/) ### Check configuration Check ==Vagrantfile== to setup X11 forwarding. Mine is already set init. ``` Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.ssh.forward_x11 = true ``` ### Start vagrent Open the terminal use the Xquartz. ``` vagrant up ``` ``` HOST_IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') ``` ``` xhost + $HOST_IP ``` ``` vagrant ssh -c "sim_vehicle.py -j 2 --console --map --out=$HOST_IP:14550 -v ArduCopter " -- -X ```  ## Commands * check command list ``` help ``` * check parameters ``` param show ``` * Set parameters ``` param set PARAMNAME VALUE ``` * Restart ``` reboot ``` * Takeoff >takeoff 20 meters ``` takeoff 20 ````  * Check mode ``` mode ``` * Change mode >ex. Change to GUIDED mode ``` mode GUIDED ``` * Battery information ``` bat ``` ## Problems When the SITL start initial normally will show Flight battery 100 percent. In my case it start 0% at initial and it shows ==Flight battery warning==.  First check the parameters of battery.  Set the BATT_CAPACITY parameter to 100. Typing bat to check the battery information.  ==The problem solve.== ## Reference ### Website * [Setting up SITL using Vagrant](https://ardupilot.org/dev/docs/setting-up-sitl-using-vagrant.html) * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) * [Vagrant](https://www.vagrantup.com/downloads.html) ### Video <i class="fa fa-youtube" aria-hidden="true"></i> {%youtube NEZBF33f2UY%}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up