Go to Post Sometimes students ask me if MIT wants students who are well-rounded. I usually say I don't care as much if you're well-rounded or pointy, what I care about is evaluating the space enclosed by the shape. - Petey [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: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 15-02-2015, 16:43
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
PIDs out of control

After getting our drive system running, we've run into some trouble with our PIDs.

We have four independent steering modules each with a potentiometer, all run by PIDs. We've gotten them successfully working as a crab drive/ being able to rotate.

However, one or more motors will occasionally rotate, spinning out of control without any input from a driver. I'm not sure what would cause this issue if, for the majority of the time, the code does what it's supposed to just fine.

I'm at a loss as to what would cause this issue. Any ideas?
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2015, 17:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: PIDs out of control

Quote:
Originally Posted by wildaburk3160 View Post
We have four independent steering modules each with a potentiometer
A pot can only turn so far. How are you dealing with this limitation in your software?


Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2015, 17:48
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: PIDs out of control

Quote:
Originally Posted by wildaburk3160 View Post
After getting our drive system running, we've run into some trouble with our PIDs.

We have four independent steering modules each with a potentiometer, all run by PIDs. We've gotten them successfully working as a crab drive/ being able to rotate.

However, one or more motors will occasionally rotate, spinning out of control without any input from a driver. I'm not sure what would cause this issue if, for the majority of the time, the code does what it's supposed to just fine.

I'm at a loss as to what would cause this issue. Any ideas?
Unexplained failures have a habit of returning at the worst possible moment - yes it is an issue. One common intermittent stability error is as you rap around from 360 to 0 degrees (and 0 to 360), you may introduce a toggling of the sign and magnitude of the error signal. I would start looking at the way you wrap around the circle.

To Ether's point, I assume you are using one of the newer "absolute encoder" http://www.andymark.com/product-p/am-2899.htm for the feedback? If not, you should consider something similar that will not be damaged if you over rotate. Again, this device will have a "discontinuity" at the 360->0 point that needs special consideration.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2015, 18:04
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: PIDs out of control

Quote:
Originally Posted by gpetilli View Post
To Ether's point, I assume you are using one of the newer "absolute encoder" http://www.andymark.com/product-p/am-2899.htm for the feedback? If not, you should consider something similar that will not be damaged if you over rotate. Again, this device will have a "discontinuity" at the 360->0 point that needs special consideration.
I assumed he is indeed using a pot (as he said). Some pots have no mechanical stops, but they have a small "blind spot". If his controller is being commanded to an angle within that blind spot, I can imagine how that might make the controller go nuts, especially if his angle error computation is not finding the shortest angle.


Reply With Quote
  #5   Spotlight this post!  
Unread 15-02-2015, 18:35
awallace3160 awallace3160 is offline
Registered User
FRC #3160
 
Join Date: Feb 2015
Location: Grove, OK
Posts: 1
awallace3160 is an unknown quantity at this point
Re: PIDs out of control

(OP on a fellow programmers computer here)

We are using 5-turn potentiometers and they are only intended to rotate 180 degrees maximum. We try to make sure that the pots are set to rotate near the middle of each ones range so as to avoid over rotating them if they go a little bit beyond the desired setpoint.

We are using the PotentiometerGetNormalized.vi to get our values, which return as a percentage of the total voltage, we have found. So, we are trying to return 3-4 decimal accuracy on each potentiometer.

So, I'm not sure if our program trying to reach this accuracy is hitting the pots' "blind spot" or not, because I'm not absolutely sure what that means.

Last edited by awallace3160 : 15-02-2015 at 22:37.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-02-2015, 18:58
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: PIDs out of control

Quote:
Originally Posted by awallace3160 View Post
We are using 5-turn potentiometers and they are only intended to rotate 180 degrees maximum.
It's not clear what you mean. It could be interpreted at least 2 different ways:

1) The wheel is currently at 179 degrees and it is being commanded to go to -179 degrees. The controller will rotate the wheel 358 degrees counterclockwise to get to the commanded angle, because the controller does not want to exceed 180 degrees.

or

2) The wheel is currently at 179 degrees and it is being commanded to go to -179 degrees. The controller will rotate the wheel 2 degrees clockwise to get to the commanded angle, because that is less than 180 degrees movement.

Which of the above descriptions is what you intended? (or something else?)


Quote:
We try to make sure that the pots are set to rotate near the middle of each ones range so as to avoid over rotating them if they go a little bit beyond the desired setpoint.
When you process the signal from the pot, do you let the signal go beyond 180 degrees? Or do you constrain it to be in the range +/-180 before using it? In other words, say the pot is at zero degrees, and then gets moved 181 degrees clockwise. Will your processed pot reading be +181 degrees or -179?

Quote:
We are using the PotentiometerGetNormalized.vi to get our values
I don't know what that means, but it sounds like it is converting the pot reading to +/-180 degrees. If such is the case, depending on your code that could make the controller go nuts. I suggest you post your code for review.



