What do you need to calculate? Well, there is the velocity/position thing
for a start.

If you are using DC motors, you may well feel the need to create clever
control loops to govern the velocity and position of the wheels. Your
goal is to put the wheels into a known position. The constraints include
the available acceleration and the desired velocity or acceleration profile.

Simple motion in a straight line requires that you accelerate the wheels
as hard as you dare. Both wheels will need the same acceleration if the
mouse is to go straight. Controlled deceleration will be needed toword
the end of the run to ensure that we come gently to a rest in the desired
position without over or undershooting the target.

Rotation about the centre of the mouse is a similar operation except
that the accelerations will be different and one of the motors will be
driving backwards. The accelerations will be different because the rotational
inertia of the mouse will have a more pronounced effect when spinning
on the spot compared to straight line motion.

A common technique for creating this kind of control is to create a PID
controller system. PID stands for Proportional, Integral, Derivative.
All that means is that we want to know how far we are away from the goal
(integral), how fast we are moving (proportional) and how much acceleration
we are using (derivative). These control systems are common and can be
quite simple to write. They need tuning for the actual device they are
used in. References and descriptions are widely available.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.