DPRG List  

[DPRG] Motor control

Subject: [DPRG] Motor control
From: David P. Anderson dpa at io.isem.smu.edu
Date: Sat Jun 7 11:20:02 CDT 2003


As per our discussion of motor control from last week's
RBNO, I thought I'd try to summarize the scribblings on
the whiteboard and perhaps clarify a couple of points.

For a two-wheel robot platform like SR04, LegoBot, and NBot,
which use differential steering, the control of the robot
speed and direction ultimately comes down to a value for
the left and right motors, which we denoted as


In the most basic form, driving forward would be to set this
two values to some positive number,  (assuming an arbitrary
scale of motor control from -100 to +100:

               A         B         C          D
Left_motor  = 50        -50        50       -50
Right_motor = 50        -50       -50        50

"A" would drive the robot straight forward at 1/2 speed. "B"
would driver the robot straight backward at 1/2 speed.  And
"C" will spin the robot in place clockwise at 1/2 speed, (left
motor forward and right motor backward) and "D" will spin in
place counter-clockwise.

The next step of abstraction upward from this control scheme is
to not specify the individual values for left and right motor,
but rather specify the robot's motion in terms of two new


where Velocity is the fore/aft motion in the center of the platform,
and Rotation is angular velocity at the center of the platform.  Now
the calculation of the actual motor values from these two variables
is defined as:

	Left_motor  = Velocity + Rotation
	Right_motor = Velocity - Rotation

Controlling the motion of the robot thru Velocity and Rotation has
a number of advantages over directly controlling the left and right
motors.  First is that the calculations for a particular trajectory
are simplified.  As compared with the example above:
               A         B         C        D
Velocity =    50        -50        0        0
Rotation =     0         0         50     -50

Again, "A" drives straight forward at 1/2 speed, "B" drives backward,
"C" spins clockwise, and "D" spins counter-clockwise.
For normal navigating, the Velocity is set to a constant value and
the robot is steered using Rotation, and the robot therefore maintains
a constant speed at the center of the platform.  In the situation where
the robot is encountering multiple common IR detections (like Jeff's
"happy spots") the velocity can be driven to 0, while still allowing
the robot to spin in place and escape.  That's pretty hard to do if
you are specifying separate left and right motor values.

Complex paths become easier to implement.  For example, a spiral path
is created quite simply by holding a constant Rotation and gradually
increasing (or decreasing) Velocity.  By separating the velocity and
direction controls other robot behaviors also become easier to program.

Next week, the PID Speed Controller...

hope this helps!

More information about the DPRG mailing list