Go to Post If my counts are correct, during the official matches 141,077 points were scored, and a minimum of 28,746 frisbees were successfully shot into goals. All without a single decapitation, severed limb, or even one porpoise becoming accidentally entangled in the nets. - dlavery [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2015, 15:45
marcusb258 marcusb258 is offline
Registered User
FRC #2601
 
Join Date: Jan 2013
Location: New York
Posts: 4
marcusb258 is an unknown quantity at this point
PIDController help

We've been experimenting with the PIDController class in WPILib. So far, we were able to get our motors spinning, but because of the amount of switching back and forth around the setpoint, the motors end up cycling a lot, dangerously. In order to remedy this, we attempted to use the setAbsoluteTolerance and setPercentTolerance methods from the PIDController, however, they appear to have no effect. For example, when setting the percent tolerance to 15, and with a setpoint of 200, the loop would continue to run even with a value of 195. Absolute tolerance showed the exact same problems. Does anyone know why these methods have no effect on the loop?

We DO have a quick fix, manually checking the error in the loop against a preset tolerance, but we would like to see if we can get it running in the built-in class.

If it helps, we're running this on a CANTalon with a USDigital encoder set to 4x mode. The loop is running on the RoboRio, not the talon.

Code:
https://github.com/steelhawks/PIDtest


Thanks!
  #2   Spotlight this post!  
Unread 15-01-2015, 16:08
Thad House Thad House is online now
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,094
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: PIDController help

There are a few things causing that. With the distance per count of 1, and a P of 1, that means anytime the encoder is off by more then 1 tick, it will run full output. I would start by setting distance per count to a real unit, such as either rotations, or inches. I would need more information to help you calculate this, but its not too difficult. Just figure out how far your device travels when you rotate the encoder 1 full rotation, then divide that number by the CPR of the encoder. I would then set your P to about 0.01, and start working it up or down from there depending on how you device is set up.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
  #3   Spotlight this post!  
Unread 15-01-2015, 16:47
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 258
Jefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond repute
Re: PIDController help

I'll add that the Set*Tolerance functions are there so that you can later call the OnTarget function to see if the controller is within your desired range. As you observed, the tolerances do not have any effect on the control loop.
If you want the controller to not control when it's in range you can check to see if the controller is on target. If it is, you can disable, else enable.
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:41.

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