Link Search Menu Expand Document

PX4 Simulation in Hardware (SIH)

Table of contents

  1. Introduction
    1. SIH vs. HITL vs. SITL
  2. Starting SIH on VOXL Boards
    1. Startup Sequence
  3. Quick Start
    1. 1. Start SIH
    2. 2. Verify SIH is Running
    3. 3. Connect QGroundControl
    4. 4. Arm and Fly
    5. Optional: jMAVSim Visualization
  4. Default Parameters
    1. Airframe and Calibration
    2. Control Allocation
    3. Safety Bypasses
  5. Limitations
  6. Troubleshooting
    1. Resetting parameters
  7. References

Introduction

Simulation in Hardware (SIH) is a lightweight, self-contained flight simulation that runs entirely on the flight controller. Unlike HITL which requires an external host PC running Gazebo, SIH uses a built-in rigid body dynamics model to generate simulated sensor data directly on the board. No external simulator, cables, or network connection are needed.

SIH is useful for quick validation of flight logic, controller tuning, and parameter testing without needing to set up a full Gazebo simulation environment. The full PX4 flight stack (EKF2, controllers, commander) runs exactly as it does in real flight — only the sensor drivers are replaced by the physics model.

Please refer to the official PX4 documentation for more details: https://docs.px4.io/main/en/sim_sih/

SIH vs. HITL vs. SITL

FeatureSIHHITLSITL
Where simulation runsOn the flight controllerExternal host PC (Gazebo)Host PC (no flight controller)
Hardware requiredFlight controller onlyFlight controller + host PC + USB/FTDIHost PC only
PX4 executionReal firmware on real hardwareReal firmware on real hardwareCompiled natively on host
Sensor fidelitySimplified physics modelHigh-fidelity Gazebo sensorsHigh-fidelity Gazebo sensors
Visual outputNone (telemetry only)Gazebo 3D renderingGazebo 3D rendering
Setup complexityMinimalModerateModerate
Best forController tuning, quick validationFull system testing with VIO/cameraAlgorithm dev on host

Starting SIH on VOXL Boards

On VOXL platforms, SIH is started using the -S (uppercase) flag on the voxl-px4 script:

voxl-px4 -S

This is analogous to how HITL is started with voxl-px4 -s (lowercase). The -S flag launches PX4 with the SIH-specific startup script (voxl-px4-sih-start).

Startup Sequence

When voxl-px4 -S is invoked, the following happens:

  1. Default parameters are loaded from /etc/modalai/voxl-px4-sih-set-default-parameters.config (on first run) or from the saved parameter file at /data/px4/param/sih_parameters (on subsequent runs)

  2. Simulated sensor drivers start on the DSP via qshell:
    • simulator_sih — the core physics simulation
    • sensor_baro_sim — simulated barometer
    • sensor_gps_sim — simulated GPS
    • sensor_mag_sim — simulated magnetometer
    • pwm_out_sim — simulated PWM output
  3. Flight stack modules start on DSP:
    • sensors, ekf2
    • mc_pos_control, mc_att_control, mc_rate_control
    • mc_hover_thrust_estimator, mc_autotune_attitude_control
    • land_detector, manual_control, control_allocator, rc_update
    • commander, flight_mode_manager
  4. Apps processor modules start:
    • dataman, navigator
    • vehicle_air_data_bridge, sensor_baro_bridge, vehicle_local_position_bridge
    • sih_vio_bridge — bridges SIH ground truth for VIO consumers
  5. ROS 2 interface starts via uxrce_dds_client (UDP on port 8888)

  6. MAVLink links start:
    • Onboard fast link on UDP 14556/14557 for voxl-mavlink-server
    • Normal link on UDP 14558/14559 for GCS forwarding
    • Visualization stream on UDP 14560 with HIL_STATE_QUATERNION at 200 Hz (for jMAVSim or other external viewers)
  7. Logger starts based on the SDLOG_MODE parameter

NOTE: Unlike the upstream PX4 rcS-based boot (which uses SYS_HITL=2 and airframe files like 1100_rc_quad_x_sih.hil), VOXL boards use the voxl-px4 wrapper script to manage the startup sequence directly.


Quick Start

1. Start SIH

voxl-px4 -S

On first run, default SIH parameters will be written to /data/px4/param/sih_parameters. On subsequent runs, parameters are loaded from this file.

2. Verify SIH is Running

Confirm the simulator and simulated sensors are publishing data:

listener sensor_accel      # should show updating accel data
listener sensor_gyro       # should show updating gyro data
listener sensor_baro       # should show barometer readings

3. Connect QGroundControl

Connect QGroundControl via MAVLink (through voxl-mavlink-server). You should see the vehicle on the map at the simulated GPS location and the attitude indicator should be active.

4. Arm and Fly

Arm and take off via QGroundControl or the MAVLink shell:

commander arm
commander takeoff

The vehicle will take off and hover in the simulated environment. Use QGroundControl’s attitude indicator, map view, and telemetry widgets for feedback since there is no 3D visual rendering.

Optional: jMAVSim Visualization

The SIH startup script configures a MAVLink visualization stream on UDP port 14560 with HIL_STATE_QUATERNION at 200 Hz. You can connect jMAVSim or another external viewer to this stream for a 3D visualization of the simulated vehicle. The default target IP is 192.168.101.1 — adjust this in the startup script if needed.


Default Parameters

The SIH default parameter configuration (voxl-px4-sih-set-default-parameters.config) sets up the following on first run:

Airframe and Calibration

ParameterValueDescription
SYS_AUTOSTART4001Quadrotor X airframe
CAL_ACC0_ID1310988Simulated accelerometer (DRV_IMU_DEVTYPE_SIM)
CAL_GYRO0_ID1310988Simulated gyroscope (DRV_IMU_DEVTYPE_SIM)
CAL_MAG0_ID197388Simulated magnetometer
MAV_TYPE2Quadrotor

Control Allocation

ParameterValueDescription
CA_AIRFRAME0Multicopter
CA_ROTOR_COUNT4Quadrotor
HIL_ACT_FUNC1–4101–104Motor function mapping for pwm_out_sim

Safety Bypasses

ParameterValuePurpose
CBRK_SUPPLY_CHK894281Bypass battery check (no real battery in SIH mode)

Parameters are saved to /data/px4/param/sih_parameters and persist across reboots. To reset to defaults, delete this file and restart:

rm /data/px4/param/sih_parameters
voxl-px4 -S

Limitations

  • No visual output — SIH does not provide 3D rendering on its own. Use QGroundControl for telemetry feedback, or connect jMAVSim to the visualization stream on UDP 14560. Flights can also be logged and analyzed with FlightReview.
  • Simplified physics — The rigid body model does not capture complex effects like ground effect, turbulence, rotor wake interaction, or detailed aerodynamic nonlinearities.
  • No camera or VIO simulation — SIH does not generate simulated images. For VIO testing, use HITL with Gazebo.
  • No environment interaction — There are no obstacles, wind, or terrain beyond a flat ground plane.
  • Single vehicle only — One simulated vehicle per flight controller instance.

Troubleshooting

Resetting parameters

If parameters get into a bad state, delete the saved parameter file and restart:

rm /data/px4/param/sih_parameters
voxl-px4 -S

References