Simple_data_decoder Module Documentation¶
Toolbox: RflySim Swarm

Introduction¶
One-sentence Description: Decodes group drone transmission data in the simplified data mode of RflyUdpFast and outputs various drone state information.
This module is a group simulation data decoder in the RflySim Swarm interface library, specifically designed for multi-drone swarm simulation scenarios. It works in conjunction with the RflyUdpFast module to parse received raw packed transmission data into bus-formatted state data that can be directly used. MATLAB automatically prompts the data types contained within the bus, facilitating direct extraction and usage by users.
This module is commonly used in multi-drone swarm simulation tasks within the RflySim toolchain. It receives simplified drone state data transmitted via UDP from CopterSim or other swarm nodes, decodes the data, and outputs state information such as global position, attitude Euler angles, local coordinate position, and velocity. This provides inputs for swarm control algorithms in Simulink, enabling users to rapidly develop and validate multi-drone cooperative mission algorithms. It supports integration with PX4 flight controllers and RflySim3D visualization to achieve a complete closed-loop swarm simulation.
Port Descriptions¶
Input Ports (Inputs)¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
RxData |
uint8 |
N×1 |
Raw received data output by RflyUdpFast in simplified data mode |
Output Ports (Outputs)¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
VehicleStates |
Bus |
1 | Bus containing drone state data, including global position, attitude Euler angles, local coordinate position, and velocity. MATLAB automatically recognizes signals within the bus |
Parameter Configuration (Parameters)¶
The following parameters can be configured in the Mask dialog box opened by double-clicking the module:
| Parameter Name | Type | Default Value | Available Values/Range | Description |
|---|---|---|---|---|
CopterID |
int |
1 |
1~255 |
Target drone ID whose state data is to be decoded |
Parameter Setting Description¶
CopterID¶
Specifies the ID of the drone whose state data the current module decodes. In multi-drone swarm simulations, each decoder module corresponds to the state data parsing of one drone; simply set the corresponding ID according to the drone numbering in the swarm.
Module Characteristics (Block Characteristics)¶
| Characteristic | Value |
|---|---|
| Supported Data Types | double, single |
| Direct Feedthrough | Yes |
| Sample Time | Inherited |
| Code Generation Support | No |
Data Communication Protocol¶
This module only decodes simplified data output by the RflyUdpFast module and does not perform network communication directly.
Related Modules¶
| Module Name | Description |
|---|---|
RflyUdpFast |
Implements high-speed UDP data reception in swarm scenarios and outputs simplified-format drone state data for decoding by this module |
Full_data_decoder |
Decodes full-format data output by RflyUdpFast, providing richer drone state information |
RflyUdpSend |
Sends drone control command data to the simulation environment or other on-board units |
Notes and Common Issues¶
- Initialization Sequence: This module must be used together with the RflyUdpFast module, and RflyUdpFast must be configured to simplified data transmission mode. Before simulation starts, ensure RflyUdpFast completes communication initialization; otherwise, this module cannot correctly parse input data.
- Input Data Matching: This module only supports decoding data packets output in RflyUdpFast simplified data mode. Feeding it data from Full_data_decoder’s corresponding mode or other custom formats will result in decoding errors, causing output state data to be all zeros or abnormal values.
- Bus Data Extraction: When using the Simulink Bus Selector module to extract data from this module’s bus output, no manual signal addition is required—MATLAB automatically recognizes all available state signals within the bus output. If no signals appear, re-update the Simulink model before reopening the Bus Selector configuration interface.
- Multi-Drone Decoding Adaptation: For a single drone, configure only one Simple_data_decoder module. In multi-drone formation decoding scenarios, connect an independent Simple_data_decoder module to each output of RflyUdpFast; sharing a module will cause decoding data mixing errors.
- Sample Time Matching: This module inherits the input signal’s sample time by default. If a fixed sample time is set, it must match the communication sample time of the upstream RflyUdpFast module to avoid issues such as delayed data updates or repeated decoding.
Changelog¶
v4.0.0(2024-01-01): Initial release. Implements decoding of simplified-mode data from RflyUdpFast, outputting bus data containing drone global position, attitude Euler angles, local coordinate position, and velocity.