DroneCAN Lights
PX4 can control external LEDs on a connected DroneCAN peripheral using the standard DroneCAN LightsCommand message.
Up to 2 lights are supported. These can show system status colours, a fixed colour (used for indicating aircraft orientation), or switch between both depending on arm state.
支持的 RTK 设备
Any DroneCAN peripheral implementing the standard LightsCommand message type should work.
The following have been tested:
- Vertiq ESC LED add-ons: Each ESC exposes two light IDs — one RGB (for status) and one white. The
light_idfor each is calculated asesc_index × 3 + BASE_ID, whereBASE_IDis 1 for RGB and 2 for white. See Vertiq for other ESC setup details.
PX4 配置
- Set up DroneCAN as described in DroneCAN (
UAVCAN_ENABLE≥ 2). - Set UAVCAN_LGT_NUM to the number of lights (1 or 2). Then reboot and reopen the ground station so that parameters for the new instances become visible.
- Set the
light_idand light functions of each light:- UAVCAN_LGT_ID0 / UAVCAN_LGT_ID1: Set to a
light_idvalue (as defined by the specific product). - UAVCAN_LGT_FN0 / UAVCAN_LGT_FN1: Choose the desired light function.
- UAVCAN_LGT_ID0 / UAVCAN_LGT_ID1: Set to a
- Set UAVCAN_LGT_MODE to control when fixed "orientation" colours activate.
- Reboot for changes to take effect.
Light Functions
The functions of enabled lights are configured using UAVCAN_LGT_FN0 and UAVCAN_LGT_FN1, respectively. Each function is represented by a value that defines two behaviours: one when the activation mode is inactive and one when it is active.
| 值 | 参数名 | When mode inactive | When mode active |
|---|---|---|---|
| 0 | Status/Status | System status colour | System status colour |
| 1 | Off/White | Off | White |
| 2 | Off/Red | Off | Red |
| 3 | Off/Green | Off | 绿色 |
| 4 | Status/White | System status colour | White |
| 5 | Status/Red | System status colour | Red |
| 6 | Status/Green | System status colour | 绿色 |
| 7 | Status/Off | System status colour | Off |
备注:
- The system status colours is the same LED pattern used by the flight controller's onboard status LED (e.g. red when disarmed, green when armed and ready).
- A fixed colour, commonly used to indicate aircraft orientation. For example it is a common convention to have a red light on the port side, green on starboard, or white to the rear. These colours do not change with flight controller state.
- For hybrid functions, such as
Status/Red, the light shows the Status colour while the activation mode is inactive, then switches to the "fixed" light colour once the mode becomes active.
Activation Mode (UAVCAN_LGT_MODE)
The activation mode parameter (UAVCAN_LGT_MODE) controls when each light switches from its inactive to its active behaviour (configured with the Light function):
| 值 | 含义 |
|---|---|
| 0 | Always inactive (lights always show the inactive column) |
| 1 | Active when armed (default) |
| 2 | Active when prearmed or armed |
| 3 | Always active (lights always show the active column) |