-
Notifications
You must be signed in to change notification settings - Fork 15k
UAVCAN: Add LED Addressing Mode with Vertiq Support #26216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 272 byte (0.01 %)]px4_fmu-v6x [Total VM Diff: 336 byte (0.02 %)]Updated: 2026-01-08T13:53:09 |
eb8ea9f to
934b67f
Compare
934b67f to
a9e5de9
Compare
src/drivers/uavcan/rgbled.hpp
Outdated
| uint8_t _esc_count{0}; | ||
|
|
||
| DEFINE_PARAMETERS( | ||
| (ParamInt<px4::params::UAVCAN_LGT_MODE>) _param_lgt_mode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the convention, I know the other fields here were not corrected yet.
| (ParamInt<px4::params::UAVCAN_LGT_MODE>) _param_lgt_mode, | |
| (ParamInt<px4::params::UAVCAN_LGT_MODE>) _param_uavcan_lgt_mode, |
| cmd.color = brightness_to_rgb565(_param_mode_nav.get() >= control_mode ? 255 : 0); | ||
| cmds.commands.push_back(cmd); | ||
| for (uint8_t esc = 0; esc < _esc_count; esc++) { | ||
| cmd.light_id = esc * 3 + VERTIQ_WHITE_BASE_ID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again the light_id is the only difference, can we not duplicate the rest of the logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not because you sent to all ESCs instead of just one ID 🙈
|
/en/peripherals/vertiq.md
|
| if (vertiq_mode) { | ||
| // Vertiq mode: send RGB status to all ESC RGB LEDs | ||
| for (uint8_t esc = 0; esc < _vertiq_esc_count; ++esc) { | ||
| cmd.light_id = esc * 3 + VERTIQ_RGB_BASE_ID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you know that the ESC ids are [0, esc_status.esc_count - 1]. This might usually be the case but should at least be noted to be a requirement no?
| cmd.light_id = uavcan::equipment::indication::SingleLightCommand::LIGHT_ID_ANTI_COLLISION; | ||
| cmds.commands.push_back(cmd); | ||
|
|
||
| // Strobes | ||
| cmd.light_id = uavcan::equipment::indication::SingleLightCommand::LIGHT_ID_STROBE; | ||
| cmd.color = _param_uavcan_lgt_strob.get() >= control_mode ? color_on : color_off; | ||
| cmds.commands.push_back(cmd); | ||
|
|
||
| // Nav lights | ||
| cmd.light_id = uavcan::equipment::indication::SingleLightCommand::LIGHT_ID_RIGHT_OF_WAY; | ||
| cmd.color = _param_uavcan_lgt_nav.get() >= control_mode ? color_on : color_off; | ||
| cmds.commands.push_back(cmd); | ||
|
|
||
| // Landing lights | ||
| cmd.light_id = uavcan::equipment::indication::SingleLightCommand::LIGHT_ID_LANDING; | ||
| cmd.color = _param_uavcan_lgt_land.get() >= control_mode ? color_on : color_off; | ||
| cmds.commands.push_back(cmd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault but I'm unsure why these LED types would all need to be configurable to on, off, on arm independently. What are the odds someone has these types and all sets them differently... I'd understand if the land one is on during landing but otherwise I'd just send them out either way or have a bitmask parameter which ones even exist to not flood the CAN bus for the case someone has a light of a certain type 🤷♂️
|
Superseeded by #26253 |
Summary
Adds a new
UAVCAN_LGT_MODEparameter to configure LED addressing for UAVCAN LightsCommand messages. This enables automatic LED control for Vertiq motor modules with integrated LEDs.Changes
New parameter
UAVCAN_LGT_MODEwith two modes:0(Generic): Uses standard UAVCAN convention for led assignment1(Vertiq): Auto-calculateslight_idvalues for Vertiq ESC indexVertiq mode features:
light_id = esc_index * 3 + 1(displays PX4 status colours)light_id = esc_index * 3 + 2(anti-collision lighting)esc_statustopic (no manual configuration required)Documentation: Added LED configuration section to Vertiq peripheral docs
Motivation
Vertiq motor modules with the LED add-on require specific
light_idaddressing that doesn't match standard DroneCAN conventions.Testing