Skip to content

vel_ned_full Module Documentation

Toolbox: RflySim Swarm

vel_ned_full module appearance

Introduction

One-sentence description: This module is a NED-coordinate velocity command encoding module in the RflySim Swarm interface library, built upon Offboard__full, used to generate velocity control commands compliant with the protocol.

This module is a specialized command encoding unit within the RflySim multi-UAV swarm simulation toolchain, designed for offline control (Offboard) scenarios. It serves as a velocity command processing wrapper, primarily used in multi-UAV swarm velocity control simulation development. Developers can directly input desired velocity commands in the NED coordinate system, eliminating the need for custom protocol encoding. The encoded commands generated by this module are transmitted via UDP communication to CopterSim for flight controller logic simulation, and the simulated states are synchronized to RflySim3D for visualization of swarm flight. It also supports integration with real PX4 flight controller hardware for hardware-in-the-loop simulation or physical swarm testing.

Port Descriptions

Input Ports (Inputs)

Port Name Data Type Dimension Description
vel_ned double 1×3 Velocity command in NED coordinate system: North, East, and Down components
CopterID double 1×1 ID of the UAV to be controlled; valid input only when the module is configured in single-ID mode

[To be confirmed] If the module is configured in broadcast-to-all-UAVs mode, the CopterID input port is inactive.

Output Ports (Outputs)

Port Name Data Type Dimension Description
packaged_offboard_cmd double 1×n Encoded Offboard control command packet, ready to be fed into the Offboard command transmission module [To be confirmed]

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 Available Values/Range Description
Target Copter ID int 1 1~255 / 0 Target UAV ID; 0 indicates broadcasting to all UAVs
Yaw rate cmd double 0 Any real number Yaw rate command, in rad/s

Parameter Setting Notes

Target Copter ID

Configure the UAV ID to which the velocity command is sent. Setting it to 0 broadcasts the command to all UAVs in the swarm, in which case no CopterID signal input is required. Setting it to a non-zero value allows dynamic input of the target UAV ID via the input port for flexible control.

Yaw rate cmd

This module only supports input of three-axis velocity commands in the NED coordinate system. The yaw rate is configured as a fixed parameter here. To enable dynamic adjustment of the yaw rate, the module encapsulation can be modified to accept it as an input port.

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 performs velocity command encoding. The final output data is transmitted to the PX4 simulation firmware via UDP by an Offboard control-related module.

Module Name Description
Offboard__full Fundamental Offboard control encapsulation module in RflySim Swarm; this module is developed based on it
pos_ned_full Position command encoding module in NED coordinate system, part of the same RflySim Swarm control encoding module family
att_throttle_full Attitude-throttle command encoding module, part of the same RflySim Swarm control encoding module family

Notes and Common Issues

  • Coordinate System Specification: The velocity commands output by this module are based on the NED coordinate system. Input velocity commands must conform to the NED definition (North as positive x, East as positive y, Down as positive z); confusion with ENU coordinates will cause the UAV to fly in directions opposite to expectations.
  • Initialization Sequence: The Offboard mode initialization of the entire RflySim Swarm simulation must be completed before outputting velocity commands generated by this module; otherwise, the UAV may fail to enter Offboard control mode, resulting in loss-of-control error messages.
  • Input Range Limitation: The magnitude of input velocity commands must not exceed the maximum velocity limit of the UAV flight controller. Generally, it is recommended to keep the absolute value of velocity commands ≤ 10 m/s; commands exceeding this limit will be truncated by the PX4 flight controller, causing deviations from the expected flight trajectory.
  • Sample Time Matching: The sample time of the velocity commands output by this module must match the communication cycle of the parent Offboard__full module. It is recommended to set it between 10 ms and 50 ms; excessively large sample times (>1 s) will cause Offboard control timeouts, prompting the flight controller to automatically revert to manual mode.
  • Swarm Usage Notes: In multi-UAV swarm simulations, each UAV must be assigned its own dedicated vel_ned_full module; multiple UAVs should not share the same module, as this will cause command broadcasting errors and cause all UAVs to follow the same velocity command.

Changelog

  • v4.10 (2024-06-15): Initial release of the vel_ned_full encapsulation module, supporting NED-coordinate velocity command input on top of Offboard__full.