Go to Post Don't short change your drivers. They really need drive time. - Joe Johnson [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2016, 23:33
JABot67 JABot67 is offline
Unregistered User
AKA: John Bottenberg
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 328
JABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond repute
PID turning using gyro in LabVIEW

Hi LabVIEW Helpers,

My team is having a problem when trying to tune a PID algorithm for turning the drivebase to a specified relative angle.

The following autonomous code (using only P control) will work as intended, turning the robot approximately 180 degrees and staying there until the robot is disabled:

https://onedrive.live.com/redir?resi...nt=photo%2cPNG

What we find strange is that any non-zero kI will cause the robot to turn toward the setpoint (as expected) and then oscillate vigorously around the setpoint for eternity. This works with kI as low as 1e-12, i.e., nothing.

We would like to use PI control for our autonomous turning VI, but are perplexed by this behavior. As we decrease kI down to zero, we expect that the program's behavior should approach that of pure P control. Perhaps this is a floating point issue?

I remember in high school when programming in LabVIEW we ran into the same problem, but worked around it. Since we only needed to vary the robot's heading by a few degrees in 2010, we opted to set a very high kP and only use P control. This year is different, and we would like to have a turn VI that can reliably turn the robot any amount.

Besides providing us with a solution to this specific problem, what would really help us is some very good example code for turning to a specified relative angle autonomously. Any pointers, advice, or examples are appreciated!
__________________
John Bottenberg - University of Michigan '14 - Microsoft
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2016, 23:45
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,713
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: PID turning using gyro in LabVIEW

You actually want kI to be a larger value rather than a smaller value, e.g., try 10 or 100 instead of .1
Think of it as 1/Ti
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 18-02-2016 at 23:49.
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2016, 23:49
JABot67 JABot67 is offline
Unregistered User
AKA: John Bottenberg
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 328
JABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond repute
Re: PID turning using gyro in LabVIEW

Quote:
Originally Posted by Mark McLeod View Post
You actually want kI to be a larger value rather than a smaller value.
Is it worth it to start with a non-zero kI and kP of zero, then add kP later? We have not tried that yet. However, the confusion still stands about the fact that there is such a difference between a kI of zero and a kI of 0.000000000001 (1e-12).
__________________
John Bottenberg - University of Michigan '14 - Microsoft
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2016, 23:51
JABot67 JABot67 is offline
Unregistered User
AKA: John Bottenberg
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 328
JABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond repute
Re: PID turning using gyro in LabVIEW

Ohhh I get it. Ti is proportional to 1/kI.

Edit: Thanks everyone for the quick responses!
__________________
John Bottenberg - University of Michigan '14 - Microsoft
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????

Last edited by JABot67 : 19-02-2016 at 00:00. Reason: Thanks!
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2016, 23:48
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 323
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: PID turning using gyro in LabVIEW

In the toolkit the PID is in the Academic Form. So decreasing the Ti constant will increase the Ki gain.

You can verify that if you look at the labels of the three constants you'll see they are Kp, Ti, Td.

You can transform it to the Parallel Form using the PID Structure Conversion VI.
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2016, 08:58
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
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 turning using gyro in LabVIEW


Here's a slightly off-topic question related to the PNG in the OP.

Is it best to hard-code the control period (0.020 as shown in the PNG) or would it be better to leave that blank and let LabVIEW compute the actual period each iteration (especially with Teleop)? Or doesn't it matter that much in actual practice?



Reply With Quote
  #7   Spotlight this post!  
Unread 19-02-2016, 09:37
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,713
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: PID turning using gyro in LabVIEW

You only need to specify the control period if you have sub-ms loop times.
Only in rigorous time-controlled loops of course.

The vi itself will compute the actual period using an internal 1 ms clock.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 19-02-2016 at 09:50.
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 08:07.

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