How to add a new failsafe for battery level?

Hello Guys,

i think about to have two or more stages for battery fail-save.

  1. Battery half: return to land.
  2. Battery empty: land

is this possible and how it is possible?

Many thanks

Isn’t this already what is implemented, except that you need to adjust the limits?

@MaEtUgR can you confirm?

1 Like

I see only one option in Safety.

Empty Battery

Can you explain me, how this works with two levels?

The battery simulation for SITL is here:

So you could adapt this simulation to go all the way down to 0 and play with it to find out what happens :smile:

?

i see there no info.
You are shure to understand my questiion?

I seach a parameter, which defined the action by half of battery.

Thanks for help

the params are: https://dev.px4.io/en/advanced/parameter_reference.html#BAT_CRIT_THR

https://dev.px4.io/en/advanced/parameter_reference.html#BAT_EMERGEN_THR

https://dev.px4.io/en/advanced/parameter_reference.html#BAT_LOW_THR

Ok, now i understand.
Critical - Failsave (return)
Emergency - Land
Low - Warning

Failsave means “return mode at critical low level” ?
Emergency means “reaching dangerously low levels” ?

So i have to increase the “Critical level” for return.

thanks

1 Like

Yes, by default the thresholds are:
BAT_LOW_THR 15%, BAT_CRIT_THR 7%, BAT_EMERGEN_THR 5%
which results in:

  • 15% - “OK”

  • 7-15% - Low - Default: Warning for user, configurable by COM_LOW_BAT_ACT
  • 5-7% - Critical - Return to launch
  • < 5% - Emergency - Land on the spot

See https://github.com/PX4/Firmware/blob/c50c44cc582956aefd32e39a6c7a5210ba4e1585/src/lib/battery/battery_params.c#L75-L123

You can set these parameters on your vehicle to set different thresholds. As @JulianOes mentioned you can test the reactions in SITL simulation on your computer by setting the minimal simulated percentage (default is 50%) to the value 0.0f here: https://github.com/PX4/Firmware/blob/c50c44cc582956aefd32e39a6c7a5210ba4e1585/src/modules/simulator/simulator_mavlink.cpp#L397

I strongly recommend to you to follow these instructions such that you get meaningful battery percentage values out of your power module setup and configuration: https://docs.px4.io/en/config/battery.html

1 Like