# How to calibrate differential drive?

I'm building a robot with differential drive. I've reached the point when I can drive it around on remote control and I'm trying to get the localization working. Now I would like to exactly measure parameters of the robot.

Model of the robot I'm using has two wheels spaced $b$ meters, each wheel has a distance per encoder tick $s_L$ and $s_R$ and variance standard deviation of the driven distance $\sigma_L$ and $\sigma_R$. When moving, distances are random variables from the following distributions: $d_L \sim t_{L}s_{L}N(1, \sigma_L^2)$ and $d_R \sim t_{R}s_{R}N(1, \sigma_R^2)$. Later this model might expand a little bit.

What is a good way to measure the parameters?

I found a way to measure $b$, $d_L$ and $d_R$ (added that as an answer), but I have no idea how to measure the standard deviations.

The model will be used as a prediction input in MCL, so I don't need covariance matrix for localization.

To estimate the first three parameters (distance between wheels and distance per encoder tick of both left and right wheels) I made a calibration pattern on the ground as shown in the image:

(this shape was chosen because it's easy to make using tape measure and a string)

Then I will manually drive the robot along the path in a ABCDBCA pattern as precisely as possible while recording encoder ticks. Then the calibration code will attempt to find the model parameters that minimize distance between output of the model (with variances set to 0) and the pattern.

My intuition is that since the path is quite long, maximal error between real robot and the pattern is bounded by a few centimeters and there are turns both left and right, the parameters found by this should be fairly close to the real values.

The only problem is that this won't give me the variances...

Someone please check my math here, but the wheel encoder value $\theta$ is not a continuous random variable -- it can't have a variance.

You might get a more reasonable continuous random variable in the form of the estimated total linear distance. In that case, the main source of variance in your encoder measurement is going to be the difference between your $r \theta$ calculation of distance travelled and the actual distance travelled -- if your radius measurement wasn't quite right, or the rubber on the tires compresses, or the wheels slip, etc.

• I probably described the model badly. I plan to interpret the real distance travelled as a random variable conditioned by the number of encoder ticks. I will clarify this in the question. – cube May 5 '14 at 19:09