Skip to content

RflySim Model — Simulation Model–Related Module Library


The RflySim Model library provides a complete set of drone simulation modeling tools, including a six-degree-of-freedom (6-DOF) dynamics model, motor model, force model, ground model, and various communication interface modules, supporting full-scenario simulations from single to multi-drone systems.


Module List

Dynamics Models

Module Function Description
6DOF Six-degree-of-freedom rigid-body dynamics model, computing the drone’s position, velocity, attitude, angular velocity, and other motion states
Copter Force Model Multi-rotor aerodynamic force model, calculating thrust, torque, and drag generated by rotors
Copter Motor Model Multi-rotor motor model, simulating motor dynamic response and speed characteristics
Ground Model Ground interaction model, simulating contact forces and friction between landing gear and ground

Communication Interfaces

Module Function Description
UDP 20100 PX4SIL Recv PX4SIL UDP data reception interface, receives PX4 simulation data on port 20100
UDP 30100 TrueSim Recv TrueSim UDP data reception interface, receives high-precision simulation data on port 30100
UDP 40100 RflyPX4 Recv RflyPX4 UDP data reception interface, receives RflySim PX4 data on port 40100
PX4SIL IntFloat Send PX4SIL integer/float data transmission interface, sends integer and floating-point control data to PX4
PX4 Fault Params Send PX4 fault parameter transmission interface, injects fault parameters into the flight controller

Output Interfaces

Module Function Description
3D Output 3D visualization output interface, sends position and attitude data to RflySim3D
Sensor Output Sensor data output interface, outputs simulated data for various sensors

Usage Scenarios

Single-Drone Simulation

  • Dynamics Modeling: Use the 6DOF module to build the drone’s rigid-body dynamics model
  • Motor Modeling: Combine the Copter Motor Model and Copter Force Model to construct a complete multi-rotor power system
  • Ground Interaction: Use the Ground Model to simulate landing gear–ground contact forces

Hardware-in-the-Loop (HIL) Simulation

  • PX4SIL Interface: Use UDP 20100/30100/40100 reception modules to communicate with CopterSim
  • Control Data Transmission: Use PX4SIL IntFloat Send to transmit control commands to the flight controller
  • 3D Visualization: Use 3D Output to send simulation data to RflySim3D for display

Fault Injection Simulation

  • Fault Parameter Injection: Use PX4 Fault Params Send to inject various fault parameters into the flight controller
  • Sensor Faults: Simulate sensor fault data via the Sensor Output module

Usage Notes

Dynamics Modeling

  1. Parameter Accuracy: Parameters such as mass and moments of inertia in the 6DOF module must match the actual drone; otherwise, simulation results will be distorted
  2. Coordinate System Convention: The modules use the NED (North-East-Down) coordinate system and body-fixed frame; input/output data must conform to this convention
  3. Initial Conditions: Set reasonable initial position, velocity, and attitude to avoid simulation divergence caused by conflicting initial states
  4. Numerical Stability: The simulation time step should not be too large; a fixed step size of ≤1 ms is recommended to ensure numerical integration stability

Communication Interfaces

  1. Port Configuration: UDP reception/transmission module port numbers must match CopterSim configuration to prevent communication failures
  2. Network Settings: Ensure the firewall allows UDP communication on the corresponding ports, especially in multi-drone scenarios
  3. Data Synchronization: The sampling time of communication modules must match the Simulink model time step to avoid data misalignment
  4. Timeout Handling: Reception modules must implement appropriate timeout mechanisms to prevent simulation hangs due to communication interruptions

Fault Injection

  1. Parameter Range: Fault parameters must be within reasonable bounds; excessively large or small values may cause simulation crashes
  2. Fault Timing: Choose appropriate fault injection timing to avoid injecting severe faults during critical control phases
  3. Recovery Mechanisms: Design fault recovery logic to test system fault tolerance and self-recovery capabilities
  4. Safety Boundaries: Define simulation safety boundaries and automatically terminate the simulation when states exceed safe limits


Note: This document serves as the index for the RflySim Model library. For detailed usage instructions of each module, please refer to its dedicated documentation page.