Main article: https://dev.px4.io/en/simulation/
jMAVSim is a lightweight environment intended only for testing multi-rotor aircraft systems; Gazebo is a versatile environment for all types of robots.
- Clone repository from PX4.
git clone https://github.com/PX4/Firmware.git cd Firmware
Main article: https://dev.px4.io/en/simulation/jmavsim.html
For simulation using the jMAVSim lightweight environment, use the following command:
make posix_sitl_default jmavsim
To use the LPE position calculation module instead of EKF2, use:
make posix_sitl_lpe jmavsim
Main article: https://dev.px4.io/en/simulation/gazebo.html
To get started, install Gazebo 7. On a Mac:
brew install gazebo7
On Linux (Debian):
sudo apt-get install gazebo7 libgazebo7-dev
Start simulation from the Firmware folder:
make posix_sitl_default gazebo
You can run a simulation in headless mode (without a window client). To do this, use the following command:
HEADLESS=1 make posix_sitl_default gazebo
QGroundControl will automatically connect to the running simulation on startup. The operation will be the same as, as in the case of a real flight controller.
To connect MAVROS to the simulation, use the UDP Protocol, a local IP address, and port 14557, for example:
roslaunch mavros px4.launch fcu_url:=udp://@127.0.0.1:14557