Development Guide

Software in the Loop (SITL) Simulation

Software in the Loop Simulation runs the complete system on the host machine and simulates the autopilot. It connects via local network to the simulator. The setup looks like this:

graph LR; Simulator-->MAVLink; MAVLink-->SITL;

Running SITL

After ensuring that the simulation prerequisites are installed on the system, just launch: The convenience make target will compile the POSIX host build and run the simulation.

make posix_sitl_default jmavsim

This will bring up the PX4 shell:

[init] shell id: 140735313310464
[init] task name: mainapp

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

Ready to fly.


Important Files

  • The startup script is in the posix-configs/SITL/init folder and named rcS_SIM_AIRFRAME, the default is rcS_jmavsim_iris.
  • The root file system (the equivalent of / as seen by the) is located inside the build directory: build_posix_sitl_default/src/firmware/posix/rootfs/

Taking it to the Sky

And a window with the 3D view of the jMAVSim simulator:

The system will print the home position once it finished intializing (telem> home: 55.7533950, 37.6254270, -0.00). You can bring it into the air by typing:

pxh> commander takeoff

Simulating a Wifi Drone

There is a special target to simulate a drone connected via Wifi on the local network:

make broadcast jmavsim

The simulator broadcasts his address on the local network as a real drone would do.

Extending and Customizing

To extend or customize the simulation interface, edit the files in the Tools/jMAVSim folder. The code can be accessed through thejMAVSim repository on Github.

Interfacing to ROS

The simulation can be interfaced to ROS the same way as onboard a real vehicle.