Skip to main content

Simulation

PX4 Simulation

Gazebo

Mac

brew cask install xquartz
brew install homebrew/science/opencv
brew tap osrf/simulation
brew install gazebo7

cd ~/src/Firmware

# Run standard quad
make posix_sitl_default gazebo

# Run tailsitter
make posix_sitl_default gazebo_tailsitter

Once it starts

pxh> commander takeoff

Using Joystick

  • Connect a joystick to your Mac first
  • Taranis via USB works too
  • Start QGroundControl and enable “Virtual Joystick” from the QGC “General” settings menu
  • Start gazebo sim from the command line as above
  • Go back to QGroundControl. It should connect to the vehicle automatically via UDP
  • Once connected to the vehicle, “Joystick” menu button should appear in the vehicle setup just below “Firmware” button
  • Calibrate sticks and configure switches

Troubleshooting

If you see an error with XCode version 7.xx. Try

xcodeselect --install
xcodeselect -r

If you see an error with sdformat, etc.

brew unlink sdformat
brew unlink sdformat3
brew unlink sdforamt4

brew install sdformat3

brew unlink gazebo5
brew unlink gazebo6
brew unlink gazebo7

brew install gazebo7

Reference