-
Notifications
You must be signed in to change notification settings - Fork 14.6k
add: Battery_Status_V2 MAVLink stream #25347
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
base: main
Are you sure you want to change the base?
Conversation
configure_stream_local("BATTERY_STATUS", 0.5f); | ||
configure_stream_local("BATTERY_STATUS_V2", 0.5f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaEtUgR What's the normal way we handle the case where we are migrating between messages for the MAVLINK_MODE_NORMAL case (where it is OTA).
My guess is that we'd initially stream both like this, but we might also update QGC to request the message type it wants and set the other not to stream?
Did you test against QGC, and does QGC implement this?
FWIW We try match the most common definitions. I looked at all of them when we designed this message. One thing I would consider is modifying this more like https://mavlink.io/en/messages/common.html#FUEL_STATUS
In other words the recipient knows what is measured and what is inferred in all cases and can tell that it is working with a system that trusts the values it outputs. This is better than what the battery message does, which is assume the battery was initially full, and use the consumed charge or battery voltage to work out what was consumed - then estimate the remaining. Not sure we can though, because the approach comes from power modules, and I'm not sure we can "know" internally or from other sources what was calculated and what is measured. |
e62a823
to
f6f59f0
Compare
f6f59f0
to
f77786f
Compare
Tested, but Battery_Status_V2 is not implemented in QGC.
Changed the way of calculating capacity_remaining, now is based on remaining_capacity_wh/nominal_voltage. I'm not sure if this is the way which we should use, before was just remaining * capacity. |
Sorry, that was a side-note. This should match what it says on the mavlink spec, and we need to discuss with others if we want to modify the spec. I commented because the way that the fuel spec does it works well because you can measure fuel in different ways. It needs more thinking to make a change like this for batteries though, since so many things assume certain behaviour. Upshot, revert please if the change doesn't match the spec. |
I think after that change it's directly converts actual remaining energy to charge capacity using basic electrical relationship: https://www.inchcalculator.com/wh-to-ah-calculator/. The remaining * capacity approach would be more appropriate when only percentage-based remaining capacity is available. It's still according to mavlink spec. Of course we could add different behavior depends on MAV_BATTERY_STATUS_FLAGS_CAPACITY_RELATIVE_TO_FULL, but this flag is not available yet in the code. Next PR I will add BatteryContinous/Periodic/Cells. |
f77786f
to
3d8f198
Compare
|
Solved Problem
Initial implementation for new mavlink message stream
BATTERY_STATUS_V2
.It's base on BatteryStatus.msg, in a future we need to split this msg according to:
mavlink/rfcs#19
dronecan/DSDL#7
mavlink/mavlink#1846
Best to use similar structure to dsdl format of the battery messages (20004.BatteryInfoAux.uavcan, 20010.BatteryContinuous.uavcan, 20011.BatteryPeriodic.uavcan, 20012.BatteryCells.uavcan). Another question is why this is on ardupilot side, not common dsdl.
Solution
Changelog Entry
Alternatives
BATTERY_CELL_VOLTAGES
.Test coverage
Context