Go to Post Time flies when you're freaking out. - Koko Ed [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 04-07-2016, 13:31
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,049
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Why won't this PID loop stop?

Quote:
Originally Posted by team-4480 View Post
Hi,

I am trying pretty hard to get this PID loop for a turnaround button using this nice example. The problem I am having is that no matter what I set the kToleranceDegrees to, the robot will still oscillate back and forth when I know for sure that it is within my tolerance. Am I forgetting to do something? I don't feel like adjusting the PID values will do anything because the robot won't even stop when the target is 90 degrees, the gyro reads 89.4 degrees and the tolerance is 10 degrees! What am I do wrong? Thanks!
Caveat: I am only familiar with the java version of WPILib and am assuming that the functionality is the same.

The loop does not automatically stop when you're within tolerance of the setpoint. Rather, the tolerance setting is used by the onTarget() function to determine whether or not you have reached your setpoint. If you wish to stop the loop once you've reached your setpoint, you'll have to write code to disable the PID controller once onTarget() returns true. Note that you can also set a buffer length for your PID controller which will require that the average over n interations of your main loop be within the tolerance of the setpoint for onTarget() to return true, which is a good idea to prevent the loop from disabling if it overshoots the setpoint.

However, you should not need to disable the PID loop to eliminate oscillations - if your robot is oscillating around setpoint, then you need to tune it better to reduce the overshoot. If you find it difficult to reduce/eliminate the overshoot without making it difficult or impossible for the robot to actually reach the setpoint, consider implementing a "minimum output" for your PID loop rather than letting it actually go smoothly to 0.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
 


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 09:52.

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