# SLAM - odometry motion model

I am making a project with a 4 wheeled differential robot to make visual SLAM using a stereo rig. I have some encoders to measure de displacement and the steering angle of the robot and I want to use the odometry motion model in the fastSLAM algorithm.

To use the odometry motion model you need to calculate the values it needs from the odometry reading (incremental encoders), $u_t=(\bar{x}_{t-1},\bar{x_t})$ where $\bar{x}_{t-1}=(\bar{x}\>\bar{y}\>\bar{\theta})$ and $\bar{x}_t=(\bar{x}'\>\bar{y}'\>\bar{\theta}')$ are the previous and the current pose extracted from the odometry of the vehicle.

My question is about how to obtain those values from the encoders. I guess that in this case I would need to obtain the equations from the geometric model for the differential robot:

$D_L=\frac{2\cdot\pi \cdot R_L}{N_c}\cdot N_L$

$D_R=\frac{2\cdot\pi \cdot R_R}{N_c}\cdot N_R$

$D_T=\frac{D_L+D_R}{2}$

$\Delta\theta=\frac{D_L-D_R}{L}$

where $D_L$ is the advance of the left wheel, $D_R$ is the advance of the right wheel, $R_L$ is the lecture from the left encoder, $R_R$ the lecture from the right encoder, $N_C$ the total number of pulses of the encoder type, $D$ is the total distance achieved by the robot and $\theta$ the angle steered. $L$ is the distance between the wheels.

Using those equations is possible to obtain the pose in every time step:

$\bar{x}_{t}=\bar{x}_{t-1}+D\cos(\theta_{t-1})$

$\bar{y}_{t}=\bar{y}_{t-1}+D\sin(\theta_{t-1})$

$\bar{\theta}_{t}=\bar{\theta}_{t-1}+\Delta\theta$

So those last are the values I need to inject to the modometry motion model and then add gaussian noise to them. Am I right? Or is there another way of computing the pose from odometry for a differential 4-wheel robot?

• Are you trying to simulate motion, or are you trying to get position and heading from actual data? What do you mean when you say "steering angle"? Does this vehicle use differential or Ackermann steering? – Chuck Jun 16 '16 at 20:09
• I am trying o get position and heading from odometry to use it inside the odometry motion model in SLAM. With steering angle I mean that I could compute the angle $\Delta\theta$ from the encoders. It is a differential 4-wheel robot. – osuarez Jun 16 '16 at 20:46