From RobotinoWiki


Robotino3 is equipped with a gyroscope mounted on the internal I/O-board. The gyroscope is a MPU6050. MEMS gyroscopes in general have two major problems. These are drift and scale.


When the gyroscope is not rotated the output signal should be zero. Unfortunately the gyroscope produces small random output signals even if not rotated. These random signals are called drift. On Robotino we now pretty well when the robot and therefor the gyroscope is not rotated. This is the case when the encoders from all three drive motors output 0. 500ms after we read zero from the three encoders we store the current output signal of the gyrosope and subtract this stored value from all gyroscope signals measured later. This ensures that the gyroscope signal is zero when the robot is not rotating. This also means that you can fool this mechanismn of drift compensation by taking up Robotino and rotate it without rotating the wheels.


When the robot rotates 360° the integration of the gyroscope readings should give us also 360° of measured rotation. This only is true when the gyroscope signal is scaled precisely. The gyroscope has an error of +-2% on the signal scale, i.e. the worst case would be that Robotino rotates 360° and we measure 353°. To compensate for scale errors you can run the gyrocal program on Robotino.


Use putty to log into Robotino. If not logged in as root directly do

sudo su

to become root.

Put some tape on the floor and align Robotino so that you can find the starting rotation again. Gyrocal start.jpg

Start gyrocal.

root@robotino:~# gyrocal
Press Enter to start rotation ...

State changed to 2
State changed to 3
Gyro measured a rotation of 360.431 degrees.
Enter misalignment in degrees ...
-3 -2 -1 0 1 2 3

At this point Robotino rotated about 360°. Adjust Robotino manually so that Robotino's rotation is identical to the starting rotation. After doing so you can enter 0 as misalignment because you manually aligned Robotino and the gyroscope measured the manual rotation.

Rotating 0 degrees to compensate previous error
Finished compensating misalignment? [y/n]

Answer with y (yes).

Gyro measured a rotation of 363.386 degrees.
Scale = 0.990681
Write scale permanently to /etc/robotino/controld3.conf? [y/n]

If you adjusted Robotino correctly you could answer with y (yes) here. The scale value is than written to /etc/robotino/controld3.conf

Stored scale permanently
controld3 start/running, process 2901

Check if the scale value is written correctly.

root@robotino:~# grep gyro /etc/robotino/controld3.conf

Note Before running gyrocal a second time set the gyroScale value to 1 in order to wirk with unscaled values.

sed -i 's/gyroScale=.*/gyroScale=1/g' /etc/robotino/controld3.conf
restart controld3