View Single Post
  #7   Spotlight this post!  
Unread 25-02-2004, 11:32
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Exclamation Re: Using a switch to control a PWM

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...)
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award