Skip to content

RflyUdpBigMode Block Documentation

Toolbox: RflySim Swarm

RflyUdpBigMode block appearance

Overview

Summary: This block receives big-mode or waypoint data from an external program through a fixed UDP protocol and outputs up to 20 groups of four-dimensional data to Simulink.

RflyUdpBigMode is a UDP receive S-Function for big-mode control, task planning, and external host interaction. At simulation start, the block binds local UDP port 5005. It receives packets containing a header, packet ID, point count, waypoint data, and CRC32 checksum. When the packet passes validation, the data is converted into a single vector output and an ACK is sent back to the sender.

This block is suitable for scenarios where Python, C++, a large language model planner, or other external programs generate waypoint/mode control data, which is then consumed in Simulink for swarm control or path tracking.

Ports

Input Ports

This block has no input ports.

Output Ports

Port Data type Dimension Description
WaypointData single 80x1 Up to 20 groups of four-dimensional data. Each group is output as [x, y, z, yaw]. If no valid packet is received, all output elements are set to 0

The upstream sender may interpret the first several groups as arm, takeoff/landing, Offboard, waypoint ID, or multi-UAV control quantities according to the task protocol, and interpret the remaining groups as waypoint coordinates. The Simulink-side parser must maintain the same data meaning convention as the sender.

Parameters

This block has no Mask parameters.

Communication Protocol

UDP Port

Item Value
Local listen port 5005
Receive timeout 5 ms
Sample time 1/30 s
Maximum data groups 20

Packet Layout

Field Type Description
header uint16 Fixed header 0xAA55
packet_id uint16 Packet ID used for ACK confirmation
num_points uint8 Number of data groups in this packet. Values above 20 are truncated to 20 groups
reserved uint8 Reserved field
waypoints Waypoint[num_points] Each group contains double x, double y, float z, and float yaw
crc32 uint32 CRC32 checksum computed over the header and data area

ACK Layout

Field Type Description
header uint16 Fixed header 0xAA55
packet_id uint16 Confirmed packet ID
status uint8 0x01 means successful reception, 0x02 means CRC validation failure
reserved uint8 Reserved field

Block Characteristics

Item Value
Block type Level-2 C/C++ S-Function
S-Function name RflyUdpBigMode
Number of input ports 0
Number of output ports 1
Output data type single
Output width 80
Code generation support No

Usage

  1. Start the external program that sends big-mode or waypoint data.
  2. Make sure the external program sends UDP packets to port 5005 on the Simulink host.
  3. In the Simulink model, connect the RflyUdpBigMode output to a custom data parser, waypoint controller, or swarm-control module.
  4. On the sender side, use the ACK status field to check whether the packet was received and passed CRC validation.

Notes and Frequently Asked Questions

  • Port usage: Only one process can bind UDP port 5005 on the same host. Close other programs occupying this port before starting.
  • Zero output: The block outputs only the most recently validated packet. When no valid data is available, it outputs a zero vector. The downstream control logic should protect against zero-input conditions.
  • CRC consistency: The sender must compute CRC32 over the same range as the block, i.e., over the header and waypoint data, excluding the trailing CRC field itself.
  • Data meaning convention: The block itself only parses four-dimensional data groups and does not interpret the task-level meaning of each group. The sender and the Simulink parser must unify the protocol.

Changelog

  • v4.10 (2026-05-07): Added the RflyUdpBigMode block help documentation and connected it to the Simulink Help button index.