Go to Post However, do not confuse faith in your ability to overcome challenging obstacles, with the difficulty of the obstacles themselves. - Joe G. [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-02-2014, 08:27
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Arm Position Control

Our team has a motor driven arm mechanism that rotates around an axis and has a potentiometer for feedback.

The arm is fairly heavy and unbalanced, and it's range of motion is significant (180deg, give or take a bit). Since the torque required to counteract gravity varies with the angle of the arm, it seems like the simplest form of PID control is not appropriate (ie: directly driving the motor from the PID constants and potentiometer input).

I've kicked around a few different ideas, but I'm not experienced enough with controls to know a good solution when I see one. All of my ideas hinge on the idea that the torque needed to counter-act gravity at a given angle is the cosine of the angle multiplied by the torque required at 0deg (please correct me if this is wrong )

So here are the different approaches I have considered:

1) Multiplying the output of a PID loop tuned for the 0deg position before it is sent to the motor. Either
motor_output = PID_output * cos(theta) //working against gravity
motor_output = PID_output - (PID_output * cos(theta)) //when assisted by gravity
(We will likely have special cases to handle angles close to 90deg when the setpoint is not 90deg, these can be ignored)

2) Using the feed-forward (F) term of the PID loop, where the reference F(0deg) is the force required to maintain a position of 0deg, and constantly updating the F term based on the current position (or possibly target position):
F = F(0deg) * cos(theta) //Different PID values would remain unchanged with angle

3) Use discrete sets of PID constants at different angles, each tuned for operating within a particular range of the full swing of the arm, for each direction, and each load requirement.

Which of these approaches makes the most sense? Is there a better method that I haven't thought of?

I've implemented case 1 (but cannot test yet), although I'm beginning to consider case 2 after learning how the F term is used.

I'm also a little curious what the best method for minimizing I-term wind-up, my plan is to simply disable the I term until we've approached the set-point, but I'm curious how others typically handle this.

Last edited by DjScribbles : 07-02-2014 at 08:31.
  #2   Spotlight this post!  
Unread 07-02-2014, 08:58
Bpk9p4's Avatar
Bpk9p4 Bpk9p4 is offline
Registered User
FRC #1756
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Illinios
Posts: 273
Bpk9p4 is on a distinguished road
Re: Arm Position Control

Have you considered using a velocity control PID. This will attempt to keep a constant velocity of your arms
  #3   Spotlight this post!  
Unread 07-02-2014, 09:01
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Arm Position Control

Is there a way that you could counter balance your arm? If it is possible that will make the tuning of the PID that much easier since the motor will only need to move the arm and not the weight of it. We've used surgical tubing to counter balance arms in previous years, including this year.
  #4   Spotlight this post!  
Unread 07-02-2014, 09:22
JamesCH95's Avatar
JamesCH95 JamesCH95 is offline
Hardcore Dork
AKA: JCH
FRC #0095 (The Grasshoppers)
Team Role: Engineer
 
Join Date: Dec 2004
Rookie Year: 2001
Location: Enfield, NH
Posts: 1,832
JamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond repute
Re: Arm Position Control

I would strongly encourage you to count-balance your arm with springs of some sort.

I'll bet there's an easy way to have the spring force vary with angle such that it almost always directly counter-acts gravity.
__________________
Theory is a nice place, I'd like to go there one day, I hear everything works there.

Maturity is knowing you were an idiot, common sense is trying to not be an idiot, wisdom is knowing that you will still be an idiot.
  #5   Spotlight this post!  
Unread 07-02-2014, 09:28
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Arm Position Control

There are a couple ways you could do this:

-First off, look at how much friction there is in the arm. For a low-range-of-motion thing like a 180deg arm, I actually recommend a bit of friction. Our 2013 arm had an aluminum shaft pressed into a delrin block as the final bearing. We could have done ball bearings or needle bearings, but the added friction helped the control loops stabilize (and they had more than enough torque to do it, since we also hung with it).

-Second, look at your counterforce. Always counterforce. There are a lot of ways to do it.

-Third, look at your software. A basic PID control will probably work but not be optimal at all positions (As you said). There are a few ways to get around this:

-Gain Scheduling. You would have a no-gravity and peak-gravity gainset (kP,kI,kD) and blend them with the angle. This should work fairly well

-Feed Forward Gravity - You find the motor power to hold the arm at peak gravity (and assume it's 0 at no-gravity) and multiply it by sin or cos of theta, then add it in.

-In general, if you know exactly what you want from a control-loop steady state, you should add it in as a feed forward term. Then the PID only has to handle the slop.


-In the context of an arm, velocity PID is useless. It would not provide the desired response at all.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #6   Spotlight this post!  
Unread 07-02-2014, 10:04
Alchemy99's Avatar
Alchemy99 Alchemy99 is offline
Registered User
AKA: Josh Cote
FRC #3141 (Team Alchemy)
Team Role: Leadership
 
Join Date: Jun 2009
Rookie Year: 2007
Location: Torrington, CT
Posts: 29
Alchemy99 is an unknown quantity at this point
Send a message via AIM to Alchemy99 Send a message via Yahoo to Alchemy99
Re: Arm Position Control

My team is having this same issue, i think.

I am trying to tune a PID loop to control angular position of the arms. It should have been simple.

We are using an Encoder on the shaft for Angular measurement.

It should have been simple feed the input of the PID loop the encoder, set max and min outputs to 1, -1. and it should have worked. but the gains are extreamly low, 0.015 for P. for it not to overshoot. than when any load is applied it slows way down.

My experience with pid loops is limited. but no mater the load it will do its best to get to the setpoint repeatedly, same speed, time etc. within the capabilities of the motor.
__________________
  #7   Spotlight this post!  
Unread 07-02-2014, 10:08
JamesCH95's Avatar
JamesCH95 JamesCH95 is offline
Hardcore Dork
AKA: JCH
FRC #0095 (The Grasshoppers)
Team Role: Engineer
 
Join Date: Dec 2004
Rookie Year: 2001
Location: Enfield, NH
Posts: 1,832
JamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond repute
Re: Arm Position Control

I'll add (how did I forget this!?) that the last time we used PID control for an arm we counter-balanced it with a pneumatic cylinder using flow control to dampen the arm's motion and a secondary regulator to fine-tune the cylinders force and easily bleed off pressure when the arm was compressing the cylinder. The PID loop then became a P-only loop with very good control, no I or D to tune or deal with at all, and thus no wind-up issues.
__________________
Theory is a nice place, I'd like to go there one day, I hear everything works there.

Maturity is knowing you were an idiot, common sense is trying to not be an idiot, wisdom is knowing that you will still be an idiot.
  #8   Spotlight this post!  
Unread 07-02-2014, 13:39
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by apalrd View Post
-Third, look at your software. A basic PID control will probably work but not be optimal at all positions (As you said).
We've done a lot of single jointed arms that are not counter-balanced, and have always been happy with simple PID control. This does depend significantly on the mechanical design of your arm. Always start with the easiest solution and then decide if it needs more work rather then jumping to a more complicated solution based on theory.
  #9   Spotlight this post!  
Unread 07-02-2014, 14:44
Mr B's Avatar
Mr B Mr B is offline
Registered User
AKA: Andy Bradley
FRC #0233 (The Pink Team)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 1998
Location: Cocoa, FL
Posts: 29
Mr B is a name known to allMr B is a name known to allMr B is a name known to allMr B is a name known to allMr B is a name known to allMr B is a name known to all
Re: Arm Position Control

We've used trigonometry in the past (essentially sin of the angle - with zero degrees being vertical) with some success, but that was mainly for steady state offset.

In this case a torsion spring would work, but so would latex tubing (which we've also used with success... way more often than I'd admit). The nice thing about bungee is that you can always add more if it isnt pulling enough.
  #10   Spotlight this post!  
Unread 07-02-2014, 14:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by Mr B View Post
In this case a torsion spring would work, but so would latex tubing...
The arm swings from 0 to 180 degrees. How would you mount the latex tubing?


  #11   Spotlight this post!  
Unread 07-02-2014, 15:00
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by Ether View Post
The arm swings from 0 to 180 degrees. How would you mount the latex tubing?


I'd have to see the layout of the arm, but there are ways it could be done.
  #12   Spotlight this post!  
Unread 07-02-2014, 15:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by notmattlythgoe View Post
I'd have to see the layout of the arm, but there are ways it could be done.
If there were a stationary attachment point located vertically above the pivot, and of sufficient height, one could secure the tubing to that point and to the arm. That would provide minimum torque at noon and maximum torque (of opposite signs) at 3 and 9 o'clock.

Barring such an arrangement, what other options do you have in mind?


  #13   Spotlight this post!  
Unread 07-02-2014, 15:33
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by Ether View Post
If there were a stationary attachment point located vertically above the pivot, and of sufficient height, one could secure the tubing to that point and to the arm. That would provide minimum torque at noon and maximum torque (of opposite signs) at 3 and 9 o'clock.

Barring such an arrangement, what other options do you have in mind?


Instead of 1 right above it 2 on either side level with the rotation point. It wouldn't be as optimal as a point right above it but it would help a bit. As you move those points higher they help more and more.
  #14   Spotlight this post!  
Unread 07-02-2014, 15:39
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by notmattlythgoe View Post
Instead of 1 right above it 2 on either side level with the rotation point. It wouldn't be as optimal as a point right above it but it would help a bit. As you move those points higher they help more and more.
If they are level with the rotation point (by this I assume you mean the arm pivot), they provide zero torque at the extremes (where it is most needed).


  #15   Spotlight this post!  
Unread 07-02-2014, 15:36
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: Arm Position Control

Quote:
Originally Posted by Ether View Post
If there were a stationary attachment point located vertically above the pivot, and of sufficient height, one could secure the tubing to that point and to the arm. That would provide minimum torque at noon and maximum torque (of opposite signs) at 3 and 9 o'clock.

Barring such an arrangement, what other options do you have in mind?
I think we can assume a suitable attachment point vertically below the pivot. A short extension on the opposite side from the arm would provide a way to use a downward force to counterbalance it.

A sprocket-and-chain scheme can put a "virtual pivot point" anywhere convenient.
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


All times are GMT -5. The time now is 02:32.

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