SIH Simulation
PX4 v1.9 (MC)PX4 v1.13 (MC, VTOL, FW) PX4 v1.16 (Rover)SIH (Simulation-In-Hardware) is a lightweight, headless simulator with zero external dependencies that runs physics directly inside PX4 via uORB messages. No GUI, no external processes, no rendering overhead — just PX4 running a C++ physics model. This makes it the fastest way to iterate on flight code.
TIP
SIH is also available as a prebuilt Docker container or .deb package, which is useful if you don't need to modify PX4 itself. See PX4 Simulation QuickStart for a one-line instruction on how this is used.
Overview
SIH runs as a PX4 module that replaces real sensor and actuator hardware with a simulated physics model. It provides simulated IMU, GPS, barometer, magnetometer, airspeed, distance sensor, and optical flow data via uORB, and reads actuator outputs to update the vehicle state at each timestep. The distance sensor and the downward facing optical flow sensor let you exercise flow aided navigation without a rendered camera image.
The simulation runs in lockstep with PX4, ensuring deterministic and reproducible results. It also integrates seamlessly with ROS 2 with no additional configuration (see ROS 2 Integration below).
Two modes are supported:
SITL: Runs on your computer with no hardware needed, and headless (without a UI) by default. This is the fastest and easiest way to start a simulation on PX4.
SIH on flight controller hardware: Runs the entire simulation on the autopilot (
SYS_HITL=2).
Supported Vehicle Types
The following vehicle types are supported:
| Vehicle | Make Target | Status |
|---|---|---|
| Quadrotor X PX4 v1.9 | make px4_sitl_sih sihsim_quadx | Stable |
| Hexarotor X PX4 v1.16 | make px4_sitl_sih sihsim_hex | Experimental |
| Fixed-wing (airplane) PX4 v1.13 | make px4_sitl_sih sihsim_airplane | Experimental |
| Tailsitter VTOL PX4 v1.13 | make px4_sitl_sih sihsim_xvert | Experimental |
| Standard VTOL (QuadPlane) PX4 v1.16 | make px4_sitl_sih sihsim_standard_vtol | Experimental |
| Ackermann Rover PX4 v1.16 | make px4_sitl_sih sihsim_rover_ackermann | Experimental |
| Quadrotor X with optical flow PX4 v2.0 | make px4_sitl_sih sihsim_quadx_flow | Experimental |
| Standard VTOL with optical flow PX4 v2.0 | make px4_sitl_sih sihsim_standard_vtol_flow | Experimental |
WARNING
Only the quadrotor vehicle type is stable and recommended for development. All other vehicle types (hexarotor, fixed-wing, VTOL, rover) are experimental and may have aerodynamic model or controller interaction issues that produce unrealistic flight behaviour.
How SIH Works
SIH differs from external simulators:
- No MAVLink simulator API: SIH communicates entirely via uORB (PX4's internal message bus).
- No external process: The physics model runs in the same PX4 process.
- Lockstep by default: Simulation time is synchronized with PX4 scheduling.
SIH as SITL
SIH as SITL is the easiest and fastest way to set up a simulator with PX4. It requires no hardware, and very few extra dependencies.
Quick Start
To build PX4 and run SIH for a quadrotor:
make px4_sitl_sih sihsim_quadxQGroundControl auto-connects on UDP port 14550 — just open it and you'll see the vehicle. Note that the simulation is "headless" by default (has no GUI), but you can use an external viewer.
See Supported vehicle types for other vehicles.
TIP
Use the px4_sitl_sih build target! The px4_sitl target will work, but will also build Gazebo libraries.
Visualization (Optional)
SIH is intentionally headless by default. If you need a visual aid to see what the vehicle is doing you can use QGroundControl to track path over ground, and/or Hawkeye as a 3D viewer.
QGroundControl
QGC auto-connects on UDP port 14550. Open QGC while SIH is running and the vehicle appears on the map view with attitude, position, and telemetry.
Hawkeye (3D Visualizer)
Hawkeye renders a real-time 3D view of the vehicle using MAVLink position data. No physics are simulated in Hawkeye — it is a visualizer only.
In a separate terminal, run:
hawkeyeHawkeye connects on UDP port 19410 by default (the same port SIH sends HIL_STATE_QUATERNION on). It then auto-detects the vehicle type from the MAVLink HEARTBEAT and loads the matching 3D model.
The Hawkeye overview page explains how to install the software. See the Hawkeye docs for other features, such as ULog replay, and multi-vehicle visualization.
Environment Configuration
Change Simulation Speed
SIH supports faster-than-realtime simulation via the PX4_SIM_SPEED_FACTOR environment variable:
# Run at 10x speed
PX4_SIM_SPEED_FACTOR=10 make px4_sitl_sih sihsim_quadxWind Simulation
SIH supports setting a wind velocity with the PX4 parameters SIH_WIND_N and SIH_WIND_E [m/s]. The parameters can also be changed during flight to simulate changing wind.
Optical Flow
SIH can simulate a downward facing optical flow sensor, so that flow aided navigation can be exercised without a rendered camera image. The sensor reports the integrated flow only: the flow module completes the sample with the vehicle gyro and a downward facing distance sensor, which therefore has to be enabled as well (SIH_DISTSNSR_EN).
The flow sensor is configured with SIH_OF_EN, SIH_OF_RATE, SIH_OF_NOISE, and SIH_OF_H_MAX. Quality drops to zero above SIH_OF_H_MAX or when the flow rate exceeds what the sensor can correlate.
Two ready-made airframes use it:
# Multicopter navigating on optical flow only (GNSS fusion disabled)
make px4_sitl_sih sihsim_quadx_flow
# Standard VTOL navigating on optical flow only (GNSS fusion disabled)
make px4_sitl_sih sihsim_standard_vtol_flowSet Custom Takeoff Location
The default takeoff location can be set using environment variables:
export PX4_HOME_LAT=28.452386
export PX4_HOME_LON=-13.867138
export PX4_HOME_ALT=28.5
make px4_sitl_sih sihsim_quadxSensor Calibration
simulator_sih orient poses the vehicle on the ground the way accelerometer and magnetometer calibration ask for, so either calibration can be run from QGroundControl or a script. Run it from the PX4 shell, or the MAVLink shell, after starting the calibration:
| Command | Pose |
|---|---|
simulator_sih orient all | Each side in turn: 10 s still, then 10 s rotating. Completes either calibration. |
simulator_sih orient <side> | Still, with <side> facing down: down, up, front, back, left, right. |
simulator_sih orient <side> rotate | Rotating about the vertical with <side> down, with a tilt swing. |
simulator_sih orient off | Level, then back to the flight dynamics. |
orient is only built for SITL: sensor calibration is rejected when SIH runs on flight controller hardware.
Terrain Elevation (DEM)
main (PX4 v2.0)By default SIH simulates flat ground at SIH_LOC_H0. SIH can instead load the terrain elevation from a digital elevation model (DEM) GeoTIFF file, set with the PX4_SIH_TERRAIN environment variable:
PX4_SIH_TERRAIN=/path/to/dem.tif make px4_sitl_sih sihsim_quadxThe terrain is then used for:
- Ground contact: the vehicle starts, lands and rests on the terrain. It is placed at the terrain elevation below
SIH_LOC_LAT0/SIH_LOC_LON0(PX4_HOME_LAT/PX4_HOME_LON).SIH_LOC_H0(PX4_HOME_ALT) sets the start altitude only when that point is outside the DEM. - The downward facing distance sensor, which measures the range to the terrain along the vehicle body z axis (up to
SIH_DISTSNSR_MAX). - The
terrain_altfield of thevehicle_global_position_groundtruthtopic. - The
dist_bottomfield of thevehicle_local_position_groundtruthtopic.
Outside the area covered by the DEM, or over cells without data, the ground is flat at SIH_LOC_H0 and a warning is printed. Terrain is supported for multicopters, VTOLs and fixed-wing vehicles; with any other vehicle type (such as Ackermann rovers), setting PX4_SIH_TERRAIN stops SIH from starting with an error. simulator_sih status shows the loaded DEM and whether the vehicle is inside it.
The DEM must be a single-band GeoTIFF whose coordinate reference system has an EPSG code, either geographic (such as WGS84, EPSG:4326) or projected (such as UTM or the Swiss EPSG:2056). 8, 16 and 32-bit integer and 32 and 64-bit floating point samples are supported with any TIFF compression, and the GDAL nodata value is respected. Elevations are used as they are, as altitude above mean sea level. Free sources include Copernicus GLO-30 (near-global, 30 m, including buildings and vegetation) and national elevation models such as swissALTI3D (2 m). Crop large files to the area you fly in, for example with GDAL:
gdal_translate -projwin 8.48 47.44 8.61 47.35 Copernicus_DSM_COG_10_N47_00_E008_00_DEM.tif zurich.tifFiles in other formats, with other sample types or without an EPSG code can be converted with gdalwarp -t_srs EPSG:4326 -ot Float32 in.tif out.tif.
INFO
Terrain support is optional and only available in SITL, not when running SIH on flight controller hardware. The prebuilt px4 package and px4io/px4-sitl container are built without it, and SIH reports an error and does not start if PX4_SIH_TERRAIN is set. When building from source, the setup scripts install the required libraries with the simulation tools. The CMake output shows SIH terrain (DEM) support enabled when it is available.
ROS 2 Integration
SIH works with ROS 2 via the uXRCE-DDS client, which auto-starts in SITL mode. This is the same mechanism used by Gazebo — both simulators expose the same set of uORB topics to ROS 2. The DDS agent connects on UDP port 8888 by default (configurable via UXRCE_DDS_PRT parameter or PX4_UXRCE_DDS_PORT environment variable).
To use SIH with ROS 2:
Start SIH:
shmake px4_sitl_sih sihsim_quadxIn a separate terminal, start the Micro XRCE-DDS Agent:
shMicroXRCEAgent udp4 -p 8888
See uXRCE-DDS (PX4-ROS 2/DDS Bridge) for full setup instructions, including agent installation and ROS 2 workspace configuration.
Port Reference
PX4 SITL opens the following UDP ports (all instance-aware, offset by instance number N).
| PX4 sends to (remote) | PX4 listens on (local) | Use for | Instance offset |
|---|---|---|---|
| 14550 | 18570 (+N) | QGroundControl, GCS tools | Yes |
| 14540 (+N) | 14580 (+N) | MAVSDK, MAVROS, offboard APIs | Yes (capped at 14549 for 10+ instances) |
| 14030 (+N) | 14280 (+N) | Onboard camera/payload | Yes |
| 13280 (+N) | 13030 (+N) | Gimbal control | Yes |
| 19410 (+N) | 19450 (+N) | Hawkeye visualizer (SIH only) | Yes |
| 8888 | - | uXRCE-DDS / ROS 2 | No (use DDS namespace for multi-instance) |
QGC auto-connects on port 14550 by default. MAVSDK connects on 14540. No manual port configuration needed for single-instance use.
Multi-Vehicle Simulation
SIH supports multi-vehicle simulation using PX4's instance system. Each instance gets unique MAVLink ports, a unique system ID, and a separate DDS namespace.
To launch multiple SIH vehicles, first build:
make px4_sitl_sih sihsim_quadxThen use the multi-instance launch script:
./Tools/simulation/sitl_multiple_run.sh 3 sihsim_quadx px4_sitl_sihOr launch instances manually:
# Terminal 1 (instance 0)
make px4_sitl_sih sihsim_quadx
# Terminal 2 (instance 1)
./build/px4_sitl_sih/bin/px4 -i 1 -d ./build/px4_sitl_sih/etc
# Terminal 3 (instance 2)
./build/px4_sitl_sih/bin/px4 -i 2 -d ./build/px4_sitl_sih/etcEach instance allocates ports automatically (all offset by instance number):
| Instance | MAVLink (18570+N) | MAVLink (14540+N) | DDS (8888) Namespace |
|---|---|---|---|
| 0 | 18570 | 14540 | (default) |
| 1 | 18571 | 14541 | px4_1 |
| 2 | 18572 | 14542 | px4_2 |
See Port Reference for the complete list of ports.
Running the SIH on Flight Controller Hardware
INFO
The SIH on flight controller is community supported.
SIH can also run on flight controller hardware, replacing real sensors with simulated data while running on the actual autopilot. See SIH on Flight Controller Hardware for setup instructions.
Adding New Airframes
Adding a new airframe for use in SIH simulation is much the same as for other use cases. You still need to configure your vehicle type and geometry (CA_ parameters) and start any other defaults for that specific vehicle.
WARNING
Not every vehicle can be simulated with SIH — there are currently six supported vehicle types (quadcopter, fixed-wing, tailsitter, standard VTOL, hexacopter, rover), each of which has a relatively rigid implementation in sih.cpp.
The specific differences for SIH simulation airframes are listed in the sections below.
All Variants
Set all the Simulation In Hardware parameters (prefixed with
SIH_) in order to configure the physical model of the vehicle.TIP
Make sure that the
SIH_*parameters and theCA_*parameters describe the same vehicle. Note that some of these parameters are redundant!param set-default SYS_HITL 2to enable SIH on the next boot.INFO
This also disables input from real sensors. For SIH on the FC (only), it also enables the simulated GPS, barometer, magnetometer, and airspeed sensor.
For SIH on SITL you will need to explicitly enable these sensors as shown below.
param set-default SENS_GNSS0_DELAY 0to improve state estimator performance (the assumption of instant GPS measurements would normally be unrealistic, but is accurate for SIH).
SIH on Flight Controller
See Adding New Airframes (FC) in SIH on Flight Controller Hardware.
SIH as SITL
- Airframe file goes in
ROMFS/px4fmu_common/init.d-posix/airframesand follows the naming template${ID}_sihsim_${model_name}, whereIDis theSYS_AUTOSTART_IDused to select the airframe, andmodel_nameis the airframe model name. - Add the model name in
src/modules/simulation/simulator_sih/CMakeLists.txtto generate a corresponding make target. - Actuators are configured as usual with
PWM_MAIN_FUNC*andPWM_MAIN_REV. - Additionally, set:
PX4_SIMULATOR=${PX4_SIMULATOR:=sihsim}PX4_SIM_MODEL=${PX4_SIM_MODEL:=svtol}(replacingsvtolwith the airframe model name)
- Enable the simulated sensors using SENS_EN_GPSSIM, SENS_EN_BAROSIM, SENS_EN_MAGSIM, and SENS_EN_ARSPDSIM (this is only needed for SIH-as-SITL):
param set-default SENS_EN_GPSSIM 1param set-default SENS_EN_BAROSIM 1param set-default SENS_EN_MAGSIM 1param set-default SENS_EN_ARSPDSIM 1(if it is a fixed-wing or VTOL airframe with airspeed sensor)
For specific examples see the _sihsim_ airframes in ROMFS/px4fmu_common/init.d-posix/airframes (SIH as SITL) and ROMFS/px4fmu_common/init.d/airframes (SIH on FC).
Dynamic Models
The dynamic models for the various vehicles are:
- Quadrotor: pdf
- Fixed-wing: based on Khan (2016), see references below
- Tailsitter: based on Chiappinelli (2018), see references below
- Rover: bicycle model with linear tire model
Propeller model with advance ratio
Since PX4 v1.17, the propeller model for fixed-wing, tailsitter, and VTOL pusher vehicles is based on the equations from UIUC Propeller Database.
This model includes the thrust coefficient CT(J) and power coefficient CP(J) as functions of the advance ratio J. As a result, the maximum thrust force is realistically reduced as the aircraft speed is increased. The SIH implements the thrust and power coefficients as second-order polynomial fits.
CT = SIH_F_CT0 + SIH_F_CT1⋅J + SIH_F_CT2⋅J²
CP = SIH_F_CP0 + SIH_F_CP1⋅J + SIH_F_CP2⋅J²
If SIH_F_CT0 and SIH_F_CP0 are non-zero and positive, the SIH uses the model with advance ratio. If not, the SIH uses a simple model with maximum thrust force given by SIH_F_T_MAX and maximum torque given by SIH_F_Q_MAX.
References:
- PX4 Development Team, "SIH Dynamic Model," PX4-Autopilot, 2019. PDF
- W. Khan, "Dynamics modeling of agile fixed-wing unmanned aerial vehicles," Ph.D. thesis, Dept. of Mechanical Engineering, McGill University, Montreal, 2016.
- R. Chiappinelli, "Modeling and control of a flying wing tailsitter unmanned aerial vehicle," M.Sc. thesis, Dept. of Mechanical Engineering, McGill University, Montreal, 2018.
- S. Anumakonda, "Everything you need to know about Self-Driving Cars," 2021. Link
- J.B. Brandt, R.W. Deters, G.K. Ananda, O.D. Dantsker, and M.S. Selig, UIUC Propeller Database, Vols 1-4, University of Illinois at Urbana-Champaign, Department of Aerospace Engineering, retrieved from https://m-selig.ae.illinois.edu/props/propDB.html.
Video
SIH demo with a fixed-wing vehicle @youtube How to parametrize the thrust and power coefficients CT & CP @youtube
Credits
SIH was originally developed by Coriolis g Corporation. The airplane model and tailsitter models were added by Altitude R&D inc.
- Coriolis g developed a new type of Vertical Takeoff and Landing (VTOL) vehicles based on passive coupling systems;
- Altitude R&D is specialized in dynamics, control, and real-time simulation (located in Zurich).
The simulator is released for free under BSD license.