Quote:
|
Originally Posted by Phil_Lutz
If the servo is "twitching" just on the startup of the code then you are okay.
This is just the servo going to it's initial position.
If the Servo is always twitching it might be a low backup battery.
For a transmission shifter you are best to have it on one switch.
0=low gear, 1=high gear
Also, make sure to stop the motorfor a few loops before shifting, and start the motors back up (to selected speed) after th3e servo has had a chance to move.
The psuedocode would look like this
Code:
// Motor speed 160 In Low Gear
Shift button changed // have static store last value
Store Motor Speed // in static for later use
Stop Motor // 127, neutral
Move Servo // 0-254 or 254-0
count loops for 10 (.2 secs, servo moves full throw in .11)
Start Motor
// Shift on the fly, You got to love it
Setup #defines to track the various points in the shift and switch/case through the shift process.
Hope this helps.
Phil
|
That would be ideal, except im not sure that the motors will be still and if they are moving, even if they are being backdrive, it isnt a good idea to shift. I'm afraid if you put something in like this then someone may try to shift while the robot is being pushed or maybe it will keep rolling for longer than expected, etc. Ideally, you could have the shifter only work if an encoder reports no rotation, but we dont have time for an encoder, so i think we will rely on drivers watching the robot and being smart about shifting. (kinda like not shifting without pressing the clutch...)