New approach to keeping a three wheel robot running in a straight line

I mean with dual H bridge and DC motors a lot of people find their robots running in a curve when they think it should be running straight ahead.

Solutions include comparing motor speeds using optical sensors with slotted disks etc. or fitting a digital compass.

These seem to me overcomplicated in terms of coding especially with timer conflicts etc

I think I may have a new approach and would appreciate comments, suggestions and offers of collaboration.

The idea is to simply sense the position of the rear caster wheel when the robot is supposed to be running straight ahead. If it is centred the robot is indeed running straight. If it is left of centre then the robot is turning right and vice versa. Trimming the values of the pwm signals to the H bridge would then correct the direction of travel. In my experience feedback of this type is usually the best answer as it is independent of battery voltage, slippery surfaces and differences in motor performance

The code seems almost trivial and someone more electro-mechanically minded than me could probably work out how to easily do the sensing of the caster wheel direction.

So is this new? Can we do it? Or where can we see what someone else has already done?

Looking forward to hearing from you. Regards Alan.

Yeah......it's great that some thought is being put in to try solve a problem. But some questions are... how do you make the rear caster wheel point 'straight ahead'. And rear wheel pointing in some fixed direction won't necessarily make the vehicle travel in a straight line if the two front wheels are at different ground speeds, right?

I don't see the code as being "trivial" -- you need PID control to keep the robot moving straight, and what do you do during turns?

I use a magnetic compass in the autopilot for a boat with twin engines and screws (no rudder), and that works very, very well. All you do to turn is change the input bearing.

Southpark:
Yeah......it's great that some thought is being put in to try solve a problem. But some questions are... how do you make the rear caster wheel point 'straight ahead'. And rear wheel pointing in some fixed direction won't necessarily make the vehicle travel in a straight line if the two front wheels are at different ground speeds, right?

The design is for two independently driven wheels at the front and a non driven trailing caster wheel at the back. If one front wheel is going faster than the other then the caster vertical axis will naturally rotate off centre one way or the other.
So to keep the robot running straight the code needs to sense the direction of turn by, say, optically sensing the angle between the caster wheel holder and the robot chassis. This can be quite coarse with perhaps only needing three readings - left centre and right. Adjusting the pwm signal to the motors hbridges slightly in response to a left or right caster signal will bring the robot back on course. When the caster is running centred we stop modifying the pwm signal. This part of the code is obviously used only used when the robot has been commanded to run straight ahead.

So for instance a reflective IR sensor mounted on the chassis looking at a disk which turns with the vertical axis of the caster is required. This, or another method, is what I would like some ideas for.

The suggestion of using a solid state compass is interesting. More details please, is there any problem with magnetic interference from the DC motor magnets and/or the currents flowing through the motor wiring making the compass read wrongly? I had a full sized yacht in my youth and the magnetic compass would read wrongly if my bunch of keys were too near the binnacle.

The point of all this is that two DC motors of the same type will probably never run a precisely the same speed under all conditions of battery voltage and room temperature so robots of this nature will run in anything but a straight line.

Feedback is always better than dead reckoning so what shall we do?

Thanks for your continued interest.

is there any problem with magnetic interference from the DC motor magnets and/or the currents flowing through the motor wiring making the compass read wrongly?

Yes, of course. The compass module needs to be mounted as far from wiring, motors and ferrous materials as is practical, and then recalibrated in place.

For calibration, I use this procedure.

alanofstbreward:
Feedback is always better than dead reckoning so what shall we do?

Thanks for your continued interest.

It is interesting. I'm thinking that the focus will be on direction of the machine (object) relative to the direction of the centre of mass. The need to maintain that initial direction. The rear caster would be like a rudder. The rudder would need to steer the object in the correct direction (ie. straight ahead - relative to the original direction of the centre of mass). So maybe the thing to solve is the original thing...... a system for aiming the device in the correct direction. This could involve compass for keeping the device pointed roughly in the correct direction, and feedback systems that try to maintain same ground speed for all wheels etc. When we drive a car, our brain is smart enough to work out where to steer the car. If our machine had a system with our brain's capability, then that would be nice.

alanofstbreward:
So is this new? Can we do it? Or where can we see what someone else has already done?

Don't know, but it has the advantage of only needing one encoder, on the castor - it does
rely on the castor not skidding and having free-rotatation so it accurately indicates the turning.

The encoder resolution does need to be fairly high I think, compared to wheel comparison
technique which is basically as accurate as the matching of the two wheel diameters.

Maybe mount the caster to a pot?