Calibrating odometry for standard motors and wheels

slatkowski

New member
Hi everyone,

I have bought in the Marotronics shop:
- MA42 DC planetary gear motor 24 Volt with HallIC 30-33 RPM 8mm shaft in Marotronics shop and
- Ardumower drive wheel, 8 mm PE-HD, black, about 250 mm diameter
- PCB ver. 1.3

I'm trying to calibrate odometry: d: menu -> 2: test odometry -> s: stop -> o: one revolution.
When I try to calibrate odometry and turn the wheel one revolution I have two symptoms:
1. With default settings (Azurit firmware) the wheel is turning almost 1,5 revolutions which is wrong.
2. With calibrated manually setting named "Ticks by revolution" to 342 I got exactly one full revolution which is good but when I start Ardumower in auto mode it stops after 10-20 seconds and the wheels seems to have some malfunction: it pulls the wheels with different speeds and then stops with some error.

I'd expect to calibrate the odometry by setting "Ticks by revolution" to 342 and have the Ardumower working correctly in Auto mode.
Does anyone know how to set up odometry for the standard motor and wheels you could buy in the Marotronics shop?
Could you point me any guide on how to set up the odometry? I haven't found any useful article on the Ardumower Wiki :-/
I plan to connect the GY-801 gyroscope module that's why I suppose this is very important to calibrate the odometry correctly to have it working.

My settings are:
START
Ardumower 1.0a9-Azurit PCB 1.3 Arduino Due IOREF=3.30
Robot: Ardumower
---------- wheel motors --------------------------------------
motorAccel : 1000.00
motorSpeedMaxRpm : 31
motorSpeedMaxPwm : 255
motorPowerMax : 75.00
motorSenseRightScale : 6.15
motorSenseLeftScale : 6.15
motorPowerIgnoreTime : 2000
motorZeroSettleTime : 3000
motorRollTimeMax : 1500
motorRollTimeMin : 750
motorReverseTime : 1200
motorForwTimeMax : 80000
motorBiDirSpeedRatio1 : 0.30
motorBiDirSpeedRatio2 : 0.92
motorLeftPID.Kp : 1.50
motorLeftPID.Ki : 2.40
motorLeftPID.Kd : 0.25
motorRightSwapDir : 0
motorLeftSwapDir : 0
---------- mower motor ---------------------------------------
motorMowForceOff : 0
motorMowAccel : 2000.00
motorMowSpeedMaxPwm : 255
motorMowPowerMax : 75.00
motorMowModulate : 0
motorMowRPMSet : 3300
motorMowSenseScale : 6.15
motorMowPID.Kp : 0.00
motorMowPID.Ki : 0.01
motorMowPID.Kd : 0.01
---------- motorMowModulate Interrupt ------------------------
motorMowModulate Interrupt :
(...)
---------- odometry ------------------------------------------
odometryUse : 1
twoWayOdometrySensorUse : 0
odometryTicksPerRevolution : 511
odometryTicksPerCm : 3.30
odometryWheelBaseCm : 47.50
---------- Odometry Interrupt ---------------------------------
oneway left : Oneway right : twoway left : twoway right :
(...)
DONE

Thanks in advance!

--
Szymon
 
Hallo Szymon,

1. check dardware-divider on PCB (you have to solder)

2. check this post: https://forum.ardumower.de/threads/inbetriebnahme-mainboard-1-3-probleme.23918/

// choose ticks per wheel revolution :
// ...for the 36mm diameter motor (blue cap) https://www.marotronics.de/2-x-36er-DC-Planeten-Getriebemotor-24-Volt-mit-HallIC-30-33-RPM-8mm-Welle
//#define TICKS_PER_REVOLUTION 1310 / 2 // odometry ticks per wheel revolution

// ...for the 36mm diameter motor (black cap) https://www.marotronics.de/MA36-DC-...-30-33-RPM-8mm-Welle-ab-2-Stueck-Staffelpreis
// #define TICKS_PER_REVOLUTION 975 / 2

// ...for the newer 42mm diameter motor (green connector) https://www.marotronics.de/MA42-DC-...-30-33-RPM-8mm-Welle-ab-2-Stueck-Staffelpreis
#define TICKS_PER_REVOLUTION 697 / 2 // odometry ticks per wheel revolution

