# Kinematics of a Robot Car (Bicycle Model)

While going through the Sebastian Thrun‘s AI for Robotics class, I came across a programming assignment that required implementing basic kinematics of a simple robot in 2D space. The robot uses bicycle model. Here is the underlying geometry that give rise to the basic equations used in the class. Figure 1: A robot (car) movement in 2D space.

As shown in Fig. 1, the robot lies in a global cartesian coordinate space and is characterized by its  position and heading, $(x, y, \theta)$, where $\theta$ is the heading relative to $x$-axis.  The length of the robot is $L$ and its velocity along heading direction $\theta$ is $v$.

Let’s assume the robot’s origin (center of rear axle in Fig. 1) moves a distance $d$ along the heading direction. We are interested in the turn angle that the robot incurred during the movement.

Fig. 2 shows the bicycle model of the robot in Fig. 1. From Fig. 2, the angular velocity of the robot can be expressed as $\dot{\theta} = \frac{v}{R}$,          (1)

where $R$ is the radius of turn. Figure 2: Bicycle model of the robot (car).

We can also write, $\tan\alpha = \frac{L}{R} \implies R = \frac{L}{\tan\alpha}$.          (2)

Using (1) and (2), the turn angle is given by $\beta = \int \dot{\theta} dt = \frac{d}{L}\tan\alpha = \frac{d}{R}$,          (3)

where integration is performed over the time during which the rear wheel moves distance $d$.

Coordinates of center of turn can be easily computed using Fig. 2, $x_c = x - R\sin\theta$, $y_c = y + R\cos\theta$.

New heading of the robot after the turn can be obtained by adding $\beta$ from (3) and original heading $\theta$. Updated robot position and heading are given by $x' = x_c + R \sin (\theta + \beta)$, $y' = y_c - R \cos (\theta + \beta)$, $\theta' =(\theta + \beta)~\textrm{mod}~2\pi$.

From (3), when $\beta \rightarrow 0, R \rightarrow \infty$. We can approximate this as just a motion in straight line along heading direction. So, $x' = x + d \cos \theta$, $y' = y + d \sin \theta$, $\theta' =(\theta + \beta)~\textrm{mod}~2\pi \approx \theta~\textrm{mod}~2\pi$.