Skip to content

Conversation

niklaut
Copy link
Contributor

@niklaut niklaut commented May 27, 2025

Solved Problem

When using UAVCAN ESCs on a hexacopter we were having issues with getting other nodes to talk back to the Skynode.
The ESCs were already on their own separate CAN bus, however, by default UAVCAN broadcast the ESC messages on all interfaces, starving the other nodes by message priority of bus bandwidth.

Solution

This adds a parameter that allows to configure the interface mask for the ESC actuators, which completely fixes the problem.
The default mask (0xff) is backward compatible with the default UAVCAN behavior.

Changelog Entry

For release notes:

New parameter: UAVCAN_ESC_IFACE configures which busses the ESC message is broadcast on.

Alternatives

No.

Test coverage

Tested in hardware on a hexacopter with 6 ESCs and a smart UAVCAN battery.

cc @cmic0

@niklaut niklaut requested a review from cmic0 May 27, 2025 13:11
Copy link

github-actions bot commented May 27, 2025

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 224 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +224  +0.0%    +224    .text
  +0.1%    +144  +0.1%    +144    g_cromfs_image
   +19%     +28   +19%     +28    UavcanEscController::init()
  +0.0%     +24  +0.0%     +24    [section .text]
   +14%     +16   +14%     +16    px4::wq_configurations::lp_default
  +0.1%      +8  +0.1%      +8    px4::parameters
  +0.6%      +4  +0.6%      +4    IUavcanSensorBridge::make_all()
  +0.2%      +4  +0.2%      +4    px4::parameters_type
  -0.4%      -4  -0.4%      -4    two_over_pi
+0.0%    +104  [ = ]       0    .debug_abbrev
+0.0% +1.85Ki  [ = ]       0    .debug_info
+0.0%     +75  [ = ]       0    .debug_line
   +40%      +2  [ = ]       0    [Unmapped]
  +0.0%     +73  [ = ]       0    [section .debug_line]
+0.0%     +32  [ = ]       0    .debug_loclists
+0.0%     +15  [ = ]       0    .debug_rnglists
  [NEW]      +3  [ = ]       0    [Unmapped]
  +0.0%     +12  [ = ]       0    [section .debug_rnglists]
+0.0%     +17  [ = ]       0    .debug_str
 +48% +3.78Ki  [ = ]       0    [Unmapped]
+0.0% +6.09Ki  +0.0%    +224    TOTAL

px4_fmu-v6x [Total VM Diff: 216 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +216  +0.0%    +216    .text
  +0.1%    +144  +0.1%    +144    g_cromfs_image
  +0.0%     +36  +0.0%     +36    [section .text]
   +19%     +28   +19%     +28    UavcanEscController::init()
  +0.1%      +8  +0.1%      +8    px4::parameters
  +0.6%      +4  +0.6%      +4    IUavcanSensorBridge::make_all()
  -4.5%      -4  -4.5%      -4    FlightTask
+0.0%    +104  [ = ]       0    .debug_abbrev
+0.0% +1.76Ki  [ = ]       0    .debug_info
+0.0%     +67  [ = ]       0    .debug_line
 -85.7%      -6  [ = ]       0    [Unmapped]
  +0.0%     +73  [ = ]       0    [section .debug_line]
+0.0%     +57  [ = ]       0    .debug_loclists
+0.0%     +14  [ = ]       0    .debug_rnglists
  +200%      +2  [ = ]       0    [Unmapped]
  +0.0%     +12  [ = ]       0    [section .debug_rnglists]
+0.0%     +17  [ = ]       0    .debug_str
-3.4%    -216  [ = ]       0    [Unmapped]
+0.0% +2.02Ki  +0.0%    +216    TOTAL

Updated: 2025-05-28T11:56:35

@niklaut niklaut force-pushed the pr-uavcan-esc-iface-mask branch from 3e83a3a to 38220e8 Compare May 27, 2025 13:21
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@niklaut niklaut force-pushed the pr-uavcan-esc-iface-mask branch 2 times, most recently from bf89dc8 to 6864ff5 Compare May 27, 2025 15:27
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, thank you! I can select the buses to publish on, it shows me I have to reboot and after that it publishes only on the corresponding bus without spamming the others 👍
image

@niklaut niklaut force-pushed the pr-uavcan-esc-iface-mask branch from 6864ff5 to b3fc587 Compare May 28, 2025 11:50
@niklaut niklaut enabled auto-merge (rebase) May 28, 2025 11:51
@niklaut niklaut merged commit 62c9bf8 into main May 28, 2025
69 checks passed
@niklaut niklaut deleted the pr-uavcan-esc-iface-mask branch May 28, 2025 13:04
@dakejahl
Copy link
Contributor

Maybe 1 or 2 is a better default? Otherwise someone might set this up, see that it's working, and move on without realizing they've just degraded their other CAN bus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants