Go to Post It would be interesting to be able to take robots from multiple years and invent new games they can play together (Calvin Ball). - Mark McLeod [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 21 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 23-01-2015, 19:30
wildaburk3160 wildaburk3160 is offline
Registered User
FRC #3160
 
Join Date: Sep 2013
Location: Grove, OK
Posts: 50
wildaburk3160 is an unknown quantity at this point
Re: PID Help

Quote:
Someone decided that for your system, you needed accuracy of ~+/- 0.75 degrees. Since you have a resolution of almost the same, you need to be perfect.
Alright, after another talk with a mentor, it's been clarified that we don't need such exact precision. Our problem was that the motor was overshooting by over 20 pulses at some points, then taking 5-10 seconds to readjust to a reasonable position. So, I will take some previous suggestions about tuning the PID so that we can get the motor returning to a more reasonable pulse count, perhaps +/- 5 pulses, without wildly missing the mark beforehand.
Reply With Quote
  #17   Spotlight this post!  
Unread 23-01-2015, 20:19
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,636
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID Help

Quote:
Originally Posted by wildaburk3160 View Post
Alright, after another talk with a mentor, it's been clarified that we don't need such exact precision. Our problem was that the motor was overshooting by over 20 pulses at some points, then taking 5-10 seconds to readjust to a reasonable position. So, I will take some previous suggestions about tuning the PID so that we can get the motor returning to a more reasonable pulse count, perhaps +/- 5 pulses, without wildly missing the mark beforehand.
This sounds like your system is under-damped. Either add a mechanical dampening as suggested above, or (better) tweak your "D" (derivative) value to digitally dampen the system.

Using the analogy of an automobile suspension
  • P tells how strong your spring is. That is, how fast does the pushback grow as you get farther from the set point?
  • D tells how dampening your shock absorbers are. A large magnitude for D will help the values settle quickly.
  • I doesn't have a good auto analogy unless you're a low rider with adjustable lift built into the suspension. I helps correct systems that settle out somewhere other than the set point. I usually think of it as the "Kentucky Windage" term.

Last edited by GeeTwo : 23-01-2015 at 20:34. Reason: PID description added
Reply With Quote
  #18   Spotlight this post!  
Unread 27-01-2015, 21:06
wildaburk3160 wildaburk3160 is offline
Registered User
FRC #3160
 
Join Date: Sep 2013
Location: Grove, OK
Posts: 50
wildaburk3160 is an unknown quantity at this point
Re: PID Help

Okay, so I've gotten to the point, with some tuning, that I can get the motor to get to a set point in a good amount of time, but with a maximum error of six, sometimes eight, pulses. With one pulse ~ .73 degrees, this could lead to the wheel being almost six degrees off center.

Since we are planning to run four motors, each with their own encoder and PID loop, this could result in motors possibly being twelve degrees off collectively, and working against each other, rendering a swerve system useless.

My mentor seems to think that the reason the motor can't get to the setpoint in either a reasonable amount of time or a reasonable range (these two seem to be mutually exclusive) because the PID calculates the output out to a very long decimal, but the process variable (encoder pulses) is only giving it integers to work this.

I disagree.

I think that as someone has earlier replied, it is a resolution problem. With .73 degrees per pulse, it gives us very limited margin for error. I believe that this problem could be solved by the use of a potentiometer, a much more precise analog sensor, rather than an encoder, a digital sensor.

So, should we go ahead and try a potentiometer, or am I doing something incorrectly in the tuning of the PID?

Thank you for your continued input.
Reply With Quote
  #19   Spotlight this post!  
Unread 27-01-2015, 21:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,086
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: PID Help

Quote:
Originally Posted by wildaburk3160 View Post
So, I will take some previous suggestions about tuning the PID
Watch this video, especially at 9:03


Reply With Quote
  #20   Spotlight this post!  
Unread 29-01-2015, 20:32
wildaburk3160 wildaburk3160 is offline
Registered User
FRC #3160
 
Join Date: Sep 2013
Location: Grove, OK
Posts: 50
wildaburk3160 is an unknown quantity at this point
Re: PID Help

This video refers to the gains as Kp, Ki, and Kd. In the PID gains cluster connected to the PID.vi, the I and D terms are labeled Ti and Td, as in derivative time and integral time.

So, are these functioning the same as an Ki and Kd, or are they functioning in some other way?

On another note, I went through the Zeigler-Nichols process described in the video, and after calculations, the Kd I was supposed to have came out to be ~ .0004, which is beyond the three decimal accuracy of the PID gains control. I ended up having to settle for .001.

After some testing, the minimum overshoot averaged around 4 pulses, with varying amounts of greater overshoot. This could have been caused by having to settle for a Td of .001 instead of .0004.

One thing mentioned in the video is sensor lag, where a sensor can't send pulses fast enough for the PID to process it correctly. Could there be an issue of the PWM cables not having a high enough frequency to keep up? Would an analog sensor be a viable fix to this supposed problem?

Last edited by wildaburk3160 : 29-01-2015 at 20:43.
Reply With Quote
  #21   Spotlight this post!  
Unread 29-01-2015, 20:34
wildaburk3160 wildaburk3160 is offline
Registered User
FRC #3160
 
Join Date: Sep 2013
Location: Grove, OK
Posts: 50
wildaburk3160 is an unknown quantity at this point
Re: PID Help

Also, after some design changes, there is another reduction and the resolution is now .48 degrees/pulse.
Reply With Quote
  #22   Spotlight this post!  
Unread 29-01-2015, 22:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,086
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: PID Help


Forgot you were using LabVIEW. It uses a different form of PID. Check the LabVIEW documentation.

Reply With Quote
  #23   Spotlight this post!  
Unread 29-01-2015, 23:06
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: PID Help

I do not know LabVIEW well, so this might already be what you are doing/the default behavior, but you should read your encoder in 4x decoding mode. This will effectively give you four times the encoder's CPR in resolution.

I doubt very much that you are experiencing significant sensor lag. Quadrature encoders are nearly instantaneous compared to the time constant of your mechanism.
Reply With Quote
  #24   Spotlight this post!  
Unread 29-01-2015, 23:35
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: PID Help

Quote:
Originally Posted by wildaburk3160 View Post
This video refers to the gains as Kp, Ki, and Kd. In the PID gains cluster connected to the PID.vi, the I and D terms are labeled Ti and Td, as in derivative time and integral time.

So, are these functioning the same as an Ki and Kd, or are they functioning in some other way?
They are different. LabVIEW uses the "Academic form" of PID instead of the "parallel form" that most tutorials assume. See the conversion details at the bottom of http://zone.ni.com/reference/en-XX/h...re_conversion/ for some insight into what the differences are and what they mean.
Reply With Quote
  #25   Spotlight this post!  
Unread 30-01-2015, 16:40
BitTwiddler's Avatar
BitTwiddler BitTwiddler is offline
electronics/programming mentor
AKA: Mr Tanguay
FRC #1726 (N.E.R.D.S.)
Team Role: Mentor
 
Join Date: Oct 2008
Rookie Year: 2006
Location: Sierra Vista, AZ
Posts: 246
BitTwiddler is on a distinguished road
Re: PID Help

Quote:
Originally Posted by Alan Anderson View Post
They are different. LabVIEW uses the "Academic form" of PID instead of the "parallel form" that most tutorials assume. See the conversion details at the bottom of http://zone.ni.com/reference/en-XX/h...re_conversion/ for some insight into what the differences are and what they mean.
Aha! Thanks for this Alan. I've been reluctant to use LV's PID because I couldn't relate the gains to the time inputs. Now I see how I could use the conventional gain coefficients that I read about in the tutorials. I didn't know a different perspective existed.
Reply With Quote
  #26   Spotlight this post!  
Unread 30-01-2015, 17:13
randantor randantor is offline
Registered User
AKA: James Y
FRC #0624 (CRyptonite)
Team Role: Alumni
 
Join Date: Jun 2013
Rookie Year: 2012
Location: Katy, TX
Posts: 48
randantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of light
Re: PID Help

Quote:
Originally Posted by wildaburk3160 View Post
On another note, I went through the Zeigler-Nichols process described in the video, and after calculations, the Kd I was supposed to have came out to be ~ .0004, which is beyond the three decimal accuracy of the PID gains control. I ended up having to settle for .001.
You can adjust the number of digits the control displays if you right click on it and click on "Display Format...", and mess with the settings there.
Reply With Quote
Reply


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 20:12.

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