# Primitive obstacle avoidance for Auto mode

primitive system of evasion of obstacles for autonomous mode for copter.
I have always wondered why there is not a consensual way for an obstacle evasion system in automatic mode.
There are some solutions to this problem in the market but,
I find it curious to explain a simple way to do it with a routine of evasion of obstacles.

The drone when it is navigating in automatic mode, and detects an obstacle, must change from mode to loiter, and manage its direction conveniently in this case backward by 45 degrees, until the obstacle is within a reasonable distance, after this change for the previous mode of flight in which it was found either auto or rtl.
In a different position the drone will try to go back to its waypoint, but when reaching a minimum distance with the obstacle, the routine starts again â€¦
this with the purpose of going bordering safely the object in question â€¦

This model presents some limitations of course, but given its simplicity, it is a cheap thing to implement.

For those who analyze this geometrically find that if the line of union between the front drone and the waypoint forms an angle greater than 45 degrees, the drone will enter an infinite loop, but nothing bad will happen because the failsafe would enter battery. .

However I think I can say that for the largest part of the cases this would work correctly
and with a 95% positive chance of avoiding a tree in the middle of a field where a rectangular road is being made for fumigation or fertilization with drones.

even activating the normal mode of RTL if it is with a building should be able of bordering it without problems â€¦

When the opportunity is given I will test this in the flight field and we will see the video â€¦ until now the evasion of obstacles in automatic mode will have to wait with more sophisticated solutions

i did something similar to this but more basic a few time ago, modificating the YMFC_AL of joop brokking drone codeâ€¦ you can see more or less the concept worked but only in stabilice mode

2 Likes

How can i implement this method in mission planer. I just want to stop quadcopter when detects obstacle in auto mode. My controller is amp 2.8.

Obstacle avoidance is not supported in Auto mode currently in Arducopter and itâ€™s not actively being worked on as of FEB19

hello, a very simple solution is to put an arduino between the rc receiver and the signal input of the apm, intervening the signal of channel 5, when the adrduino detects an obstacle the pwm signal is modified by overwriting the output value of arduino to a value of channel 5 that is interpreted as Loiter for example

`` UTRASONIC SENSOR ------->|``

Or maybe when scripting functionality is implemented it could be done on the FC. But not on an old APM.

@autodidacta have you seen this blog ?

to be honest with you no, but the truth is that this is great

1 Like

I think @Ferrosan is still active on this forum

1 Like

i just chek that, ad its was very well explained by him, if you are interesed , i have another thin
similar to this:

Is there any development ??

Iâ€™m using RPLiDAR for obstacle detection in my rover.
I simply want to stop rover if any obstacle is detected by the LiDAR sensor when rover is running is AUTO mode.

As I gone through the documentation, it says that, in correspondance to the obstacle, the Rover can stop in loiter mode only.

Is it possible to acheive (STOP rover in AUTO mode when obstacle is detected) the above requirement using BendyRuler ?