Skip to content

Offboard_full Module Documentation

Toolbox: RflySim Swarm

Offboard_full Module Appearance

Introduction

One-sentence Description: This module encodes various offboard control commands and parameters for multi-UAV offboard control into MAVLink protocol-compliant byte messages, supporting full-type offboard control requirements of PX4.

This module serves as the offboard control command encoder node within the RflySim Swarm cluster development toolchain. Designed specifically for multi-UAV cluster offboard control simulation and development scenarios, it simultaneously supports combined control of multiple quantities including position, velocity, acceleration, force, yaw angle, and yaw rate. Users can flexibly enable corresponding control dimensions and select the control reference coordinate frame.

The MAVLink-formatted control command byte stream generated by this module can be transmitted via UDP communication interface to CopterSim or multiple PX4 UAV flight controllers, enabling offboard cluster control. When used in conjunction with RflySim3D, it supports visual simulation and verification of cluster control algorithms, facilitating rapid migration from simulation to real hardware.

Port Descriptions

Input Ports (Inputs)

Port Name Data Type Dimension Description
CopterID uint8 1×1 Unique identifier of the UAV, used to distinguish different UAVs in a multi-UAV cluster
enPos boolean 1×1 Enable flag for position control mode
enVel boolean 1×1 Enable flag for velocity control mode
enAcc boolean 1×1 Enable flag for acceleration control mode
enForce boolean 1×1 Enable flag for force control mode
enYaw boolean 1×1 Enable flag for yaw angle control mode
enYawrate boolean 1×1 Enable flag for yaw rate control mode
FrameIndex uint8 1×1 Reference coordinate frame index for control signals, e.g., MAV_FRAME_LOCAL_NED, MAV_FRAME_BODY_FRD
Pos double 1×3 Position control command
Vel double 1×3 Velocity control command
Acc double 1×3 Acceleration control command
Force double 1×3 Force control command
Yaw double 1×1 Yaw angle control command [To be confirmed]
Yawrate double 1×1 Yaw rate control command [To be confirmed]

Output Ports (Outputs)

Port Name Data Type Dimension Description
Offboard_bytes double 1×8 Byte array of the encoded MAVLink message containing the control command

Parameter Configuration (Parameters)

This module has no configurable parameters.

Module Characteristics (Block Characteristics)

Characteristic Value
Supported Data Types double, single, uint8, boolean
Direct Feedthrough Yes
Sample Time Inherited
Code Generation Support No

Data Communication Protocol

This module only performs MAVLink message encoding for offboard control commands and outputs the encoded byte array; it does not perform network communication transmission directly.

Module Name Description
SetPositionGlobalYaw_SW Generates position control commands with yaw in the global coordinate frame for a group of UAVs
SetVelocityBodyYawrate_SW Generates velocity control commands with yaw rate in the body frame for a group of UAVs
UAVSendMAVData_UDP Sends the encoded MAVLink messages via UDP to simulation or real-flight controllers
Offboard_decode Decodes and parses received offboard control MAVLink messages

Notes and Common Issues

  • Initialization Sequence: This module only generates MAVLink-format offboard control commands. Prior to use, ensure the group communication initialization module has been properly configured, and that all UAVs have unique CopterIDs; otherwise, command transmission errors and UAV identification conflicts may occur.
  • Coordinate Frame Index Validity: FrameIndex must be set to a valid enumeration value defined by the PX4 MAVLink protocol. Inputting an undefined enumeration value will cause the flight controller to fail to recognize the reference coordinate frame of the control command, resulting in control deviation or loss of control.
  • Control Enable Logic: In offboard control mode, at least one control quantity (position/velocity/acceleration/force/yaw angle/yaw rate) must be enabled (i.e., its enable port set to true). If none are enabled, the flight controller will not respond to control commands.
  • Byte Data Format Compatibility: The output Offboard_bytes is an 8-element double-type byte array. It must be connected to a sending module compatible with the RflySim Swarm group communication format. Direct connection to incompatible interfaces may cause data parsing errors.
  • Sample Time Matching: The MAVLink control commands output by this module must match the refresh frequency of the flight controller’s offboard control loop. It is recommended to set the module’s sample time consistent with the flight controller’s control period (typically 10 ms to 50 ms). An overly slow sample rate may cause the offboard mode to disconnect, while an overly fast rate wastes unnecessary communication bandwidth.

Changelog

  • v4.00 (2024-12-10): Initial release. Supports generation of complete offboard control mode MAVLink message byte packets, including multi-UAV ID differentiation, multi-control mode combination configuration, and customizable reference coordinate frame selection.