## Precision Robot Turning – Baby Steps

Have you ever tried searching for something on the Internet and been left with a feeling that you must be the only one out there who does not know how to do something? I have! I decided to pursue precision turning with my robot, but tried to find out how to do it. It sounds simpleā¦ but there was very little information out there to help me understand how to do it. I wanted to be able to make a robot turn 90 degrees, or any other random angle.

Turns out, that turning a robot (with Math) is not too difficult, but also very complicated at the same time. I will follow up with the theory later, but wanted to post a working program first. This code allows you to set an angle, radius, and speed to turn a differential drive robot.

### Turn a Differential Robot to xDegrees

It works!!!! Lines 5-7 control the angle, radius and speed. Lines 9 and 10 represent the most difficult part of this exercise. To get the circumference of the wheel, I found it best to calculate it based on the radius rather than to measure the distance traveled. The width of the robot wheel-base is measured between the centers of the wheels.

This robot only turns to the left, but is very consistent no matter what angle, radius or speed I choose. Now I can turn this into something I can really use in a robot to allow me to turn to an angle.