Go to Post Of course just because there is are existing solutions to a problem does not mean there aren't better ones. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-04-2005, 19:21
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Motor Control Systems

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.
  #2   Spotlight this post!  
Unread 05-04-2005, 03:39
ace123's Avatar
ace123 ace123 is offline
Registered User
AKA: Patrick Horn
FRC #0008 (Paly Robotics - http://robotics.paly.net/)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 50
ace123 has a spectacular aura aboutace123 has a spectacular aura about
Send a message via AIM to ace123
Re: Motor Control Systems

Our team created a large abstraction library (user_io.c/h,user_motors.c,user_controls.c) which basically has stuff like get/set_motor_speed and get/set_motor_pos and update_input/output(), which work on all motors. The arm routes though PID (position) and velocity, but others just simply go directly to the motors (with limiting, overflow and deadband checks).

In come cases, you can use position PID with the motors to make it line up correctly. My team was planning on using PID for the arm and motors (we had it working perfectly) until they made a last-minute decision not to attach or calibrate pots.

Although we had a large abstraction library, we could not use most of it due to a robot lacking some small parts. The motors library got too complicated, and I wasted an hour of time due to some default deadband value of 127 in the middle of the arm code.

Basically, either KISS (Keep it simple) or else heavily test every part of it, make easy-to-change numbers, and have #ifdefs to disable code when, for example, you are suddenly without pots.

One thing that helped a lot was the reuse of code (just call update_inputs() at the beginning of the auton and main loop, and update_outputs() at the end of the loops, and share arm and drive code: an arm motor is a motor and a drive motor is a motor, and drive can have position, and arm can have velocity.) If a value changes at last minute, then just edit it in one place, and not everywhere you use the motor.

For things like arm grabbers, pneumatics, etc., just make a simple flag in a controls structure which reads from the control board or the auton loop. Then just use a timer and set a relay to 1 or 0 or a motor to forward or backward based on that timer.
__________________
-Patrick Horn, Paly Robotics

Check out the space simulator called Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played Wing Commander, or especially Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods: Privateer Gemini Gold and Privateer Remake!
I'm working on adding multiplayer support this year...
  #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


  #4   Spotlight this post!  
Unread 05-04-2005, 19:35
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: Motor Control Systems

Our PID started off in OOP fashion, with arrays of pointers to structs representing the motor subsystems, and pointer to functions representing class member functions. It soon fell apart when we started getting memory corruption (garbled printf, Code Error light)

In the end, I reverted back to traditional, procedural C with minimal functions in heavy processing routines (but auton still remains very modular!)


I rest my case that abstraction is still "not there yet" for micro programming, especially with the lack of a properly optimizing compiler (not saying MCC is a bad compiler -- just not 'tough enough' to handle complex C).
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drive Systems Alex Cormier Technical Discussion 3 11-01-2005 16:07
Versioning systems wun Programming 19 05-11-2004 16:29
Inertial navigation systems Greg Needel Technical Discussion 21 02-02-2004 02:54
Full list of teams & competitions archiver 2001 14 24-06-2002 00:52
Robot electrical systems rules Morgan Jones Rules/Strategy 5 06-01-2002 00:50


All times are GMT -5. The time now is 00:17.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi