Home > Information, RobotC Code > Precision Robot Turning – Baby Steps

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

code listing for precision turning

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.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: