Simulink Interface Reference¶
RflySim provides two sets of Simulink toolboxes, targeting PX4 low-level algorithm development and RflySim extended function development, respectively.
SimulinkPSP (Pixhawk Target Blocks)¶
Provided officially by MATLAB/Simulink, for low-level control algorithm development and automatic code generation for Pixhawk/PX4 autopilots.
ADC and Serial (ADC and Serial Communication Library)¶
| Block | Function |
|---|---|
| ADC Read | Read data from 3 external ADC channels |
| Serial Read/Write | Read and write operations for a specified serial port |
Miscellaneous Utility Blocks (Utility Blocks Library)¶
| Block | Function |
|---|---|
| Log Storage | Flight log storage |
| Print Function | Print debug information to the terminal |
| QGC Param | Parameter exchange between QGroundControl and Simulink |
Sensors and Actuators (Sensor and Actuator Interface Library)¶
| Block | Function |
|---|---|
| Battery Monitor | Battery voltage/current monitoring |
| RC Input | Remote control channel data |
| Motor Output | Motor PWM control signal output |
| LED Control | LED indicator control |
| IMU/Mag/Baro/GPS | Sensor data reading |
| Buzzer | Buzzer alarm |
| Vehicle Attitude | Vehicle attitude data |
| Vehicle GPS | GPS positioning data |
uORB Read and Write (uORB Message Read/Write Library)¶
| Block | Function |
|---|---|
| uORB Read | Subscribe to PX4 uORB messages |
| uORB Read Trigger | Triggered uORB message reading |
| uORB Write | Publish PX4 uORB messages |
| uORB Write Advanced | Advanced uORB message writing |
| uORB Write Advanced (Dai) | Dai-extended uORB message writing |
RflySimPSP (RflySim Extended Toolbox)¶
Developed by the RflySim team, it further improves the high-level function library based on the official interface.
RflySim APIs (Advanced Low-Level Control Library)¶
Covers read and write interfaces for various key data including attitude, velocity, position, acceleration, force/torque, remote control, actuators, etc.
| Block | Function |
|---|---|
| HIL16 Ctrls Norm | HIL 16-dimensional normalized control |
| HIL16 Ctrls PWM | HIL 16-dimensional PWM control |
| Input RC Cali | Remote control input calibration |
| Input RC Norm | Normalized remote control input |
| Msg2Simulink API | Message-to-Simulink API |
| Offboard Adv Ctrl | Offboard advanced control |
| Offboard Att Ctrl | Offboard attitude control |
| Offboard PVA Ctrl | Offboard position/velocity/acceleration control |
| Off Ctrl Msg All | Offboard control message summary |
| Pos Vel Att All | Full position/velocity/attitude data |
| RC Over Ctrl | Remote control override control |
| Re PX4 Block | PX4 block reconfiguration |
| Torque Thrust Ctrls | Torque/thrust control |
RflySim Model (Motion Model Library)¶
| Module | Function |
|---|---|
| 6DOF | 6-DOF dynamics model |
| 3D Output | 3D visualization output |
| Sensor Output | Sensor output |
| Ground Model | Ground model |
| Copter Force Model | Multi-rotor force model |
| Copter Motor Model | Multi-rotor motor model |
| UDP 20100 PX4SIL Recv | PX4SIL UDP data reception |
| UDP 30100 TrueSim Recv | TrueSim UDP data reception |
| UDP 40100 RflyPX4 Recv | RflyPX4 UDP data reception |
| PX4SIL IntFloat Send | PX4SIL integer/float data transmission |
| PX4 Fault Params Send | PX4 fault parameter transmission |
RflySim PHM (Fault Modeling and Prognostics Health Management Library)¶
| Fault Type | Description |
|---|---|
| Battery Fault | Voltage drop, abnormal charging/discharging |
| Environmental Wind | Gust, turbulence |
| Load Change | Mass mutation during operation |
| GNSS Fault | Positioning drift, loss of lock |
| Motor Fault | Abnormal rotation speed, jamming |
| Propeller Fault | Pull force reduction |
| Other Sensors | Accelerometer/Gyroscope/Magnetometer faults |
| Module | Function |
|---|---|
| Motor Fault | Motor fault injection |
| Prop Fault | Propeller fault injection |
| Battery Fault | Battery fault injection |
| Load Fault | Load fault injection |
| Wind Fault | Wind disturbance fault injection |
| GPS Fault | GPS fault injection |
| Sensor Fault | Sensor fault injection |
| Fault Params Extract | Fault parameter extraction |
RflySim Swarm (Swarm Control Library)¶
| Module | Function |
|---|---|
| Multi-UAV State Acquisition | Get the pose and status of each vehicle in the swarm |
| Multi-UAV Control Interface | Send control commands to multiple vehicles |
| Motion Capture Data Subscription | Subscribe to data from external motion capture systems |
| MAVLink Encoding & Decoding | Encapsulation and unpacking of MAVLink messages |
| Module | Function |
|---|---|
| Rfly UDP Fast | High-speed UDP swarm communication |
| Rfly UDP Raw | Raw UDP data communication |
| Rfly Serial Raw | Raw serial data communication |
| Rfly UDP MAVLink | MAVLink UDP communication |
| Rfly VRPN Recv | VRPN motion capture data reception |
| VRPN Data Decoder | VRPN data decoding |
| Real Data Decoder | Real-vehicle data decoding |
| Full Data Decoder | Full-data decoding |
| Simple Data Decoder | Simplified data decoding |
| Offboard Full | Offboard full-data control |
| Vel NED Full | NED velocity full-data control |
| Vel Body Full | Body-frame velocity full-data control |
| Pos NED Full | NED position full-data control |
| Real Ctrl 28D | Real-vehicle 28-dimensional control |
| Simple Ctrl 4D | Simplified 4-dimensional control |
| Auto Firmware API | Auto firmware API |
| High Level Mode | High-level mode control |
Usage Recommendations¶
Development Phase Selection¶
| Development Stage | Recommended Toolbox | Description |
|---|---|---|
| Low-level Algorithm Development | SimulinkPSP | Develop PX4 low-level control algorithms using official blocks |
| High-level Application Development | RflySimPSP | Develop application-layer functions using RflySim extended blocks |
| Hardware-in-the-Loop (HIL) Simulation | Combined Use of Both | SimulinkPSP generates code; RflySimPSP provides simulation interfaces |
| Swarm Cooperative Development | RflySim Swarm | Use swarm communication modules for multi-UAV cooperative development |
Related Resources¶
Note: This document serves as a consolidated index for the RflySim platform’s Simulink interfaces. For detailed usage instructions of each module, please refer to its respective standalone documentation page.