Skip to content

RflyUdpBigMode Block

Toolbox: RflySim Swarm

RflyUdpBigMode block

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

Inputs

This block has no input ports.

Outputs

Port Data type Dimension Description
WaypointData single 80x1 Up to 20 groups of four values. 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 assign the first groups to lock, takeoff, Offboard, waypoint ID, or multi-UAV control quantities, and use the remaining groups as waypoint coordinates. The Simulink-side parser must use the same task-level 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 of 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 success, 0x02 means CRC 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 it sends UDP packets to port 5005 on the Simulink host.
  3. Connect the RflyUdpBigMode output to a custom data parser, waypoint controller, or swarm-control module.
  4. Use the ACK status field on the sender side to check whether the packet was received and passed CRC validation.

Notes

  • 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 last successfully validated packet. When no valid data is available, it outputs a zero vector. The downstream control logic should handle zero-input conditions.
  • CRC consistency: The sender must compute CRC32 over the header and waypoint data, excluding the trailing CRC field itself.
  • Task-level convention: The block only parses four-value groups. The meaning of each group must be agreed between the sender and Simulink parser.

Changelog

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