Quote:
So,I'm not sure if our program trying to reach this accuracy is hitting the pots' "blind spot" or not, because I'm not absolutely sure what that means.
If you've got a 5-turn pot and you are centering it and avoiding over-rotating, there should be no blind spot (a dead area where there's no usable signal).


Reply With Quote
  #7   Spotlight this post!  
Unread 15-02-2015, 19:17
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: PIDs out of control

From what we've gathered, the PotentiometerGetNormalized.vi gets the voltage reading from the potentiometer and returns it as some sort of proportion of the total possible voltage. It seems that 90 degrees ~ .1 change in the returned value.

So, if we were to set our "midpoint" at the middle of the pots rotational range, we would set our setpoint to .50. Our goal then is to rotate at maximum 90 degrees in either direction from this point. Theoretically, this should change the value by .1, but it has a small variation, so we have it set to where we manually control the "maximum" and "minimum" values of the pot.

None of these values we have set come up near the extreme values of rotation, which would either be "0" or "1".

We haven't thrown in any limitations to rotations in the program other than how far we can change the setpoint, but I will soon implement something.
Reply With Quote
  #8   Spotlight this post!  
Unread 15-02-2015, 20:03
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: PIDs out of control

Quote:
Originally Posted by wildaburk3160 View Post
the PotentiometerGetNormalized.vi gets the voltage reading from the potentiometer and returns it as some sort of proportion of the total possible voltage
As I said, I am not familiar with PotentiometerGetNormalized... but for a 5-turn pot, 1/4 of a turn (90 degrees) would be (1/4)/5 = 0.05 of the total range.


Reply With Quote
  #9   Spotlight this post!  
Unread 15-02-2015, 21:40
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: PIDs out of control

Well, regardless of it's particular function, do you have any other ideas as to why this problem is occuring?
Reply With Quote
  #10   Spotlight this post!  
Unread 15-02-2015, 21:59
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: PIDs out of control

Quote:
Originally Posted by wildaburk3160 View Post
Well, regardless of it's particular function, do you have any other ideas as to why this problem is occuring?
It's either hardware or software. Here's a good way to find out if it's software:

Quote:
Originally Posted by Ether View Post
I suggest you post your code for review.
Reply With Quote
  #11   Spotlight this post!  
Unread 16-02-2015, 00:56
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,659
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: PIDs out of control

Quote:
Originally Posted by Ether View Post
It's either hardware or software. Here's a good way to find out if it's software:
And to help figure out if it's hardware, it would help if we understood just what hardware you're using, how it's connected, and how it's supposed to work. Including links to spec sheets would also be helpful!
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #12   Spotlight this post!  
Unread 16-02-2015, 11:10
1uan 1uan is offline
Registered User
AKA: Juan Halleran
FRC #2152 (S*M*A*S*H)
Team Role: Programmer
 
Join Date: Oct 2014
Rookie Year: 2012
Location: Port Orange
Posts: 18
1uan is an unknown quantity at this point
Post Re: PIDs out of control

However, one or more motors will occasionally rotate, spinning out of control without any input from a driver. I'm not sure what would cause this issue if, for the majority of the time, the code does what it's supposed to just fine.


you may want to check your PID gain values, a method you may want to use is the Ziegler-Nichols Method https://controls.engin.umich.edu/wik...uningClassical
Reply With Quote
  #13   Spotlight this post!  
Unread 16-02-2015, 12:50
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: PIDs out of control

We noticed this past weekend that every so often, one of our drive motors will just start spinning at a high speed, even though we had a 0 hard-wired into the Set Motor Output VI. We still haven't figured out the cause yet. The speed controller (a Talon from last year) was green, which signifies that it thinks it is getting a valid speed command. We didn't find any short circuits of any type. We just stopped the code and restarted it, and the problem went away. This makes us a bit nervous. I'm wondering if it could be related.
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote
  #14   Spotlight this post!  
Unread 16-02-2015, 14: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: PIDs out of control

Here are the PID Gains:



Now that I am taking another look, they may be a bit high. I was uneasy about how high they were but when they were first tuned it seemed to work just fine, so I let it slide.
Reply With Quote
  #15   Spotlight this post!  
Unread 16-02-2015, 16:42
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: PIDs out of control

Your P value might be a little high, but that will definitely depend on the nature of your system. Here's the implementation math, for reference:

Furthermore, you should read the help doc for the PID VI - it actually uses time constants, so Ti and Td might not behave as you would intuitively belive.



Images from this page

Quote:
Originally Posted by plnyyanks View Post
Just another note - if I remember, the LabVIEW implementation of the algorithm doesn't use Kp, Ki, and Kd as straight constants. It actually uses time constants for I and D (so it has Kp, Ti, and Td). You can see details of the NI implementation here. You can verify this in the help popup (ctrl-H) for the VI. Plan your constants accordingly.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
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 21:30.

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