(I am reposting here a question I asked on stack overflow, since it actually sits right in between programming (modeling of 2D physics) and physics proper (kinematics). I think I have the physics part of my solution right, but would be grateful to anyone who could provide a second look).


I am modeling a simple differential drive robot (such as the e-Puck, Khepera, etc.) with pyBox2D. This class of robots is usually controlled by indicating speeds for the right and left wheel in rad/s. However, Box2D can only control a (kinematic) body through two parameters: linear velocity (in m/s, as a 2D vector) and angular velocity (in rad/s). I need to convert my wheel speeds to linear + angular velocities.

Linear velocity is actually straightforward. Given a wheel radius $r$ in meters, and current robot orientation $\theta$ in radians, the forward speed is simply the average of the two wheel speeds in meters/sec and converted to a velocity vector according to current orientation. Let $v_r,v_l$ be the angular velocities of the two wheels, $Sp$ the forward speed of the robot, and $V$ its linear velocity. Then

$$Sp = \frac{(v_r \cdot r) + (v_l \cdot r)}{2} \tag{1}$$

$$V = (S \cos(\theta), S \sin(\theta)) \tag{2}$$

I cannot quite figure out the correct formula for angular velocity ($Av$), though. Intuitively, it should be the difference between the two speeds modulo the distance separating the wheels ($Sep$):

$$Av = \frac{(v_r - v_l )}{Sep} \tag{3}$$

in the limit cases: when $v_r=v_l$, the robot spins in place, and when either $v_l=0$ or $v_r = 0$, the robot spins (pivots) around the stationary wheel, i.e. in a circle with radius = $Sep$.

I checked my formulas with a standard computational robotics text (Dudek and Jenkin, Computational Principles of Mobile Robotics), and they seem to be correct.

However, my model does not exhibit the expected behavior with formula (3). As a test, I set up a robot with the left wheel speed to 0 and progressively increased the value of the right wheel's speed. The expected behavior is that the robot's should spin around the left wheel with increased velocity. Instead, the robot spins in circles of increasing radius, i.e it spirals outward, which suggests that the angular velocity is insufficient (or that my linear velocity is too large, I guess).

(Notice that I use the kinematic body type offered by the physics simulation package I use (Box2D), which excludes all computations of friction and forces. In other words, dynamics factors such as slippages, frictions, etc does not play a role in my problem)

  • $\begingroup$ Do you have a sketch of the robot? Does it only have two wheels like a segway, or 3, or 4 wheels of which only two are diven. $\endgroup$ Commented Mar 25, 2015 at 19:11
  • $\begingroup$ PS. Use math formatting for better readability. Enclose formulas in $...$ (see physics.stackexchange.com/help/notation) $\endgroup$ Commented Mar 25, 2015 at 19:12
  • 1
    $\begingroup$ @ja72: Didn't know you could use Latex on the site. Edited accordingly. For the robot: it is simply a circle (the physics engine I am using is 2D, so no height). $\endgroup$
    – stefano
    Commented Mar 25, 2015 at 19:59
  • $\begingroup$ Related - physics.stackexchange.com/q/185204/37364 $\endgroup$
    – mmesser314
    Commented Jul 27, 2015 at 5:10
  • $\begingroup$ I do not know how the software models the motion, but a spiral is what your equations predict if you add the angular speed to the linear speed, assuming the linear speed is always paralell to the wheel's direction $\endgroup$
    – user126422
    Commented Jun 26, 2017 at 14:26

2 Answers 2


The mistake here is that the total angular velocity of the robot's rotation is $$Av = \frac{r(v_r - v_l)}{Sep}$$ The limiting cases are:

  • $v_r = v_l$: The robot travels in a straight line, $Av = 0$, $V = rv_r.$
  • $v_l = 0$: The robot pivots about a stationary wheel, $Av = rv_r/Sep$, $V = rv_r/2$ (the middle of the robot travels half the distance of the right wheel).
  • $v_r = -v_l$: The robot spins in place, $Av = 2rv_r/Sep$ (the wheels move in a cirle equal to half the wheel separation), $V = 0$

In your textbook, $v_r$ probably refers to the linear velocity of the wheel, where as the usual symbol for the angular velocity of the wheel is $\omega_r$.


I think the problem is that when you drive one wheel the other free wheels and thus turning the robot in circles. You have to consider carefully the relationship between the torque characteristics of the motors with any gearing to the wheels to establish reasonable control of the robot.

In you case is it really possible to fix a motor (not moving) even when a torque is applied to it? Does your motor control apply brake torque to slow down motion, or only drive torque to speed up motion?

  • $\begingroup$ I am using a kinematic body---so there are no torques applied (or applicable). The software lets me control the linear and angular velocities of the robot directly. $\endgroup$
    – stefano
    Commented Mar 25, 2015 at 20:02
  • $\begingroup$ So then if the inside wheel has zero velocity there must be slipping if the robot is moving on an arc where the center of rotation is away from the inside wheel. $\endgroup$ Commented Mar 25, 2015 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.