View Single Post
  #3   Spotlight this post!  
Unread 05-04-2005, 18:44
dm0ney's Avatar
dm0ney dm0ney is offline
Will Code For Food (Food Optional)
AKA: Deepak Mishra
None #0217 (The ThunderChickens)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Shelby Twp., MI
Posts: 48
dm0ney will become famous soon enough
Send a message via AIM to dm0ney
Re: Motor Control Systems

Quote:
Originally Posted by Astronouth7303
What are people doing to control their motors? Specifically, those dealing with arms and positions (not drive).



What I have going is a set-up that reads an array of structures containg pointers to the PWM values & input variables, analog in for the pot, and all the constants needed. Just before the call to putdata(), this is called to handle all the inputs. This same code is used for both autonomous and user modes.

There is also a debugging advantage to this: If part of arm doesn't work, I can point to another part and say, "That works; the code is fine," because it's the same code with different values.
That's pretty close to what we use for our arm and joint.
We have a tcr_joint struct that takes in:
pointer to pwm output, pointer to joystick axis, pot ana_in, current pos, servo gain, servo flag, min pot position, max pot position, pot counts per degree travel numerator, pot counts per degree travel denominator, pot position for zero degrees.

We have the counts per degree (integer math as well) so we can set degrees using our scripting interface. The min and max are limits before the hard physical stop.

We actually servo to position, being called after the joyaxes are updated but before put data. We have both a gas shock on our arm and the globe motor while the slider has dual windows (no backdrive).
This allows us to set a position in degrees and once there, the motor will keep the arm at that degree measure, not falling when a tetra is placed or otherwise.

Structs are the way to go though.
__________________

Alumni
Team #217, The ThunderChickens



Student, Class of 2009
California Institute of Technology