Go to Post If the fan club goes away, or isn't always right in your face doing things the public sees, does that mean the reason for the fan club is gone? Nope. - Elgin Clock [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
  #16   Spotlight this post!  
Unread 20-01-2007, 20:39
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Potentiometer PID

Any 100K Pot will work for most arms a single turn will work. Digikey.com and Mouser.com have parts for 100K 10 turn but you loose some resolution using a 10 turn. I haven't found any 2 turn 100K pots.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #17   Spotlight this post!  
Unread 20-01-2007, 22:56
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,019
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Potentiometer PID

We had some awful results 2 years ago with 100k pots on the robot. Last year we used 5k pots on the robot and had great success. I attibute the difference to noise and a close match to the input impedance of the ADC circuit.

Am I crazy?

Don
__________________

I am N2IRZ - What's your callsign?
  #18   Spotlight this post!  
Unread 21-01-2007, 02:41
NextPerception NextPerception is offline
Sleep-Deprived
AKA: Matt
FRC #0437 (Richardson Robotics)
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2005
Location: Richardson, TX
Posts: 69
NextPerception has a spectacular aura aboutNextPerception has a spectacular aura aboutNextPerception has a spectacular aura about
Send a message via AIM to NextPerception
Re: Potentiometer PID

instead of

Code:
      if ( Button1 == 1 )
      {
            Target = 200 ;
      }
      else if ( Button2 == 1 )
      {
            Target = 400 ;
      }
      else if ( Button3 == 1 )
      {
            Target = 600 ;
      }
i would do this

Code:
      if ( (Button1 * Button2) + (Button2 * Button3) + (Button3 * Button1) + ( Button1 + Button2 + Button3 ) == 1 )   //prevents crazy values if more than one button is pressed and keeps the same value if no button is pressed
      {
            Target = (Button1 * 200) + (Button2 * 400) + (Button3 * 600)
      }
this just makes more sense to me and I just post it here for any like minded people out there. I think it takes a little less cpu time too.
__________________
What is this S - L - E - E - P you speak of?
Battlebots - My Robotics Website


Last edited by NextPerception : 21-01-2007 at 02:55.
  #19   Spotlight this post!  
Unread 21-01-2007, 02:43
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by Don Rotolo View Post
We had some awful results 2 years ago with 100k pots on the robot. Last year we used 5k pots on the robot and had great success. I attibute the difference to noise and a close match to the input impedance of the ADC circuit.

Am I crazy?

Don
You aren't crazy. Those ADC inputs on the RC are rated for not much more than 2.5K. You should use a 1 or 2K pot when connecting to the RC. For the OI you'll need a 100K pot.

Bourns makes the "good stuff." Avoid radioshack's potentiometers .
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
  #20   Spotlight this post!  
Unread 21-01-2007, 11:03
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by NextPerception View Post
i would do this

Code:
      if ( (Button1 * Button2) + (Button2 * Button3) + (Button3 * Button1) + ( Button1 + Button2 + Button3 ) == 1 )   //prevents crazy values if more than one button is pressed and keeps the same value if no button is pressed
      {
            Target = (Button1 * 200) + (Button2 * 400) + (Button3 * 600)
      }
this just makes more sense to me and I just post it here for any like minded people out there. I think it takes a little less cpu time too.
It makes sense if you're averse to using procedural programming and prefer functional programming. The logic behind your code gives the same result as the one using if statements, but the reason for doing it that way is obscure to anyone encountering it cold.

And it takes a lot more time to do it your way. A few comparisons and branches are faster than many multiplications and additions. Note that the original code never does more than three comparisons and one assignment. Yours always does six multiplications, thirteen additions, and one comparison. It would be instructive to compile both alternatives and compare the generated assembly language code in the listing file.

As an aside, wouldn't it work just as well to simplify the condition to this?
Code:
if ( ( Button1 + Button2 + Button3 ) == 1 )
  #21   Spotlight this post!  
Unread 21-01-2007, 16:59
NextPerception NextPerception is offline
Sleep-Deprived
AKA: Matt
FRC #0437 (Richardson Robotics)
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2005
Location: Richardson, TX
Posts: 69
NextPerception has a spectacular aura aboutNextPerception has a spectacular aura aboutNextPerception has a spectacular aura about
Send a message via AIM to NextPerception
Re: Potentiometer PID

Quote:
Originally Posted by Alan Anderson View Post
It makes sense if you're averse to using procedural programming and prefer functional programming. The logic behind your code gives the same result as the one using if statements, but the reason for doing it that way is obscure to anyone encountering it cold.

And it takes a lot more time to do it your way. A few comparisons and branches are faster than many multiplications and additions. Note that the original code never does more than three comparisons and one assignment. Yours always does six multiplications, thirteen additions, and one comparison. It would be instructive to compile both alternatives and compare the generated assembly language code in the listing file.

