ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_BattMonitor: Add Temperature Arming and Failsafe Checks

Open hendjoshsr71 opened this issue 4 years ago • 3 comments

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_UNHEALTHY when a temperature failsafe occurs
  • SITL  sim_batt_temp state 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 Critical over Unhealthy is tested and obeys Critical's set 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_UNHEALTHY as that seemed the most logical and added an action param for Failsafe::Unhealthy
  • What should the order of Failsafe::Unhealthy be with respect to Failsafe::Low & Failsafe::Critical?
    • I've put it with a lower priority than Low, but I think a case could be made for higher than Low. IE if you batteries are burning hot land Now
  • 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 image

Below shows in-flight failsafe performa Smart RTL action image

hendjoshsr71 avatar Jul 19 '21 09:07 hendjoshsr71

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 avatar Jul 19 '21 12:07 IamPete1

@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 avatar Jul 19 '21 19:07 hendjoshsr71

@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?

peterbarker avatar Sep 11 '24 13:09 peterbarker

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.

hendjoshsr71 avatar Sep 12 '24 02:09 hendjoshsr71

However, I’m of the opinion useful c++ should rarely be turned away.

likewise

peterbarker avatar Sep 12 '24 03:09 peterbarker