DroneCAN: update libcanard#30613
Merged
tpwrules merged 2 commits intoArduPilot:masterfrom Jul 13, 2025
Merged
Conversation
this reduces CPU usage in the hot frame accept path using hash on the message ID into a set of message lists
Contributor
|
Curious if you've done any particular profiling? |
Contributor
Author
I've added some profiling data to the PR |
Contributor
|
This looks reasonable but I will try to test on hardware this weekend. When I did testing I used a slightly tweaked |
tpwrules
requested changes
Jul 12, 2025
Contributor
There was a problem hiding this comment.
Looks good to me, I tested on CubeOrange it did not immediately break everything.
I want to get this in this PR too just to make bisecting easier and reduce the amount of submodule churn: dronecan/dronecan_dsdlc#35 (it's tested and ready to go in)
Contributor
Author
done |
tpwrules
approved these changes
Jul 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this reduces CPU usage in the hot frame accept path using hash on the message ID into a set of message lists
this is the key change: dronecan/libcanard#81
I profiled the change using SYS_STATUS.load while I had another flight controller on the bus sending a high rate of ESC RawCommand messages.


Here is the result on a CubeOrange with current master copter:
and here it is with this PR:
this shows roughly 10% reduction in overall CPU usage.
Note that this is a (deliberately) extreme case. We don't process RawCommand in ArduPilot main firmware, so we need to traverse all the way to the end of the linked list to determine that we shouldn't accept it, plus I setup the other flight controller with SCHED_LOOP_RATE=800 and as an OctoQuad, so over 2400 frames/sec of CAN frames we need to reject
The gain in CPU in more normal operation will be much smaller - maybe 2 to 3%? I setup the extreme case as it is quite a noisy thing to measure so much easier when you push the CAN bus hard