// ...for the older 42mm diameter motor (white connector) https://wiki.ardumower.de/images/d/d6/Ardumower_chassis_inside_ready.jpg
//#define TICKS_PER_REVOLUTION 697 / 2 // odometry ticks per wheel revolution


3. Switch off IMU.

4. Check "Trigger timeout: " in Perimeter-Settings


Gruß Fürst Ruprecht
 
Thanks for yout input Fürst!
Hallo Szymon,

1. check dardware-divider on PCB (you have to solder)
If you mean the "Step 16: Odometry divider" from https://docs.google.com/document/d/15II9sC4_JOfq3UQzmwF18d3_obtptz8EPa9HU8Yp4Z8 then it is soldered as in the picture.

2. check this post: https://forum.ardumower.de/threads/inbetriebnahme-mainboard-1-3-probleme.23918/

// choose ticks per wheel revolution :
// ...for the 36mm diameter motor (blue cap) https://www.marotronics.de/2-x-36er-DC-Planeten-Getriebemotor-24-Volt-mit-HallIC-30-33-RPM-8mm-Welle
//#define TICKS_PER_REVOLUTION 1310 / 2 // odometry ticks per wheel revolution

// ...for the 36mm diameter motor (black cap) https://www.marotronics.de/MA36-DC-...-30-33-RPM-8mm-Welle-ab-2-Stueck-Staffelpreis
// #define TICKS_PER_REVOLUTION 975 / 2

// ...for the newer 42mm diameter motor (green connector) https://www.marotronics.de/MA42-DC-...-30-33-RPM-8mm-Welle-ab-2-Stueck-Staffelpreis
#define TICKS_PER_REVOLUTION 697 / 2 // odometry ticks per wheel revolution

