Now you can download a copy of these docs so you can use them offline! Download now

#include <PIDSubsystem.h>

Inheritance diagram for PIDSubsystem:
Collaboration diagram for PIDSubsystem:

Public Member Functions

 PIDSubsystem (const char *name, double p, double i, double d)
 
 PIDSubsystem (const char *name, double p, double i, double d, double f)
 
 PIDSubsystem (const char *name, double p, double i, double d, double f, double period)
 
 PIDSubsystem (double p, double i, double d)
 
 PIDSubsystem (double p, double i, double d, double f)
 
 PIDSubsystem (double p, double i, double d, double f, double period)
 
void Enable ()
 
void Disable ()
 
virtual void PIDWrite (float output)
 
virtual double PIDGet ()
 
void SetSetpoint (double setpoint)
 
void SetSetpointRelative (double deltaSetpoint)
 
void SetInputRange (float minimumInput, float maximumInput)
 
double GetSetpoint ()
 
double GetPosition ()
 
virtual void SetAbsoluteTolerance (float absValue)
 
virtual void SetPercentTolerance (float percent)
 
virtual bool OnTarget ()
 
virtual void InitTable (ITable *table)
 
virtual std::string GetSmartDashboardType ()
 
- Public Member Functions inherited from Subsystem
 Subsystem (const char *name)
 
void SetDefaultCommand (Command *command)
 
CommandGetDefaultCommand ()
 
void SetCurrentCommand (Command *command)
 
CommandGetCurrentCommand ()
 
virtual void InitDefaultCommand ()
 
virtual std::string GetName ()
 
virtual ITableGetTable ()
 
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (ErrorBase *rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

Protected Member Functions

PIDControllerGetPIDController ()
 
virtual double ReturnPIDInput ()=0
 
virtual void UsePIDOutput (double output)=0
 
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
 

Additional Inherited Members

- Public Types inherited from PIDSource
enum  PIDSourceParameter { kDistance, kRate, kAngle }
 
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 
- Protected Attributes inherited from Subsystem
ITablem_table
 
- Protected Attributes inherited from ErrorBase
Error m_error
 
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
 
static Error _globalError
 

Detailed Description

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.

Definition at line 25 of file PIDSubsystem.h.

Constructor & Destructor Documentation

PIDSubsystem::PIDSubsystem ( const char *  name,
double  p,
double  i,
double  d 
)

Instantiates a PIDSubsystem that will use the given p, i and d values.

Parameters
namethe name
pthe proportional value
ithe integral value
dthe derivative value

Definition at line 20 of file PIDSubsystem.cpp.

PIDSubsystem::PIDSubsystem ( const char *  name,
double  p,
double  i,
double  d,
double  f 
)

Instantiates a PIDSubsystem that will use the given p, i and d values.

Parameters
namethe name
pthe proportional value
ithe integral value
dthe derivative value
fthe feedforward value

Definition at line 34 of file PIDSubsystem.cpp.

PIDSubsystem::PIDSubsystem ( const char *  name,
double  p,
double  i,
double  d,
double  f,
double  period 
)

Instantiates a 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.

Parameters
namethe name
pthe proportional value
ithe integral value
dthe derivative value
fthe feedfoward value
periodthe time (in seconds) between calculations

Definition at line 50 of file PIDSubsystem.cpp.

PIDSubsystem::PIDSubsystem ( double  p,
double  i,
double  d 
)

Instantiates a PIDSubsystem that will use the given p, i and d values. It will use the class name as its name.

Parameters
pthe proportional value
ithe integral value
dthe derivative value

Definition at line 64 of file PIDSubsystem.cpp.

PIDSubsystem::PIDSubsystem ( double  p,
double  i,
double  d,
double  f 
)

Instantiates a PIDSubsystem that will use the given p, i and d values. It will use the class name as its name.

Parameters
pthe proportional value
ithe integral value
dthe derivative value
fthe feedforward value

Definition at line 78 of file PIDSubsystem.cpp.

PIDSubsystem::PIDSubsystem ( double  p,
double  i,
double  d,
double  f,
double  period 
)

Instantiates a 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.

Parameters
pthe proportional value
ithe integral value
dthe derivative value
fthe feedforward value
periodthe time (in seconds) between calculations

Definition at line 95 of file PIDSubsystem.cpp.

Member Function Documentation

void PIDSubsystem::Disable ( )

Disables the internal PIDController

Definition at line 117 of file PIDSubsystem.cpp.

void PIDSubsystem::Enable ( )

Enables the internal PIDController

Definition at line 109 of file PIDSubsystem.cpp.

PIDController * PIDSubsystem::GetPIDController ( )
protected

Returns the PIDController used by this PIDSubsystem. Use this if you would like to fine tune the pid loop.

Returns
the PIDController used by this PIDSubsystem

Definition at line 129 of file PIDSubsystem.cpp.

double PIDSubsystem::GetPosition ( )

Returns the current position

Returns
the current position

Definition at line 215 of file PIDSubsystem.cpp.

double PIDSubsystem::GetSetpoint ( )

Return the current setpoint

Returns
The current setpoint

Definition at line 161 of file PIDSubsystem.cpp.

std::string PIDSubsystem::GetSmartDashboardType ( )
virtual
Returns
the string representation of the named data type that will be used by the smart dashboard for this sendable

Reimplemented from Subsystem.

Definition at line 231 of file PIDSubsystem.cpp.

void PIDSubsystem::InitTable ( ITable subtable)
virtual

Initializes a table for this sendable object.

Parameters
subtableThe table to put the values in.

Reimplemented from Subsystem.

Definition at line 234 of file PIDSubsystem.cpp.

void PIDSubsystem::SetInputRange ( float  minimumInput,
float  maximumInput 
)

Sets the maximum and minimum values expected from the input.

Parameters
minimumInputthe minimum value expected from the input
maximumInputthe maximum value expected from the output

Definition at line 172 of file PIDSubsystem.cpp.

void PIDSubsystem::SetSetpoint ( double  setpoint)

Sets the setpoint to the given value. If SetRange(...) was called, then the given setpoint will be trimmed to fit within the range.

Parameters
setpointthe new setpoint

Definition at line 141 of file PIDSubsystem.cpp.

void PIDSubsystem::SetSetpointRelative ( double  deltaSetpoint)

Adds the given value to the setpoint. If SetRange(...) was used, then the bounds will still be honored by this method.

Parameters
deltaSetpointthe change in the setpoint

Definition at line 152 of file PIDSubsystem.cpp.


The documentation for this class was generated from the following files:

Generated on Sat Apr 26 2014 12:26:46 for WPILibC++ by doxygen 1.8.6