Skip to content
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 split BATTERY_STATUS from SYS_STATUS update #10135

Closed
wants to merge 2 commits into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Aug 3, 2018

  • fix SYS_STATUS usage of battery_status and cpuload

SYS_STATUS wasn't necessarily getting fresh data from vehicle_status, battery_status, and cpuload.

@dagar dagar force-pushed the pr-mavlink_sysstatus branch 2 times, most recently from 1b39a77 to e91d522 Compare August 3, 2018 16:01
// if vehicle_status updated always grab latest cpuload and battery_status

battery_status_s battery_status = {};
_battery_status_sub->update(&battery_status);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know you will always have valid data for all messages because both battery_status and cpuload are published more frequently than vehicle_status?

If so, aren't you at risk of using old/queued data from battery_status and cpuload?

Copy link
Member Author

Choose a reason for hiding this comment

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

In any normal usage we can expect to have them continuously (if we ever had them). Deciding if it's worth handling the failure case is a fair point.

For example if you had a smart battery and lost communication. The now separate BATTERY_STATUS message would stop, but SYS_STATUS battery fields would be stale.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant was when the system is running as normal and e.g. battery_status publishes at 3x the rate of vehicle_status, the messages would stack up and you'd use an old message.

I don't know how big the stack is but I have seen something to the effect of the following in other places:

while(_battery_status_sub->update(&battery_status)) {}

Copy link
Member Author

Choose a reason for hiding this comment

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

That's only an issue for topics that are queued. Currently that's vehicle_command (+ack), subsystem_info, and transponder_report.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, good to know. Thanks!

 - fix SYS_STATUS usage of battery_status and cpuload
@dagar
Copy link
Member Author

dagar commented Aug 4, 2018

Actually, I think the real problem here is that the update implementation drifted from it's original design and documentation. https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_orb_subscription.h#L56-L65

I'll review.

@dagar dagar force-pushed the pr-mavlink_sysstatus branch from e91d522 to 65246d6 Compare August 4, 2018 15:30
@stale
Copy link

stale bot commented Jan 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Feb 4, 2019

Closing as stale.

@stale stale bot closed this Feb 4, 2019
@dagar dagar reopened this Feb 6, 2019
@dagar dagar added this to the Release v1.10.0 milestone Feb 6, 2019
@dagar dagar closed this Apr 2, 2019
@dagar dagar deleted the pr-mavlink_sysstatus branch April 2, 2019 12:45
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.

2 participants