Go to Post Well our closest regional is a Hawaii, it's a bit hard for us to drive 8000km (5000 miles) across the pacific... - timytamy [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 39 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 01-31-2014, 06:32 PM
Maxchrist Maxchrist is offline
Registered User
FRC #4458 (Infernobotix)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Center Moriches, NY
Posts: 10
Maxchrist is an unknown quantity at this point
How do you Tune the PID Values?

Hi I am on a second year frc team from New York. We have been trying to program an autonomous program in java using motor encoders and a PID controller to move forward a specific distance. However, in order to uses the PID controller we need the proportionality, integral, and differential constants, and we do not know how to find them. We tried using the smart dashboard but nothing shows up in the window to edit. If someone could give us some help it would be greatly appreciated. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 01-31-2014, 09:08 PM
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: How do you Tune the PID Values?

Quote:
Originally Posted by Maxchrist View Post
We tried using the smart dashboard but nothing shows up in the window to edit. If someone could give us some help it would be greatly appreciated. Thanks!
We are using Command based Java code and we are having trouble getting a PIDSubsystem to show up in the SmartDashboard LiveWindow when we put the robot in Test mode.

This link shows the PIDSubsystem showing up in LiveWindow and allowing you to edit all the PID controller values but we don't seem to be able to get this to work.

http://wpilib.screenstepslive.com/s/...manual-id=7932

For the original poster, when we put the robot into teleop mode and made the SmartDashboard editable we were able to right-click the PIDSubsystem and select PID editor. This looked like it would allow you to edit the PID constants at least. This was after using SmartDashboard.putData() to send the PIDSubsystem to the SmartDashboard.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-03-2014, 01:22 PM
vgdude999 vgdude999 is offline
Programmer/Driver
FRC #1751 (Comsewogue Warriors)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Port Jefferson Station, NY
Posts: 25
vgdude999 is an unknown quantity at this point
Re: How do you Tune the PID Values?

I was able to get the PID controller in livewindow using this line in the OI:

Code:
LiveWindow.addActuator("drivetrain", "Drivetrain", Robot.drivetrain.getPIDController());

EDIT: This is for test mode, I don't know about getting it in teleop.
__________________
2013: Rookie year, programmer-in-training; SBPLI Regional Finalists
2014: Co-Captain, Programmer, Driver; Seeded 15th
2015: Co-Captain, Programmer, Driver
Reply With Quote
  #4   Spotlight this post!  
Unread 02-03-2014, 02:05 PM
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: How do you Tune the PID Values?

For teleop, just do this:
Code:
SmartDashboard.putData("PID Controller",controller);
controller can be replaced by subsystem.getPIDController().

Also, in terms of actual tuning techniques, here's the procedure I use:
  • Raise the P constant until your controller oscillates. If the oscillations are too big, lower the constant a little bit.
  • Raise the D constant to damp the oscillation, causing it to converge. D also slows down the controller's approach to the setpoint, so striking a balance between P and D can take some tweaking.
  • If you have P and D tuned, and it oscillates & converges, but not to the correct setpoint, increase I. This is called "steady-state error" and a positive, non-zero integral constant will cause the controller to correct for it.

In general, P makes approach faster, but can cause larger oscillations; D causes oscillations to converge, but slows approach; and I can correct for steady-state error and causes faster approach, but can lead to intense oscillations if set too high (search "integral windup" for more details).
__________________
I code stuff.
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:33 AM.

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