user32086: I am currently working on an obstacle avoidance robot project and I have seen numerous algorithms for obstacle avoidance a very good example is this Obstacle avoidance algorithm [Editor's note: by user3880651],
but unfortunately non of those algorithm works with Arduino so upon my research I found this blog
 
and in there the author talks about an effective way to avoid obstacles and even has a formula he uses for avoiding obstacles at different positions e.g (Front and sides) but doesn't really explain how he got the formula so I was wondering if anyone as an effective formula or algorithm for obstacle avoidance that works with Arduino thanks for your help in advance 

user20158: The algorithm mentioned in the blog uses a Fuzzy Logic Controller to perform obstacle avoidance. You can read up more on fuzzy logic here: https://www.calvin.edu/~pribeiro/othrlnks/Fuzzy/home.htm

newMotorSPD_L = basicVelocity + urgMotor_L + (urgTurn_R/4) - (urgTurn_L/2) + 60;
  newMotorSPD_R = basicVelocity + urgMotor_R + (urgTurn_L/4) - (urgTurn_R/2) + 60;

Based on the code, the formula is basically made up of variables with different weight/ratio.
basicVelocity is the default moving velocity of the robot when there is no obstacle or wall detected.
urgMotor_L/urgMotor_R is the ouput of the controller for frontal object detection/avoidance by getting the difference between the left and right ultrasonic sensor.
(urgTurn_R/4) - (urgTurn_L/2) is probably the left/right bias?
+60 at the end is probably to offset the error of the motor. (Assuming all other variable are 0, the robot should be still at 60 for their case?) 
To simplify what the formula does, it can be shown using this graph:


32086: <p>I am currently working on an obstacle avoidance robot project and I have seen numerous algorithms for obstacle avoidance a very good example is this <a href="https://arduino.stackexchange.com/questions/36307/obstacle-avoidance-algorithm">Obstacle avoidance algorithm</a> [Editor's note: by user3880651],
but unfortunately non of those algorithm works with Arduino so upon my research I found this <a href="http://www.rmcybernetics.com/projects/DIY_Devices/diy-robot-arduino.htm" rel="nofollow noreferrer">blog</a></p>

<p><a href="https://i.stack.imgur.com/ePQxK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ePQxK.png" alt="enter image description here"></a> </p>

<p>and in there the author talks about an effective way to avoid obstacles and even has a formula he uses for avoiding obstacles at different positions e.g (Front and sides) but doesn't really explain how he got the formula so I was wondering if anyone as an effective formula or algorithm for obstacle avoidance that works with Arduino thanks for your help in advance </p>
 20158: <p>The algorithm mentioned in the blog uses a Fuzzy Logic Controller to perform obstacle avoidance. You can read up more on fuzzy logic here: <a href="https://www.calvin.edu/~pribeiro/othrlnks/Fuzzy/home.htm" rel="nofollow noreferrer">https://www.calvin.edu/~pribeiro/othrlnks/Fuzzy/home.htm</a></p>

<blockquote>
  <p>newMotorSPD_L = basicVelocity + urgMotor_L + (urgTurn_R/4) - (urgTurn_L/2) + 60;
  newMotorSPD_R = basicVelocity + urgMotor_R + (urgTurn_L/4) - (urgTurn_R/2) + 60;</p>
</blockquote>

<p>Based on the code, the formula is basically made up of variables with different weight/ratio.</p>

<p><strong>basicVelocity</strong> is the default moving velocity of the robot when there is no obstacle or wall detected.</p>

<p><strong>urgMotor_L/urgMotor_R</strong> is the ouput of the controller for frontal object detection/avoidance by getting the difference between the left and right ultrasonic sensor.</p>

<p><strong>(urgTurn_R/4) - (urgTurn_L/2)</strong> is probably the left/right bias?</p>

<p><strong>+60</strong> at the end is probably to offset the error of the motor. (Assuming all other variable are 0, the robot should be still at 60 for their case?) </p>

<p>To simplify what the formula does, it can be shown using this graph:
<a href="https://i.stack.imgur.com/Ve6PK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ve6PK.png" alt="enter image description here"></a></p>
