Skip to content

RflySim Swarm - Cluster Communication Interface Library


The RflySim Swarm library provides a complete set of tools for drone cluster communication and control, supporting data exchange, cooperative control, and cluster simulation among multiple drones. It is suitable for large-scale drone formations, collaborative missions, and cluster algorithm validation.


Module List

Core Communication Modules

Module Function Description
Rfly UDP Fast High-speed UDP cluster communication interface, supporting multi-drone data transmission/reception and control command distribution
Rfly UDP Raw Raw UDP data communication interface, providing low-level UDP packet transmission/reception capabilities
Rfly Serial Raw Raw serial data communication interface, supporting data read/write for serial devices
Rfly UDP MAVLink MAVLink UDP communication interface, supporting encoding/decoding of standard MAVLink protocols

VRPN Motion Capture Interface

Module Function Description
Rfly VRPN Recv VRPN motion capture data reception interface, receiving pose data from motion capture systems
VRPN Data Decoder VRPN data decoder, parsing raw VRPN data into usable formats
Real Data Decoder Real-drone data decoder, processing state data from actual drones

Data Decoding Modules

Module Function Description
Full Data Decoder Full data decoder, parsing complete drone state and control data
Simple Data Decoder Simplified data decoder, parsing core position and velocity data

Cluster Control Modules

Module Function Description
Offboard Full Offboard full-data control, supporting cooperative control of position and attitude
Vel NED Full NED coordinate system velocity full-data control, enabling velocity-based formation control
Vel Body Full Body coordinate system velocity full-data control, supporting velocity tracking in body frame
Pos NED Full NED coordinate system position full-data control, enabling precise position-based formation control
Real Ctrl 28D Real-drone 28-dimensional control interface, supporting full-dimensional control of actual drones
Simple Ctrl 4D Simplified 4-dimensional control interface, enabling simplified position control
Auto Firmware API Auto firmware API, supporting automatic firmware configuration and updates
High Level Mode High-level mode control, supporting task-level and path-level cluster control

Communication Protocol Specifications

UDP Communication Modes

The RflySim Swarm library supports multiple UDP communication modes, accommodating different cluster simulation requirements in terms of scale and precision:

Mode Data Dimensions Applicable Scenarios
FullData Input: 15D, Output: 28D Medium-to-small scale clusters requiring complete state data
SimpleData Input: 5D, Output: 12D Large-scale clusters prioritizing communication efficiency
Raw Customizable Special protocol requirements with flexible configuration

The RflySim Swarm library fully supports the MAVLink protocol:

  • Standard Messages: Supports encoding/decoding of standard MAVLink message sets
  • Custom Messages: Supports user-defined MAVLink message formats
  • Multi-Version Compatibility: Compatible with MAVLink 1.0 and 2.0 protocol versions

VRPN Protocol Support

For integration with motion capture systems:

  • Pose Data: Receives position and orientation data of rigid bodies
  • Multi-Rigid Body Support: Simultaneously tracks multiple rigid bodies (multiple drones)
  • Real-Time Synchronization: Supports high-precision real-time data synchronization

Usage Scenarios

Single-Drone Simulation

  • Controller Validation: Use Rfly UDP Fast to communicate with CopterSim for validating custom controllers
  • Algorithm Development: Develop control algorithms in Simulink and interact with the simulation environment via communication interfaces
  • Parameter Tuning: Adjust control parameters in real time to observe system response changes

Cluster Formation Simulation

  • Formation Control: Implement multi-drone formation control using Pos NED Full or Vel NED Full
  • Collaborative Missions: Coordinate multiple drones to perform collaborative tasks such as search and encirclement via Rfly UDP Fast
  • Communication Testing: Validate cluster communication protocol performance in large-scale scenarios

Hardware-in-the-Loop (HIL) Simulation

  • Flight Controller Testing: Integrate real flight controllers into the simulation loop to test flight control algorithms
  • Sensor Simulation: Send simulated sensor data to the flight controller via communication interfaces
  • Fault Testing: Safely test various fault scenarios in the HIL environment

Real-Drone Deployment

  • Real-Drone Control: Use modules such as Real Ctrl 28D to enable Simulink controllers to control actual drones
  • Ground Station Communication: Exchange data with ground stations via the MAVLink protocol
  • Cluster Real-Flight: Enable cooperative control of multiple actual drones

Usage Notes

Communication Configuration

  1. Port Management: Ensure port numbers used by different modules do not conflict, especially in multi-drone simulations
  2. IP Address Configuration: Correctly configure target IP addresses; use 127.0.0.1 for local simulation and actual IPs for distributed simulation
  3. Buffer Configuration: Set UDP buffer sizes appropriately based on data volume to prevent data loss
  4. Timeout Handling: Set reasonable receive timeout durations to handle communication interruptions

Data Synchronization

  1. Sampling Time Matching: Sampling times of communication modules must match the Simulink model step size
  2. Timestamp Handling: Pay attention to timestamp synchronization across different data sources, especially when integrating VRPN data
  3. Data Alignment: Ensure consistency in data dimensions, order, and units between sent and received data
  4. Delay Compensation: For applications with high real-time requirements, consider compensating for communication delays

Cluster Simulation

  1. ID Management: Assign a unique ID to each drone to prevent confusion of control commands
  2. Communication Topology: Design a reasonable communication topology to balance communication load and latency
  3. Fault Isolation: Ensure that a single-point failure does not propagate to the entire cluster
  4. Scalability: Design a cluster architecture that supports dynamic addition and removal of nodes

Flight Safety

  1. Simulation Validation: Thoroughly validate control algorithms in a simulation environment before real-flight testing
  2. Safety Boundaries: Define safety boundaries for position, velocity, and attitude; automatically trigger protective actions upon exceeding these limits
  3. Remote Controller Override: Maintain the remote controller’s highest-priority control authority at all times
  4. Emergency Stop: Ensure a reliable emergency stop mechanism (e.g., Kill Switch) is available


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