// ...for the older 42mm diameter motor (white connector) https://wiki.ardumower.de/images/d/d6/Ardumower_chassis_inside_ready.jpg
//#define TICKS_PER_REVOLUTION 697 / 2 // odometry ticks per wheel revolution
Thanks for pointing me this thread! I've set up 348 through pfodFi app in Settings -> Odometry -> Ticks per one full revolution. Unfortunately, the behaviour of the Odometry didn't changed from the one described by me in the first post :-(
3. Switch off IMU.
I didn't connect nor turn on IMU.
4. Check "Trigger timeout: " in Perimeter-Settings
I've checked it in pfodFi app in Settings -> Perimeter -> Trigger timeout and it is set to 0.
Gruß Fürst Ruprecht

I've found that changing the speed using pfodFi app in Settings -> Speed max in pwm from 255 to 150 has a bit changed the situation.

Below are my motor test results launched from serial console: d: menu -> 1: test motors. The speed is of course lower than before but they seems to work ok.
testing left motor (forward) half speed...
t 214 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 10 Ardumower
t 215 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 216 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 217 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 218 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
testing left motor (reverse) full speed...
t 220 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 221 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 222 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 223 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 224 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
testing right motor (forward) half speed...
t 226 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 227 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 228 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 229 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 230 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
testing right motor (reverse) full speed...
t 232 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 233 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 234 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 235 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower
t 236 L36372 m0 OFF rpm 0 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 1 yaw 0 pit 0 rol 0 bat 27.8 chg 0.0 0.0 imu 0 adc 0 Ardumower

But again when I'm trying AUTO mode and simulate heading towards the obstacle and slow down the motors start to behave improperly and I got Odometry error after a few seconds:
Log from the first case:
t 44 L21011 m0 FORW rpm 29 27 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc 83 Ardumower
t 45 L17967 m0 FORW rpm 25 27 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 46 L20921 m0 FORW rpm 22 22 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 47 L20855 m0 FORW rpm 22 17 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 48 L21750 m0 FORW rpm 20 18 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 49 L21419 m0 FORW rpm 27 27 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc 94 Ardumower
t 50 L18041 m0 FORW rpm 27 27 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 51 L20813 m0 FORW rpm 25 24 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
t 52 L20812 m0 FORW rpm 10 29 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc100 Ardumower
Left odometry error: PWM=150.00 RPM=0.00
t 0 L21430 m0 ERR rpm 0 27 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc 67 Ardumower
t 0 L21430 m0 ERR rpm 27 0 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 0 yaw 0 pit 0 rol 0 bat 27.6 chg 0.0 0.0 imu 0 adc 0 Ardumower

Log from the second error (I've repeated the experiment with sonar):
t 6 L24545 m0 FORW rpm 28 28 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc100 Ardumower
pfod cmd=s4
t 7 L25011 m0 FORW rpm 27 27 set 30 30 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc 91 Ardumower
pfod cmd=s4
t 8 L22074 m0 FORW rpm 25 25 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc 94 Ardumower
pfod cmd=s4
t 9 L20402 m0 FORW rpm 20 24 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc 90 Ardumower
pfod cmd=s4
t 10 L18596 m0 FORW rpm 27 12 set 20 20 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc 90 Ardumower
Left odometry error: PWM=150.00 RPM=0.00
t 0 L19489 m0 ERR rpm 0 27 set 0 0 sen 0 0 0 bum 0 0 dro 0 0 son 8 yaw 0 pit 0 rol 0 bat 27.5 chg 0.0 0.0 imu 0 adc 50 Ardumower

I get either Left or Right odometry error. How can I handle this? I think there's another setting responsible for this situation. Could you help to find it, please?

Please see the user settings printed on the first post if this can help in diagnosing. They don't differ now from the original ones except odometryTicksPerRevolution which is set to 348 and motorSpeedMaxPwm which is set to 150.

I'll appreciate any help!

--
Szymon
 
To check but :

motorSpeedMaxRpm : 31
motorSpeedMaxPwm : 255
If you reduce MaxPwm without changing MaxRpm it's not OK.
The 2 setting are link.
The MaxPwm need to be enought to reach the MaxRpm.
So try with MaxRpm=22 for example.

Also maybe you need to adjust the PID
motorLeftPID.Kp : 1.50
motorLeftPID.Ki : 2.40
motorLeftPID.Kd : 0.25
 
Hi Bernard,

I've set up motorSpeedMaxRpm to 22 and checked that the wheels are really turning 22 times in 60 seconds. I've also changed PID params proportionally to motorSpeedMaxRpm. It works quite well, but I still have a feeling that motors are not running 100% smoothly. I feel I will run into problems with the PID motor params when I'll connect my IMU compass. I haven't used it yet because I'd like to solve one problem at once.

Maybe you or someone else have the same set of standard motor+wheels (or the experience) and can provide ready-to-use parameters?

I must say I'm not very familiar with PID regulators and its parameters. Shouldn't the parameters Kp, Ki, Kd be constant for the PCB 1.3 and the specific set of motors (I've mentioned my motor/wheel model in the first post of this thread)?

My current parameters are:
---------- wheel motors --------------------------------------
motorAccel : 750.00
motorSpeedMaxRpm : 22
motorSpeedMaxPwm : 150
motorPowerMax : 75.00
motorSenseRightScale : 6.15
motorSenseLeftScale : 6.15
motorPowerIgnoreTime : 2000
motorZeroSettleTime : 3000
motorRollTimeMax : 3000
motorRollTimeMin : 1501
motorReverseTime : 3000
motorForwTimeMax : 80000
motorBiDirSpeedRatio1 : 0.30
motorBiDirSpeedRatio2 : 0.92
motorLeftPID.Kp : 1.07
motorLeftPID.Ki : 1.70
motorLeftPID.Kd : 0.18
motorRightSwapDir : 0
motorLeftSwapDir : 0
---------- odometry ------------------------------------------
odometryUse : 1
twoWayOdometrySensorUse : 0
odometryTicksPerRevolution : 348
odometryTicksPerCm : 3.30
odometryWheelBaseCm : 47.50
 
Hi.
Unfortunatly i don't use motor from shop.
No link between PID motor and IMU.
So deactivate IMU during all test until Odometry is OK
Check all setting with ticks /rev and ticks per CM
Ticks/cm is compute using the diameter of the wheel.

Now drive forward into manual mode on flat grass.
If it's not smooth the PID need to be adjusted.
Set Kd to 0 first and try to adjust Ki until it's smooth and the 2 wheel have the same speed.
 
Thanks for input Bernard,

I've ended with these settings:
---------- wheel motors --------------------------------------
motorAccel : 750.00
motorSpeedMaxRpm : 35
motorSpeedMaxPwm : 200
motorPowerMax : 75.00
motorSenseRightScale : 6.15
motorSenseLeftScale : 6.15
motorPowerIgnoreTime : 2000
motorZeroSettleTime : 3000
motorRollTimeMax : 3000
motorRollTimeMin : 1501
motorReverseTime : 3000
motorForwTimeMax : 80000
motorBiDirSpeedRatio1 : 0.30
motorBiDirSpeedRatio2 : 0.92
motorLeftPID.Kp : 1.07
motorLeftPID.Ki : 2.00
motorLeftPID.Kd : 0.00
motorRightSwapDir : 0
motorLeftSwapDir : 0
---------- odometry ------------------------------------------
odometryUse : 1
twoWayOdometrySensorUse : 0
odometryTicksPerRevolution : 348
odometryTicksPerCm : 4.40
odometryWheelBaseCm : 47.50

It's almost perfect. Is it ok to have motorLeftPID.Kd=0.00? How PID parameters Kp, Ki, and Kd are affecting the motors? Can you point some articles on Ardumower wiki or elsewhere where I can read about it (for beginners)?
 
The motor power max is certainly not OK.
I don't know exactly for AZURIT but without Bumper the mower can detect a high power in the motor and reverse to avoid slip on the grass or overheat of the motor.
Put the mower in manual and forward ,Using Arduremote go into setting/motor and check the motor power, brake the mower with your hand until the wheel slip (It's the valu you have to put into max power)
A value near 45 W is certainly more appropriate for the motor driver.

For the PID :
but you can find many general info on google search.
 
Hello,

I am pretty new to Arduino so maybe some stupid questions.

Last week I build an Ardumower on PCB 1.3 with Sunray and GPS RTK. But when I start the PCB with Arduino due the right motor starts spontaneously. Can someone help me a little bit?

AT+E
motor test - 10 revolutions
t=0 ticks Left=0 Right=0 current Left=0.00 Right=0.01
t=1 ticks Left=230 Right=63 current Left=0.05 Right=0.02
t=2 ticks Left=466 Right=121 current Left=0.05 Right=0.00
t=3 ticks Left=702 Right=179 current Left=0.05 Right=0.03
t=4 ticks Left=939 Right=237 current Left=0.06 Right=0.03
t=5 ticks Left=1176 Right=295 current Left=0.00 Right=0.02
t=6 ticks Left=1412 Right=354 current Left=0.01 Right=0.00
t=7 ticks Left=1649 Right=412 current Left=0.03 Right=0.00
t=8 ticks Left=1886 Right=470 current Left=0.02 Right=0.03
t=9 ticks Left=2123 Right=529 current Left=0.00 Right=0.00
t=10 ticks Left=2360 Right=587 current Left=0.06 Right=0.01
t=11 ticks Left=2597 Right=645 current Left=0.04 Right=0.02
t=12 ticks Left=2834 Right=704 current Left=0.05 Right=0.00
t=13 ticks Left=3072 Right=762 current Left=0.01 Right=0.00
t=14 ticks Left=3308 Right=821 current Left=0.05 Right=0.05
t=15 ticks Left=3322 Right=1107 current Left=0.00 Right=0.00
t=16 ticks Left=3333 Right=1395 current Left=0.00 Right=0.00
t=17 ticks Left=3345 Right=1683 current Left=0.00 Right=0.08
t=18 ticks Left=3356 Right=1971 current Left=0.00 Right=0.04
t=19 ticks Left=3368 Right=2259 current Left=0.00 Right=0.05
t=20 ticks Left=3379 Right=2547 current Left=0.00 Right=0.04
t=21 ticks Left=3390 Right=2835 current Left=0.00 Right=0.01
t=22 ticks Left=3402 Right=3123 current Left=0.00 Right=0.01
t=23 ticks Left=3413 Right=3411 current Left=0.00 Right=0.00
t=24 ticks Left=3425 Right=3722 current Left=0.00 Right=0.05
t=25 ticks Left=3436 Right=4042 current Left=0.00 Right=0.00
t=26 ticks Left=3447 Right=4362 current Left=0.00 Right=0.10
t=27 ticks Left=3459 Right=4682 current Left=0.00 Right=0.00
t=28 ticks Left=3470 Right=5002 current Left=0.00 Right=0.02
t=29 ticks Left=3480 Right=5266 current Left=0.00 Right=0.01
 
Oben