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:
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. pxh>
rcS_SIM_AIRFRAME, the default is
/as seen by the) is located inside the build directory:
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
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.
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.
The simulation can be interfaced to ROS the same way as onboard a real vehicle.