ardupilot
ardupilot copied to clipboard
AP_BattMonitor: Add Temperature Arming and Failsafe Checks
This PR adds failsafe and arming checks for minimum and maximum temperatures. It replaces this PR https://github.com/ArduPilot/ardupilot/pull/7451
It should be useful for those operating in cold environments or wanting to detect battery pack anomalies.
Additions
- Uses
MAV_BATTERY_CHARGE_STATE_UNHEALTHYwhen a temperature failsafe occurs - SITL
sim_batt_tempstate param in order to test the failsafes via autotests. - Autotests to test no failsafe action occurs when the temperature failsafes are hit but no action is defined for
Unhealthy - Autotest to ensure that priority of
CriticaloverUnhealthyis tested and obeysCritical'sset actions - Controversial item?: method to reset smbus fail safes to the most recent status as I think this could be useful...for resetting intermittent failsafes from mission planner. Truly
reset_remaining()should be renamed as its base implementation does more than reset the remaining capacity.
Points of discussion:
- What should happen when these checks fail in terms of a failsafe?
- Here I set
MAV_BATTERY_CHARGE_STATE_UNHEALTHYas that seemed the most logical and added an action param forFailsafe::Unhealthy
- Here I set
- What should the order of
Failsafe::Unhealthybe with respect toFailsafe::Low&Failsafe::Critical?- I've put it with a lower priority than
Low, but I think a case could be made for higher thanLow. IE if you batteries are burning hot land Now
- I've put it with a lower priority than
- Should the user be notified during flight more specifically that the temperature is unhealthy?
- On arming the notification is specific to temperature.
Below shows Pre-Arm Failsafes

Below shows in-flight failsafe performa Smart RTL action

We do have a example script for this,
https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Scripting/examples/arming-check-batt-temp.lua
At some point the behaviour is to difficult to parameterize, or won't have enough users. Arming checks and failsafes is a ideal scripting use case.
Not saying that this is not worth while, just pointing out that there is another way already in tree.
@IamPete1 Ah didn't see that one hanging out in the scripting. Whomp whomp. I guess I could try to update the script instead to have a bit more functionality.
@hendjoshsr71 so this one's conflicting horribly now.
You suggested this could be done in a script, last thing.
Did you want to pursue this PR?
I’ll close it though a few users on discord have asked for this functionality before.
It could be done in a script or off board but not on Periphs.
However, I’m of the opinion useful c++ should rarely be turned away. But this feature isn't so useful or crazy safety critical so it’s not worth a battle.
However, I’m of the opinion useful c++ should rarely be turned away.
likewise