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 PX4-Autopilot/src/lib/battery/battery_params.c at c50c44cc582956aefd32e39a6c7a5210ba4e1585 · PX4/PX4-Autopilot · GitHub

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: PX4-Autopilot/src/modules/simulator/simulator_mavlink.cpp at c50c44cc582956aefd32e39a6c7a5210ba4e1585 · PX4/PX4-Autopilot · GitHub

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: Redirecting to latest version of document (master)

1 Like