vel_body_full Module Documentation¶
Toolbox: RflySim Swarm

Introduction¶
One-sentence description: An Offboard control encoding encapsulation module in the RflySim Swarm interface library that supports velocity command input in the body-fixed coordinate frame.
This module is built upon the Offboard__full base module and is a dedicated functional module within the RflySim UAV swarm simulation toolchain for generating PX4 Offboard control commands. It is specifically designed for multi-UAV swarm simulation scenarios. The module accepts user-defined velocity commands in the body-fixed frame, encodes and encapsulates them into control commands compliant with the PX4 Offboard communication protocol, and transmits them to CopterSim or the PX4 flight controller via the RflySim UDP communication link. It also integrates with RflySim3D to enable 3D visualization of swarm flight. This module is ideal for rapidly setting up Offboard control simulation validation when developing velocity control strategies in the body-fixed frame for multi-UAV swarms.
Port Descriptions¶
Input Ports (Inputs)¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
vx_body |
double |
1×1 |
Velocity command in the x-direction of the UAV body-fixed frame, unit: m/s |
vy_body |
double |
1×1 |
Velocity command in the y-direction of the UAV body-fixed frame, unit: m/s |
vz_body |
double |
1×1 |
Velocity command in the z-direction of the UAV body-fixed frame, unit: m/s |
yaw_rate |
double |
1×1 |
Yaw angular rate command, unit: rad/s |
Output Ports (Outputs)¶
| Port Name | Data Type | Dimension | Description |
|---|---|---|---|
offboard_cmd |
double |
1×N [to be confirmed] |
Fully encoded Offboard control command, ready for direct input into the Offboard communication transmission module |
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 | Optional Values / Range | Description |
|---|---|---|---|---|
CopterID |
int |
1 |
1~255 |
ID number of the target UAV, used to distinguish different UAVs in the swarm |
Parameter Setting Notes¶
CopterID¶
This parameter specifies the ID of the target UAV corresponding to the current velocity command. In swarm simulations, each UAV must be assigned a unique ID to ensure correct mapping between control commands and communication links.
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 does not involve network communication; it only handles encoding and encapsulation of velocity commands in the body-fixed frame. The output data is transmitted over the network by the upper-layer Offboard communication module.
Related Modules¶
| Module Name | Description |
|---|---|
Offboard__full |
Provides the foundational communication and data encapsulation framework for群体 UAV Offboard control; this module is built upon it |
pos_body_full |
Encapsulates a群体 UAV encoding module supporting position command input in the body-fixed frame |
vel_NED_full |
Encapsulates a群体 UAV encoding module supporting velocity command input in the NED (North-East-Down) frame |
pos_NED_full |
Encapsulates a群体 UAV encoding module supporting position command input in the NED frame |
attitude_full |
Encapsulates a群体 UAV encoding module supporting attitude angle command input |
throttle_att_full |
Encapsulates a群体 UAV encoding module supporting throttle and attitude angle command input |
Notes and Common Issues¶
- Initialization Order: This module depends on the
Offboard__fullmodule for communication link initialization and swarm resource allocation. Ensure that theOffboard__fullmodule completes initialization beforevel_body_full; otherwise, velocity command encoding may fail, and the UAV may not respond. - Sample Time Matching: The encoded commands output by this module must match the Offboard control cycle of the flight controller. It is recommended to set the sample time of this module to match that of the
Offboard__fullmodule (typically 10 ms to 20 ms). Excessive sample time deviation can cause velocity control jitter or command loss. - Input Physical Unit Requirements: The three velocity inputs
vx,vy, andvzmust be in units of m/s. Using incorrect units (e.g., cm/s) will cause abnormal velocity commands, potentially resulting in excessive flight speed or no response. - Coordinate Frame Specification: The input velocity commands are defined in the UAV body-fixed frame (body frame), where
vxpoints forward along the nose,vypoints rightward along the wing, andvzpoints downward along the belly. For geographic frame (e.g., NED) velocity commands, perform coordinate transformation manually before connecting to the input ports. - Swarm Usage Limitations: Each UAV requires its own dedicated
vel_body_fullmodule. When using multiple UAVs, configure a separatevel_body_fullmodule for each UAV and ensure correct mapping to the corresponding UAV ID in theOffboard__fullmodule. - Command Activation Requirement: This module only outputs encoded velocity commands. Ensure the flight controller has correctly entered Offboard control mode; otherwise, the velocity commands will not be executed.
Changelog¶
v4.10(2024-05-20): Addedvel_body_fullswarm encoding module supporting velocity command input in the body-fixed frame.