[Dprglist] Assisting PID odometry with an IMU

Murray Altheim murray18 at altheim.com
Fri Jan 22 22:27:58 PST 2021


Hi Doug,

My initial question was asking what might be the algorithm for
handling the rug bumps. Finding a Python library that handles this
is great, but I must admit I was still a bit adrift as to how to
actually incorporate it into my robot's behaviour. It'll take me a
bit of time to digest what you've written, and try it out in code
on my robot, but you've actually answered that question, i.e., how
to work out how to take that IMU error and incorporate it into the
robot's motor outputs.

Thanks very much for that!

One of the things I keep getting reminded of is that while there's
a lot of focus on fancy sensors and such (but of course!), some of
the more "basic" stuff in robotics is actually pretty tricky to get
right. Precise navigation and odometry is quite difficult, which is
what makes it all the more impressive to see done well.

Cheers,

Murray

On 23/01/21 7:17 pm, secretary at dprg.org wrote:
> Murray,
> 
> One approach is to take the theta value from the IMU instead
> of calculating it from the encoders, and then adding the 
> heading error to the summing node of the negative feedback loop.
> 
> Taking the theta value form the IMU:
> 
> /* accumulate total rotation around our center */
> /*theta += (left_inches - right_inches) / WHEEL_BASE; */
> 
> /* replace theta value with IMU yaw value */
> theta = read_IMU_yaw();  /* make sure that the units and orientation are correct */
> 
> /* and clip the rotation to plus or minus 360 degrees */
> theta -= (float)((int)(theta/TWOPI))*TWOPI;
> 
> Now the theta value is from the IMU and should show the impact of
> your rug/floor disturbance.
> 
> The next part is to add the heading error (heading error = heading
> target – theta) to the input summing node of your negative feedback
> loop. The heading error is zero when you are going in the right 
> direction, elsewise it will have either a negative or positive 
> value. It will be summed in with your reference value (desired 
> speed in this case) and the -feedback value (PID error). If you 
> view it in terms of your PID error, it is like you are changing 
> the reference value.
> 
> I hope this helps.
...........................................................................
Murray Altheim <murray18 at altheim dot com>                       = =  ===
http://www.altheim.com/murray/                                     ===  ===
                                                                    = =  ===
     In the evening
     The rice leaves in the garden
     Rustle in the autumn wind
     That blows through my reed hut.
            -- Minamoto no Tsunenobu



More information about the DPRGlist mailing list