Skip to content

Setting up your simulator

Miles Cobb edited this page May 24, 2019 · 29 revisions

Setting up a Vagrant simulator

Prerequisites

  1. Git
    Leave line endings untouched git config --global core.autocrlf false
  2. Install VirtualBox for your OS
  3. Install Vagrant for your OS
  4. Clone the autopilot repository git clone https://github.com/ArduPilot/ardupilot.git

Configure Vagrant

  1. Within the ardupilot directory add the following lines to your vagrantfile before the final "end"

    config.vm.network "forwarded_port", guest: 5760, host: 5760, protocol: "tcp"
    config.vm.network "forwarded_port", guest: 5761, host: 5761, protocol: "tcp"
    config.vm.network "forwarded_port", guest: 5762, host: 5762, protocol: "tcp"
    config.vm.network "forwarded_port", guest: 5763, host: 5763, protocol: "tcp"

  2. Launch vagrant vagrant up
  3. Initialize submodules
    vagrant ssh
    cd /vagrant
    git submodule update --init --recursive
    exit

Launching VTOL simulator

  1. vagrant ssh
  2. cd into ArduPlane
  3. sim_vehicle.py -l 35.328423,-120.752505,580,0 -j4 -f quadplane --console --map

Setting up a Dronekit-SITL simulator

Prerequisites

  1. Install dronekit-sitl pip3 install dronekit-sitl
  2. Clone the ardupilot repository

Compiling the binary

  1. Within you copy of ardupilot
  2. Set vehicle to SITL ./waf configure --board sitl
  3. Compile desired vehicle ./waf copter

Start you sim

./build/sitl/bin/arducopter -M QuadCopter connect to your sim over tcp port 5760
disable preflight checks using QGroundControl Vehicle Setup => safety (You may need to set you airframe as well)