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

AP_BattMonitor: use SOC 127 as an invalid SOC flag #19482

Merged

Conversation

hendjoshsr71
Copy link
Member

As discussed here, #19404 (comment)

Using soc = 101 for an invalid soc is pre-existing, but I'm not a fan of it. Technically, of course the battery can never get above 100 soc by definition both in current UAVCAN standard and of course reality. But if the system is misconfigured (wrong voltages, capacity, etc.) it could end up above 101 SOC.

I just looked some code for a UAVCAN battery monitor and it just sends out 100 if it computes SOC above 100. Instead IMO a device should send a "hey this is isn't right state using 127". Just a thought as we look to future DroneCan messages.

Since we can't really change the in-use UAVCAN standard I didn't propose that. I imagine the change would look like this in 1092.BatteryInfo.UAVCAN

#
# Relative State of Charge (SOC) estimate, in percent.
# http://en.wikipedia.org/wiki/State_of_charge
#
uint7 STATE_OF_CHARGE_INVALID = 127     # Use this constant if SOC cannot be estimated or if the SOC estimation is in an error state
uint7 state_of_charge_pct               # Percent of the full charge [0, 100]. This field is required
uint7 state_of_charge_pct_stdev         # SOC error standard deviation; use best guess if unknown

@rmackay9 rmackay9 merged commit d79a9b7 into ArduPilot:master Dec 14, 2021
@hendjoshsr71 hendjoshsr71 deleted the pr/batt_uav_can_soc_error_state branch December 14, 2021 00:11
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.

None yet

4 participants