# PX4 SITL Simulation Utility A simple Rust program that fulfills the contracts of a PX4 SITL Simulator the same way as Gazebo or jMavSim. This library makes it simple to send and receive simulation related information to PX4 via MAVLink. It does not cover other use-cases like offboard control, ground station or remote controller, purely what is needed for PX4 to play nicely with a custom simulator. ## PX4 SITL Setup 1. Clone PX4 1. Install dependencies 1. Build with `make px4_sitl` 1. Launch with `PX4_SYS_AUTOSTART= ./px4 -i ` See available airframes in `px4/ROMFS/px4fmu_common/init.d-posix/airframes` The **airframe** value is a number, such as `10016`. The **instance** or **system ID** is a unique number for each running instance of PX4. It can just be `0` if there is only one running instance. ### Start PX4 as a Child Process If the airframe value and the path to the PX4 root directory are provided to the `DroneSimulator` class constructor, it will start the PX4 SITL simulation in the background. It can also be started programatically using the `start_px4` function from the `util` module. This way it is not necessary to start PX4 from a separate console window. The downside is that the `pxh>` shell will not be available to give commands to PX4 from the console window. The child process shall be killed when exiting.