# Calibrating Your Robot Using UMBMark

By Paul Bouchier
This procedure summarizes the robot dead-reckoning calibration
procedure found in:
UMBMark – A Method for Measuring, Comparing, and Correcting Dead-reckoning Errors in Mobile Robots
by Borenstein et. al.

## Overview

The paper asserts that most dead-reckoning errors come from 2 sources:

1. Error in assumed wheelbase, which results in turning a different amount than dead-reckoning calculations predict
2. Difference in wheel diameter. (Ron showed in simulation that a 0.1% error in wheel diameter produces significant deviation from driving a straight line.

The two error sources interact. The figure below shows how a robot can be incorrectly tuned so that these two errors cancel each other out, returning the robot to its starting position (when run in the clockwise direction only). Figure 1: Two errors cancelling – copyright University of Michigan
The figure below shows how each error in the absence of the other can return the robot to the same ending location Figure 2: Two different errors producing the same end location – copyright University of Michigan.
The surprising thing is that the numerical value of each error can be computed from only 2 measurements,
one from a clockwise run and one from a counter-clockwise run.

## Assumptions

• Robot uses differential drive (left & right motors, independently controlled, like a 3pi.
• Not a tracked vehicle
• The major sources of error are accuracy of rotation and ability to drive straight. Of course, there are plenty of other sources of error, including loose mechanics, a control system that doesn’t control wheel position properly based on wheel encoder count, etc. If you have other sources of error, you need to fix them first. Then this procedure can help you get a 10X improvement in dead-reckoning accuracy.

## What you need to be able to do

• Adjust your robot so it runs a calibrated distance (optional step)
• Get your robot to drive in a largish square, both in the clockwise & counter-clockwise direction, ending up facing in the direction it started
• Adjust how much your robot turns when you ask it to turn through an angle of n degrees. Often this is done in the calculation that connects wheel encoder counts during a turn to the distance between wheels, but it may be done other places. For example, the Roomba interface uses a rotate-drive command, which it times.
• Adjust the relative speed of the left & right motors when the robot is running straight.

If you can’t do all of the above steps except the first, give up now – you won’t be able to use this technique to calibrate your robot.

## Variables

The following variables are used during calibration:

• X-cw: the X component of the error in position when the robot returns after running a clockwise square. Figure 3: Measurement of X-cw and X-ccw

• X-ccw: the X component of the error in position when the robot returns after running a counter-clockwise square
• L: the length of one side of the square
• b: the wheelbase (distance between drive wheels)
• Alpha: the error in angle the robot turns when it tries to turn 90 degrees Figure 4: alpha is -5 degrees – copyright University of Michigan

• Beta: the angle the robot turns when trying to run straight for distance L Figure 5: beta – the angle veered during a leg – copyright University of Michigan

## Procedure

Follow the steps below. Run the robot slowly, so as to avoid slippage.

1. Calibrate your robot so it will accurately run distance L. This step is valuable in order for your robot to know where it is, but is unrelated to the ability to correct for not running straight or turning the right amount. What you do have to be able to do is make it run a reasonable distance (8 -16 feet is fine). Measure and record the distance. This is L.
2. Make your robot run the previously measured distance, turn 90 degrees clockwise, run the same distance, and so on until it has completed a large square in the clockwise direction and is pointing in the same direction it started. Measure how far forward or backward it ended up from its starting point as shown below. This is X-cw, shown as 1 1/8″ in the figure above. Perform several runs and average X-cw.
3. Repeat in the counterclockwise direction. The distance forward or backward from its starting point is X-ccw.

## Calculate Errors alpha & beta

Alpha is the error in degrees when the robot tries to turn 90 degrees.

alpha = -14.324 * (X-cw + X-ccw)/L

Beta is the angle in degrees the robot has veered off a straight path after running distance L.

Beta = -14.324 * (X-cw – X-ccw)/L

## Calculate Correction Factors

Correcting for alpha is easy and can be done several ways.

• If your robot uses the wheelbase in its rotation calculations, define the wheelbase to be b-actual = b-nominal * (90/(90-alpha))
• If your robot takes a direct angle to turn as an input, change the requested angle to turn to Commanded _turn_angle = requested_turn_angle * (90/(90-alpha))

Correcting for beta involves a bit more calculation.

For some robots (e.g. Roomba), you can ask it to drive in an arc with radius R. By choosing R to compensate for the arc the robot drives when attempting to go straight, R can be nulled. This latter arc has radius:

R = (L/2)/sin(beta/2)

For other robots which control the number of encoder counts to be equal when running straight, a correction factor must be applied to either the desired left and right counts or to the actual left & right encoder counts. For example, if the robot veers to the left when attempting to run straight, we can either ask the control system for more encoder counts on the left and fewer on the right, or tell it that we got fewer encoder counts on the left and more on the right.

The ratio of actual wheel diameters is:

Ed = (R + b/2)/(R – b/2)

Multiply the encoder counts in your wheel control code by the following factors to compensate for unequal wheel diameters:

C-left = 2/(1 + Ed)

C-right = 2/((1/Ed) + 1)

For example, if you are changing how many counts you ask for from the left wheel:

New_requested_left_counts = original_requested_left_counts * C-left.

## References

UMBmark – A method for Measuring, Comparing, and Correcting Dead-reckoning Errors in Mobile Robots, J. Borenstein and L. Feng, Deember 1994. University of Michigan Technical Report UM-MEAM-94-22. Figures used with permission.

Posted in Tutorial.