[Physics] Kinematics of a differential drive robot

kinematicsrotational-kinematicssimulations

(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).

Issue:

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)

Best Answer

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$.

Related Question