3.2.1
Speed
Used in speed mode, the controller has as input a speed value of the wheels,
and controls the motor to keep this wheel speed.
The speed value is a division of a constant value by the time between
encoder pulsations. In default mode (encoder resolution x4 and postscaler
1:4), a measure is made four times every pulse. Then each revolution of the
wheel, 2764 measures are made. The constant value is defined by the maxi-
mum time multiplied by 256 (0xFFFF * 256 = 16’776’960). This operation
allows a better PID calculation for the lower speed.
M otorSpeed
=
16
′
776
′
960
T imer
5
value
To convert into a real time, use the following calculation (this time is
the delay between two measures):
T ime
=
T imer
5
value
P ostscaler
f
osc
/
4
T mr
5
P rescaler
Where f
osc
= 20MHz and Tmr5Prescaler = 8 (default).
To get the real speed in mm/s:
RealSpeed
=
W heelCircumf erence
T ime
∗
2764
Where WheelCircumference is 128.8mm and 2764 correspond to the number
of measures per revolution of the wheel.
Here’s an example with MotorSpeed = 20’000, Tmr5Prescaler = 8, Postscaler
= 4 and encoder resolution = x4
T imer
5
value
=
16
′
776
′
960
20
′
000
= 839
T ime
=
839
4
20
′
000
′
000
/
4
8
= 0
.
336[
ms
]
RealSpeed
=
128
.
8
0
.
000336
∗
2764
= 138
.
9[
mm/s
]
RealSpeed
=
M otorSpeed
Kspeed
[
mm/s
]
Where Kspeed is 144.01 when default configuration is used.
The maximum reachable speed is 48’000 (= 333 mm/s) in open loop,
and 43’000 (= 298 mm/s) in regulation mode. And the minimum is 2’000
(= 13.9 mm/s) with regulation control.
Khepera III manual ver 2.2
14