|
Re: steering wheel help FIRST Team 2044
There are a number of ways to work this. Here is one solution:
1. Install a gyro to give you heading.
2. Does your wheel really turn 180 degrees? No matter, moving it from neutral to full right or left will give you a value of 127 to 254, or 127 to 0. so you need to convert from the PWM value to degrees which will give a ratio of 127/180.
3. Now that your program knows what heading the steering wheel wants, put in a simple proportional control to turn to that heading (pseudo code):
error = (currentHeading - wheelHeading);
drive (RightSide-error/2, LeftSide+error/2);
As a first approximation this should work, but probably not very well. You wil have to fiddle with it and acount for gyro drift etc. to get it working well.
|