Posted by Joe Johnson. [PICTURE: SAME | NEW | HELP]
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.
Posted on 11/8/2000 1:57 PM MST
In Reply to: Re: 4x4 software differential posted by James on 11/8/2000 12:45 PM MST:
If your steering is not a spring return to center mechanism, I don’t think your method will work.
Basically your drive motors need to have their throttle adjusted up or down based on steering POSITION, not based on the amount of throttle the steering motor sees (PWM3).
If you have a spring return to center steering, then there is a rough correlation between your steering angle and the voltage on the steering motor (assuming your steering fork geometry is more or less just a simple pivot with no ‘caster’ effect).
I really think that in order to get your system to work right you should put the steering angle into a feedback loop. Have the X pot on the joystick provide the ‘desired’ steering angle. Have the ‘actual’ angle be measured via a pot onboard your robot. Compute the ‘error’ (be careful about 16 bit unsigned math – which you seemed to at least know a bit about from you earlier posting). Multiply the ‘error’ by a gain (actually you will probably want to multiply it by a gain constant and divide it by another gain constant so that you can get fractional gains * 3 / 2 => 1.5). Then add or subtract this scaled error from 127 to get your output to the steering motor.
This is ‘proportional feedback’ meaning that the amount of throttle applied to the motor is proportional to the amount of error. In general, higher gains are desirable, but if you make the gain too high, the system will go unstable.
Once you have a steering mechanism whose steering angle tracks the position of the joystick’s X pot, you can use some sort of left/right differential throttle mechanism.
For my money, I suppose that you could do much worse than just adding (SteeringAngle-127)*C1/C2 to one wheel’s throttle and subtracting the same amount from the other.
You will have to deal with some overflow/underflow issues. Below is one way to make sure your result does not underflow or overflow:
PWM1 = $8000 + BaseThrottle - ((SteeringAngle-$7F)*C1/C2) MIN $8000 - $8000
PWM2 = BaseThrottle + ((SteeringAngle-$7F)*C1/C2) MAX $FF
Note: the above assumes that Steering Angle is greater than or equal to 127. This insures that (SteeringAngle-$7F) is a positive number. Also, $7F = 127 and $FF = 255.
IMHO, using hexadecimal often makes your PBASIC life more livable, others disagree. To some extent this is just a matter of style.
For what it’s worth.