Is there a way to automatically switch to brake mode while in AUTO or RTL, when an obstacle is detected?

Hello, I have a drone with two proximity sensors mounted front and back. Everything is working fine in Loiter and Althold when an obstacle is detected. I have carefully set the parameters, and the drone applies brakes whenever an obstacle is detected. In AUTO mode, bendy ruler is applied and the drone finds the path towards the waypoint and avoids obstacle by going around the obstacle.

But my requirement is that when and obstacle is detected in AUTO mode, or in RTL mode, instead of following bendy ruler or anything else, the drone should just apply hard brakes or switch to Brake mode.

Is there a way to do this?

@rmackay9 is there any way to do this in the latest version? If yes can you give a brief explanation. @rishabsingh3003 you also implemented something like this if I am not wrong. Can you please give me an insight regarding this?

@Gourav1997,

Proximity sensors are exposed to Lua scripts now so it could be done. I’m coincidentally working on adding support for “simple avoidance” (aka stopping) in Auto mode this week although it’s a little tricky and so it is possible that I won’t be successful and it would initially go into 4.6 (not 4.5).

1 Like