As an aside, wouldn't it work just as well to simplify the condition to this?
Code:
if ( ( Button1 + Button2 + Button3 ) == 1 )
hahaha
wow. this is what no sleep does to you.
thanks for that.
maybe I just think weird or something
__________________
What is this S - L - E - E - P you speak of?
Battlebots - My Robotics Website

  #22   Spotlight this post!  
Unread 09-02-2008, 21:37
Chris1228 Chris1228 is offline
Registered User
FRC #1228
 
Join Date: Sep 2007
Location: Rahway, NJ
Posts: 22
Chris1228 will become famous soon enough
Re: Potentiometer PID

how do u get pot sensors to work on easy c?
  #23   Spotlight this post!  
Unread 11-02-2008, 13:30
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Potentiometer PID

The Analog Input block,

The Analog Input function block allows the user to define behavior based on signals from any analog sensor. Analog sensors provide a range of feedback with the range depending on the actual sensor being used. This generic input can be used with any Analog device of your choosing.
Attached Thumbnails
Click image for larger version

Name:	pot.JPG
Views:	45
Size:	10.1 KB
ID:	6253  
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 11-02-2008 at 13:37.
  #24   Spotlight this post!  
Unread 11-02-2008, 14:48
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,188
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by Joe Johnson View Post
*if you have a PID control you are living on the edge if you don't have routines in your C code called "JustEnabled" and "justDisabled" You should have those routines anyway but you REALLY need them with PID control. JJ
I can't agree more. We just call our controllers when the robot is enabled. Dead simple and works great.
  #25   Spotlight this post!  
Unread 11-02-2008, 15:28
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by NextPerception View Post
hahaha
wow. this is what no sleep does to you.
thanks for that.
maybe I just think weird or something
I think the same way... and so therefore there is no official programming mentor who actually looks over my code anymore (=

i would advise against using a pot for PID control, because the pot will always be returning to the same position, and the brush inside the pot will wear down on the resistive material, which would sacrifice the signal's validity. Im not saying that something like a joystick wouldnt do this, but a joystick is a lot more replaceable than a robot.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #26   Spotlight this post!  
Unread 15-02-2008, 18:33
Mike AA's Avatar
Mike AA Mike AA is offline
Programmer and Mentor
AKA: Mike Aalderink
FRC #3458 (Code Blue)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Holland, Mi
Posts: 698
Mike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to behold
Send a message via MSN to Mike AA
Re: Potentiometer PID

I guess I am comfused and I have been trying to get an idea on all this. I wish to be able to move the joystick to say a value of 200, then I want on the robot a motor to turn an arm until it also reads another pot at the same angle.

Example:
Joystick tilted slightly forward, thus arm tilted slightly down.

I cant figure out do I use a PID loop or do I just get creative with some other code or use a table? In the past I would just use limit switched but II want better control this year and a more varied location.

-Mike
  #27   Spotlight this post!  
Unread 15-02-2008, 19:05
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by Mike AA View Post
I wish to be able to move the joystick to say a value of 200, then I want on the robot a motor to turn an arm until it also reads another pot at the same angle.
Use the sample code that has been bandied about in this thread, but instead of setting Target with conditionals and hardcoded values, just set Target equal to the value coming in from your joystick axis, or some function of that value (for instance, target=p1_y*4; would give you access to the full range of the pot). Does that make sense?
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #28   Spotlight this post!  
Unread 15-02-2008, 23:03
Mike AA's Avatar
Mike AA Mike AA is offline
Programmer and Mentor
AKA: Mike Aalderink
FRC #3458 (Code Blue)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Holland, Mi
Posts: 698
Mike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to behold
Send a message via MSN to Mike AA
Re: Potentiometer PID

Do I have to use Kevin's ADC code added somewhere within my code or could I just copy the code from Dustinb_3?

Any help is greatly appreciated the robot is about done but we've been busy on that and waited til the last minute to work on completing the code.

-Mike
  #29   Spotlight this post!  
Unread 15-02-2008, 23:18
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Potentiometer PID

Quote:
Originally Posted by Mike AA View Post
I guess I am comfused and I have been trying to get an idea on all this. I wish to be able to move the joystick to say a value of 200, then I want on the robot a motor to turn an arm until it also reads another pot at the same angle.

Example:
Joystick tilted slightly forward, thus arm tilted slightly down.

I cant figure out do I use a PID loop or do I just get creative with some other code or use a table? In the past I would just use limit switched but II want better control this year and a more varied location.

-Mike
Do a simple proportional control...

Code:
arm_motor = (arm_pot - p1_y) * 50;
dont multiply by 50, multiply by something that actually makes the arm move smoothly.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
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
Potentiometer help Unholy Programming 4 07-02-2006 17:48
Potentiometer Help! thoughtful Programming 4 18-02-2005 08:21
coding a potentiometer incognito_NICK Programming 5 14-02-2005 15:56
Potentiometer Joshua May Technical Discussion 8 22-05-2004 19:51
Potentiometer Theory Ulibrium Technical Discussion 6 25-01-2002 21:16


All times are GMT -5. The time now is 13:47.

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