Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Translating velocity and angle into wheel speed (for a two wheel robot)

  1. Oct 10, 2008 #1

    I'm coding a controller for a two wheeled robot whos speed and angle is determined by the velocity of it's two wheels.

    The problem is, my code does calculations using speed (mm/s) and angle (radians).

    So I need someway of converting that speed and angle into the velocity of the two wheels of the robot.

    It sounds really simple but I just can't work out what the exact forumla is.

    Any clues?

  2. jcsd
  3. Oct 10, 2008 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Speed I am guessing, is the speed of the robot. But what is the angle? Is that rotation angle of the wheel or direction of travel?

    You need to be very specific about the smallest details if you want help. We cannot see your robot or read your mind, you have to tell us.
  4. Oct 10, 2008 #3
    Yes, the angle is the direction of travel of the robot relative to it's current position. The wheels are unable to 'steer' as such. Rather, the robot turns by altering the velocity of each of it's two wheels.

    For example, if I passed a function two values, speed=20mm/s and angle = +0.4radians I need that function to convert to the speed of each wheels which should end up something like left_wheel=18mm/s, right_wheel= 21mm/s. So that the robot will then travel at a speed of 20mm/s at an angular velocity of 0.4 radians.

    Hope that makes sense.
  5. Oct 10, 2008 #4


    User Avatar
    Science Advisor

    It's still not clear what you mean by passing the angle. What you can control is, rather, the rate of change of that angle, just as you control the speed or rate of change of position.

    If you want the robot to go a 20 mm/s, then the circumference of the wheels has to move 20 mm/s. Since the circumference is [itex]2\pi R[/itex], where R is the radius of the wheels in mm, that would mean that you want the wheel to rotate a fraction [itex]20/(2\pi R)= 10/(\pi R)[/itex] of its circumference and so that same fraction of a whole rotation, [itex]2\pi[/itex]radians: you want both wheels to turn at [itex]10/(\pi R)(2\pi)= 20/R[/itex] radians per second. In general, to move x mm/s in a straight line, the wheels will have to turn at x/R radians/s.

    In order to turn, one wheel will have to turn faster than the other and to have ONLY a turn, one wheel will have not turn at all. To turn and move, add the "turning" speed to the "moving" speed of one wheel. In order to turn an angle an angle of 0.4 radiansper second, you will have to take the distance between the wheels into account. If the distance between the wheels (axle length) is L mm, a 0.4 radian turn will cover a distance of 0.4L mm. In order to have moved that in one second, the wheel will have had to turn, as above, 0.4L/R. More generally, in order to turn at y radians per second, the "outside" wheel will have had to turn at yL/R radians per second.

    In order to move forward at x mm/s and turn at y radian/s, the inside wheel will have to turn at x/R radians per second while outside wheel turns at x/R+ yL/R= (x+ yL)/R radians per second. Again, R and L are in mm since x is in mm/s and y is in radians/s.
  6. Oct 10, 2008 #5
    OK. That definitely clears things up for me.

    Thanks alot for the help.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook