| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.wpi.first.wpilibj.command.Subsystem
edu.wpi.first.wpilibj.command.PIDSubsystem
public abstract class PIDSubsystem
This class is designed to handle the case where there is a Subsystem
 which uses a single PIDController almost constantly (for instance, 
 an elevator which attempts to stay at a constant height).
 
It provides some convenience methods to run an internal PIDController.
 It also allows access to the internal PIDController in order to give total control
 to the programmer.
| Constructor Summary | |
|---|---|
| PIDSubsystem(double p,
             double i,
             double d)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| PIDSubsystem(double p,
             double i,
             double d,
             double period)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| PIDSubsystem(double p,
             double i,
             double d,
             double period,
             double f)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| PIDSubsystem(String name,
             double p,
             double i,
             double d)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| PIDSubsystem(String name,
             double p,
             double i,
             double d,
             double f)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| PIDSubsystem(String name,
             double p,
             double i,
             double d,
             double f,
             double period)Instantiates a PIDSubsystemthat will use the given p, i and d values. | |
| Method Summary | |
|---|---|
|  void | disable()Disables the internal PIDController | 
|  void | enable()Enables the internal PIDController | 
|  PIDController | getPIDController()Returns the PIDControllerused by thisPIDSubsystem. | 
|  double | getPosition()Returns the current position | 
|  double | getSetpoint()Returns the setpoint. | 
|  String | getSmartDashboardType() | 
|  void | initTable(ITable table)Initializes a table for this sendable object. | 
|  boolean | onTarget()Return true if the error is within the percentage of the total input range, determined by setTolerance. | 
| protected abstract  double | returnPIDInput()Returns the input for the pid loop. | 
|  void | setAbsoluteTolerance(double t)Set the absolute error which is considered tolerable for use with OnTarget. | 
|  void | setInputRange(double minimumInput,
              double maximumInput)Sets the maximum and minimum values expected from the input. | 
|  void | setPercentTolerance(double p)Set the percentage error which is considered tolerable for use with OnTarget. | 
|  void | setSetpoint(double setpoint)Sets the setpoint to the given value. | 
|  void | setSetpointRelative(double deltaSetpoint)Adds the given value to the setpoint. | 
| protected abstract  void | usePIDOutput(double output)Uses the value that the pid loop calculated. | 
| Methods inherited from class edu.wpi.first.wpilibj.command.Subsystem | 
|---|
| getCurrentCommand, getDefaultCommand, getName, getTable, initDefaultCommand, setDefaultCommand, toString | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface edu.wpi.first.wpilibj.Sendable | 
|---|
| getTable | 
| Constructor Detail | 
|---|
public PIDSubsystem(String name,
                    double p,
                    double i,
                    double d)
PIDSubsystem that will use the given p, i and d values.
name - the namep - the proportional valuei - the integral valued - the derivative value
public PIDSubsystem(String name,
                    double p,
                    double i,
                    double d,
                    double f)
PIDSubsystem that will use the given p, i and d values.
name - the namep - the proportional valuei - the integral valued - the derivative valuef - the feed forward value
public PIDSubsystem(String name,
                    double p,
                    double i,
                    double d,
                    double f,
                    double period)
PIDSubsystem that will use the given p, i and d values.  It will also space the time
 between PID loop calculations to be equal to the given period.
name - the namep - the proportional valuei - the integral valued - the derivative valueperiod - the time (in seconds) between calculations
public PIDSubsystem(double p,
                    double i,
                    double d)
PIDSubsystem that will use the given p, i and d values.
 It will use the class name as its name.
p - the proportional valuei - the integral valued - the derivative value
public PIDSubsystem(double p,
                    double i,
                    double d,
                    double period,
                    double f)
PIDSubsystem that will use the given p, i and d values.
 It will use the class name as its name.
 It will also space the time
 between PID loop calculations to be equal to the given period.
p - the proportional valuei - the integral valued - the derivative valuef - the feed forward coefficientperiod - the time (in seconds) between calculations
public PIDSubsystem(double p,
                    double i,
                    double d,
                    double period)
PIDSubsystem that will use the given p, i and d values.
 It will use the class name as its name.
 It will also space the time
 between PID loop calculations to be equal to the given period.
p - the proportional valuei - the integral valued - the derivative valueperiod - the time (in seconds) between calculations| Method Detail | 
|---|
public PIDController getPIDController()
PIDController used by this PIDSubsystem.
 Use this if you would like to fine tune the pid loop.
 Notice that calling setSetpoint(...) on the controller
 will not result in the setpoint being trimmed to be in
 the range defined by setSetpointRange(...).
PIDController used by this PIDSubsystempublic void setSetpointRelative(double deltaSetpoint)
setRange(...) was used,
 then the bounds will still be honored by this method.
deltaSetpoint - the change in the setpointpublic void setSetpoint(double setpoint)
setRange(...)
 was called,
 then the given setpoint
 will be trimmed to fit within the range.
setpoint - the new setpointpublic double getSetpoint()
public double getPosition()
public void setInputRange(double minimumInput,
                          double maximumInput)
minimumInput - the minimum value expected from the inputmaximumInput - the maximum value expected from the outputpublic void setAbsoluteTolerance(double t)
t - A PIDController.Tolerance object instance that is for example
 AbsoluteTolerance or PercentageTolerance. E.g. setTolerance(new PIDController.AbsoluteTolerance(0.1))public void setPercentTolerance(double p)
t - A PIDController.Tolerance object instance that is for example
 AbsoluteTolerance or PercentageTolerance. E.g. setTolerance(new PIDController.AbsoluteTolerance(0.1))public boolean onTarget()
protected abstract double returnPIDInput()
It returns the input for the pid loop, so if this Subsystem was based off of a gyro, then it should return the angle of the gyro
All subclasses of PIDSubsystem must override this method.
protected abstract void usePIDOutput(double output)
driveline.tankDrive(output, -output)
 All subclasses of PIDSubsystem must override this method.
output - the value the pid loop calculatedpublic void enable()
PIDController
public void disable()
PIDController
public String getSmartDashboardType()
getSmartDashboardType in interface SendablegetSmartDashboardType in class Subsystempublic void initTable(ITable table)
Sendable
initTable in interface SendableinitTable in class Subsystemtable - The table to put the values in.| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||