motorControlOdo() controls PWM instead of RPM

RonPeeters

Member
Hi @bernard,

I am wondering why your imuDirPID controller in motorControlOdo() has a direct effect on the outputted PWM?

Wouldn't it be more correct/efficient to let the motorLeft and motorRight PIDs control the RPM and let the imuDirPID have an effect on the RPM of each wheel to keep the imuHeading correct?

But maybe I am overlooking something.
 
Hi.
RPM is use only to have a speed control on slope and for compatibility with old AZURIT manual moving mode.
To drive motor with or without IMU, PID act on the PWM value.

If i have a little time i try to explain how it's work.
see this very old post:

 
Thanks for point out to this thread.
I understand how the PID works.
I was only curious if there was a specific reason that you chose to directly control the PWM, and skip the RPM control.
 
For AZURITBER and not on manual control:

The RPM is the ticks count / time and it can't be compute too fast only each 100 ms : see Robot::calcOdometry.
The PWM is the native command for motor driver and is update and adjusted with PID ,imu etc each 15 ms to have a smooth movement.

So :
RPM is use to have a constant moving speed on slope for example but is only adjusted 5 or 10 times by second to leave time for RPM update
PWM is use to drive straight or tracking with a high speed react time 15ms .

Do you have trouble with GY-521 ?
 
No I do not have trouble with the IMU.
I am just thinking of arranging a more logical working of the mower.

That would me a PID cascaded control:
- The RPM of both wheels would be set
- A PID for each wheel controls the PWM level to reach that RPM of each wheel.

- In a straight line driving, a PID controller would be responsible to adjusting the RPM of the wheels to that the ticks remain the same.
- In that measuring there would be a difference between the RPM/tick count of each wheel because of the inner differences between the two wheels and motors to keep a straight line and that would be the bias that needs to be corrected.

Ultimately I would like to instruct the mower to drive an arc that has a radius of 0.5m and that rotates 180°. And have the result be more or less ok.
 
- The RPM of both wheels would be set
- A PID for each wheel controls the PWM level to reach that RPM of each wheel.

- In a straight line driving, a PID controller would be responsible to adjusting the RPM of the wheels to that the ticks remain the same.
- In that measuring there would be a difference between the RPM/tick count of each wheel because of the inner differences between the two wheels and motors to keep a straight line and that would be the bias that needs to be corrected.

It's exactly the AZURIT working mode and it's something logic if you consider that wheel never slip but it's not the case in the grass.

All my test 3 year ago show that Running in straight line with only ODOMETRY is not possible on the grass.

Take a look at this site (only with time)
It's what i use for spirale mowing when high grass is detected
 
Oben