-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
MAV_CMD_BATTERY_RESET move to common #1897
Conversation
This fixes a hole with power module based battery level tracking. This is a "discussion" PR. My thoughts:
|
I think it would be useful for supporting hot swapping. But to really unlock it we'd need to add a button in QGC |
Following.... Like you said the bitmask approach is limiting. AP already allows 9 battery instances. (And of course custom code can include far more.) For the battery reset button on QGC, I do know someone who has done that but I can't promise it will get released soon to the greater community. |
The rule for common nowdays is that things need to have one stakeholder implementation (i.e. ArduPilot) and have a firm intent for implementation in another (in this case PX4). What they means is that "someone" has to stand up and say "I will implement this in PX4". I'm not sure if it is worth it if they aren't going to commit to adding to QGC as well. My guess is that no one is going to stand up on the PX4 side and make that commitment. Mostly because the main audience who will want to hot swap are likely to be thinking about smart batteries anyway. Those that aren't thinking smart batteries probably wouldn't put the effort in to doing the implementation. I'm hoping I'm wrong - the point of this PR was to gauge interest. Given the discussion I think I'd also be hoping to propose a new command that makes this more generic. That's even harder because it would require both PX4 and ArduPilot to adopt. If any interest then we can discuss - something like: <entry value="xxxx" name="MAV_CMD_FUEL_LEVEL" hasLocation="false" isDestination="false">
<description>Reset capacity for batteries/fuel tanks that accumulate consumed capacity via integration.</description>
<param index="1" label="battery_slot">Slot number or battery number</param>
<param index="2" label="percentage" minValue="0" maxValue="100" increment="1">Battery percentage remaining to set.</param>
</entry> |
If it was adopted I can easily add it to AP along side the current implementation of MAV_CMD_BATTERY_RESET until such time I guess there are fewer folks on PX4 using fuel systems? A search in the docs for "fuel" didn't come up with more than 3 hits. |
I could easily add it to QGC as well, I'd be happy to do this for the sake of supporting it. I could probably add it to PX4 as well but don't really want to commit to that since it might be more involved to access the battery module directly and change its state. Idk, I'd have to look to know for sure. |
Yes. It seems to be an "area of interest". I just haven't had anything concrete to add to PX4 docs yet. I'll ask in the dev call. I know that there are a few messages around fuel systems but really it would be good to have started from "what do we need" rather than "how do we extend our battery messages". Might have had same result, but I think we'd have captured more stuff up front. |
We discussed in the dev call. The PX4 position was that this works for ArduPilot so would probably be fine for PX4. However there is no particular need to merge it right now. Since there is no commitment to integrate in PX4 we should not merge at this time. I'm going to close this. We can reopen and merge when it is needed. Thanks for the discussion. Should simplify things later on. |
This is a proposal to move the
MAV_CMD_BATTERY_RESET
command in the ArduPilot dialect to common.xml.It is dependent on someone in PX4 agreeing this is useful and they would like to implement it.
Power modules are powered on boot and start measuring the consumed power. The assumption is normally that the battery is full on boot, and the remaining power will be the full battery level minus the consumed power.
This works (provided the battery is full on boot) for a single battery. However when you hotswap a battery with a full battery the values are all immediately wrong because nothing has been consumed of the new battery.
The
MAV_CMD_BATTERY_RESET
command in the ArduPilot dialect allows a GCS to set the remaining percentage of the battery. So you could immediately set the value back to 100%.The command should be ignored by a smart battery, which knows its battery level and reports it accurately.
The command is also used to reset fuel-based power systems, which are often set to less than 100%.