-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Mavlink fixes & perf improvement #9894
Conversation
This is a more generic solution for 532a970, and also enables it for vehicle_command_ack's. In addition it avoids using a timestamp for subscription update checking, because it does not work well together with orb queuing.
- reorders operations, such that the most expensive one (orb_copy) is done only when really needed. - corner case: when the topic was not advertised yet, orb_stat() would fail and then update() was called, which succeeds for the first advertisement. In that case the timestamp was incorrectly set to 0 and true was returned. The next call would again return true, because the timestamp was updated, but the topic data was still the same. Reduces CPU load by ~2% on a Pixracer.
This should be revisited.
The result is that sometimes SYS_STATUS message goes out with zeroes in onboard_control_sensors_* fields. I could provide PR for this particular case but cannot do 100% fix as I'm not that familiar with code to know where else this behavior is relied upon. |
Thanks for raising this! |
I also stumbled across this when updating the uORB subscription wrappers in mavlink for #11176. In that PR I restored the behavior as described in the comments (zeroing if no data, copy even if not updated) as a precaution, and because it was cheaper with the new interface. That PR is going to take time to settle after v1.9.0 is released. I would suggest a quick fix for |
This is my fix: |
disable_sharing
flag toadd_orb_subscription
.It is a more generic solution for 532a970, and also enables it for vehicle_command_ack's.
MavlinkOrbSubscription::update
:In that case the timestamp was incorrectly set to 0 and true was returned. The next call would again return true, because the timestamp was updated, but the topic data was still the same.
Reduces CPU load by ~2% on a Pixracer.