Go to Post There was a manual? - Taylor [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 15-02-2008, 23:41
Hazmatt's Avatar
Hazmatt Hazmatt is offline
Registered User
AKA: Matt
FRC #2645 (PowerSurge)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Muskegon
Posts: 51
Hazmatt will become famous soon enoughHazmatt will become famous soon enough
Potentiometer arm control

Hello again. I've finally got pots mounted on my arm but I need a little help adapting them to my code. The arm has two pivot points, with a potentiometer mounted at each. The goal of my program is to make the motors move to keep the arm level until it's above the overpass at which point I'll press a button and have the ball get "flipped" over. I'm sort of stuck, and if someone could give me a hint on how to achieve this then that would be great.

Here's a picture of what's happening:
Attached Thumbnails
Click image for larger version

Name:	robot.JPG
Views:	179
Size:	26.5 KB
ID:	6287  
  #2   Spotlight this post!  
Unread 15-02-2008, 23:54
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 arm control

You understand how to make a joint seek to a certain position, yes? The next step would be to find a list of pairs of joint values between (350,900) and (600,350), maybe 20 or 30 clicks apart, all of which keep the ball level. Then instead of going directly to the target, you instead target each intermediate point until you reach your goal. I'm having a little bit of trouble putting this into words... does it 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

_
  #3   Spotlight this post!  
Unread 16-02-2008, 00:04
Hazmatt's Avatar
Hazmatt Hazmatt is offline
Registered User
AKA: Matt
FRC #2645 (PowerSurge)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Muskegon
Posts: 51
Hazmatt will become famous soon enoughHazmatt will become famous soon enough
Re: Potentiometer arm control

Yes, I understand what you're saying, but is there a way to put these numbers into a function to tell me what the wrist position should be at any given arm position? I would rather not program 30 different positions if I didn't have to...
  #4   Spotlight this post!  
Unread 16-02-2008, 00:08
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Potentiometer arm control

Remember Algebra I? Use that to make an equation that will work. It's just like x and y components. Hopefully that helps. (Find the slope using (y2-y1)/(x2-x1), then use y1 = m(x1) + b) That should get you setup. At least, I think that should work.

EDIT: Since I really love math, I had to figure it out myself to be content .

Wrist Position = (-11/5)Arm Position + 1670
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901

Last edited by RyanN : 16-02-2008 at 00:13.
  #5   Spotlight this post!  
Unread 16-02-2008, 00:11
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 arm control

I'm pretty confident that a linear approximation should do nicely... in terms of real angles (not pot values), you're trying to make it so that theta1+theta2 is always constant. How does this look?
Code:
int wristPos(int elbow)
{
  return elbow*(350-900)/(600-350)+1670;
}
Calculate the slope of the line, multiply it by x, add the intercept, and that gives you y.
__________________
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

_

Last edited by jgannon : 16-02-2008 at 00:13.
  #6   Spotlight this post!  
Unread 16-02-2008, 00:27
Hazmatt's Avatar
Hazmatt Hazmatt is offline
Registered User
AKA: Matt
FRC #2645 (PowerSurge)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Muskegon
Posts: 51
Hazmatt will become famous soon enoughHazmatt will become famous soon enough
Re: Potentiometer arm control

And now y is the number I'm seeking, correct?
  #7   Spotlight this post!  
Unread 16-02-2008, 00:30
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Potentiometer arm control

Quote:
Originally Posted by Hazmatt View Post
And now y is the number I'm seeking, correct?
Pretty much

Code:
wrist_pos = (-11/5)*arm_pos + 1670;
I think that should work in your code without any problems.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #8   Spotlight this post!  
Unread 16-02-2008, 00:39
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 arm control

Quote:
Originally Posted by RyanN View Post
Pretty much

Code:
wrist_pos = (-11/5)*arm_pos + 1670;
I think that should work in your code without any problems.
Not quite... (-11/5) will always evaluate to -2. Try this instead:
Code:
wrist_pos = -11*arm_pos/5 + 1670;
__________________
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

_
  #9   Spotlight this post!  
Unread 16-02-2008, 00:40
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Potentiometer arm control

Quote:
Originally Posted by jgannon View Post
Not quite... (-11/5) will always evaluate to -2. Try this instead:
Code:
wrist_pos = -11*arm_pos/5 + 1670;
It will not try to use floating point or just use that fraction and multiply it? I thought that would work.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #10   Spotlight this post!  
Unread 16-02-2008, 00:43
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 arm control

Quote:
Originally Posted by RyanN View Post
It will not try to use floating point or just use that fraction and multiply it? I thought that would work.
-11 and 5 are both integers, so it will do integer division. It might work if you explicitly made one of them a float (i.e. -11.0), but floating point is a mess on these controllers, so my integer solution is a pretty reasonable approach.
__________________
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

_
  #11   Spotlight this post!  
Unread 16-02-2008, 00:44
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Potentiometer arm control

All right, I'll also keep that in mind in the future.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #12   Spotlight this post!  
Unread 16-02-2008, 02:00
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 100
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Potentiometer arm control

Quote:
Originally Posted by RyanN View Post
It will not try to use floating point or just use that fraction and multiply it? I thought that would work.
As already mentioned, integers do integer method. In order to maintain precision with integer math, you want to do division with the largest numbers possible. Division will always loose precision.

What was shown will work, but you might even get a little better precision by doing...

wrist_pos = (-11*arm_pos + 1670*5) / 5;

This maximizes the numerator before dividing by the denominator.
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #13   Spotlight this post!  
Unread 16-02-2008, 03:18
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 arm control

Quote:
Originally Posted by duane View Post
What was shown will work, but you might even get a little better precision by doing...

wrist_pos = (-11*arm_pos + 1670*5) / 5;

This maximizes the numerator before dividing by the denominator.
Can you explain how that would work? I'm reasonably confident that you would get exactly the same result for any given value of arm_pos (discounting any overflow issues).
__________________
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

_
  #14   Spotlight this post!  
Unread 19-03-2008, 14:29
Ziaholic's Avatar
Ziaholic Ziaholic is offline
Elec/SW Mentor
AKA: Marc
FRC #1164 (Project NEO)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2002
Location: Las Cruces, NM
Posts: 194
Ziaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the rough
Re: Potentiometer arm control

Quote:
Originally Posted by jgannon View Post
Can you explain how that would work? I'm reasonably confident that you would get exactly the same result for any given value of arm_pos (discounting any overflow issues).
They're just trying to maximize the value in the numerator, prior to doing the division, which will truncate the decimals back to an integer. The larger the numerator, the less of a truncation error.

Using ArmPosition = 501, here's what you'd get with all 3 methods:

First Method:
wrist_pos = -11/5*arm_pos + 1670 = (-2)*501+1670 = 668

2nd method:
wrist_pos = -11*arm_pos/5 + 1670 = (-5511)/5 + 1670 = -1102+1670=568

3rd method:
wrist_pos = (-11*arm_pos + 1670*5 )/ 5 = 2850/5 = 567.8 = 567
__________________
----
There are 10 types of people. Those who understand binary, and those that do not.
Team #1164 - Project NEO Robotics
  #15   Spotlight this post!  
Unread 01-04-2008, 21:09
mikeqfl's Avatar
mikeqfl mikeqfl is offline
Registered User
FRC #0832 (Chimera)
Team Role: Engineer
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Roswell
Posts: 5
mikeqfl is an unknown quantity at this point
Re: Potentiometer arm control

A little off subject but could anyone recommend a model of Pot to use for this type of arm control. We had an arm last year and we used pure manual control , it was very jumpy to say the least. Trying to figure what type of pot and how to mount it on the arm to pick up position. Pre planning for next year I guess. Pictures of a mounting would be nice as well. Thanks.
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
Mounting an arm potentiometer Hazmatt Technical Discussion 18 12-02-2008 21:53
P.I.D. Control for the arm skibum2490 Programming 8 27-02-2007 11:21
Slave Control Arm aaronD341 Control System 1 26-04-2005 17:13
2-Segment Arm Control Orborde Programming 1 20-01-2005 01:40
Neural Control of Robot Arm Leo M Math and Science 2 29-03-2004 13:46


All times are GMT -5. The time now is 01:46.

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