Skip to content

PteroSim Simulation

WARNING

This simulator is community supported and maintained. It may or may not work with current versions of PX4 and may be removed in future releases. See Toolchain Installation for information about the environments and tools supported by the core development team.

PteroSim is proprietary simulation software that can be used with PX4 for Software-In-The-Loop (SITL) simulation. PX4 runs as the flight controller, while PteroSim provides the vehicle dynamics, visual scene, and simulated sensor inputs through a built-in HIL bridge. PteroSim uses the Simulator MAVLink API over TCP port 4560 with lockstep synchronization.

PteroSim runs on Windows 10/11 and Ubuntu 22.04+ (64-bit). Install PteroSim from GitHub Releases and set up PX4 SITL using the PX4 development environment. For full installation, UI walkthrough, and QGroundControl setup, see the PteroSim PX4 SITL guide.

Videos

PX4 tutorial:

PteroSim demo:

Supported Vehicles

The free tier includes the F450 multicopter, which is covered by the setup steps on this page:

VehicleTypePX4 target
F450Multicoptermake px4_sitl_default none_iris

Paid licenses also include fixed-wing, VTOL, and helicopter templates with PX4 SITL support. See pterolabs.ai for licensing details.

Network Setup

PX4 connects to PteroSim on TCP port 4560.

When PteroSim and PX4 SITL run on the same Ubuntu machine, the default host localhost is sufficient.

When PteroSim runs on Windows and PX4 runs in WSL2, set PX4_SIM_HOSTNAME in the WSL2 shell to the Windows host IP before starting PX4:

sh
export PX4_SIM_HOSTNAME=$(ip route | awk '/default/ {print $3; exit}')

Make sure inbound TCP port 4560 is allowed by the firewall on the PteroSim host.

Running SITL

  1. Start PteroSim, spawn the F450, select PX4 as the control source, and press Start.

  2. Start PX4 SITL with lockstep enabled. For example:

    sh
    cd PX4-Autopilot
    PX4_LOCKSTEP=1 PX4_SIM_SPEED_FACTOR=1 make px4_sitl_default none_iris

    On Windows with PX4 in WSL2, include PX4_SIM_HOSTNAME as shown in Network Setup.

  3. Connect QGroundControl to PX4 as usual.

PX4 prints Simulator connected on TCP port 4560 when the bridge is connected.

Troubleshooting

If PX4 waits for the simulator, verify that PteroSim is running, the simulation has been started, the control source is set to PX4, PX4_SIM_HOSTNAME points to the PteroSim host when using WSL2, and TCP port 4560 is not blocked.

If PX4 connects but the aircraft does not respond to commands, verify that the control source is set to PX4 in PteroSim.