|
WPILibC++
unspecified
|
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). More...
#include <PIDSubsystem.h>
Public Member Functions | |
| PIDSubsystem (const std::string &name, double p, double i, double d) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| PIDSubsystem (const std::string &name, double p, double i, double d, double f) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| PIDSubsystem (const std::string &name, double p, double i, double d, double f, double period) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| PIDSubsystem (double p, double i, double d) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| PIDSubsystem (double p, double i, double d, double f) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| PIDSubsystem (double p, double i, double d, double f, double period) | |
| Instantiates a PIDSubsystem that will use the given p, i and d values. More... | |
| void | Enable () |
| Enables the internal PIDController. | |
| void | Disable () |
| Disables the internal PIDController. | |
| virtual void | PIDWrite (float output) |
| virtual double | PIDGet () |
| void | SetSetpoint (double setpoint) |
| Sets the setpoint to the given value. More... | |
| void | SetSetpointRelative (double deltaSetpoint) |
| Adds the given value to the setpoint. More... | |
| void | SetInputRange (float minimumInput, float maximumInput) |
| Sets the maximum and minimum values expected from the input. More... | |
| void | SetOutputRange (float minimumOutput, float maximumOutput) |
| Sets the maximum and minimum values to write. More... | |
| double | GetSetpoint () |
| Return the current setpoint. More... | |
| double | GetPosition () |
| Returns the current position. More... | |
| double | GetRate () |
| Returns the current rate. More... | |
| virtual void | SetAbsoluteTolerance (float absValue) |
| virtual void | SetPercentTolerance (float percent) |
| virtual bool | OnTarget () const |
| virtual void | InitTable (std::shared_ptr< ITable > table) |
| Initializes a table for this sendable object. More... | |
| virtual std::string | GetSmartDashboardType () const |
Public Member Functions inherited from Subsystem | |
| Subsystem (const std::string &name) | |
| Creates a subsystem with the given name. More... | |
| void | SetDefaultCommand (Command *command) |
| Sets the default command. More... | |
| Command * | GetDefaultCommand () |
| Returns the default command (or null if there is none). More... | |
| void | SetCurrentCommand (Command *command) |
| Sets the current command. More... | |
| Command * | GetCurrentCommand () const |
| Returns the command which currently claims this subsystem. More... | |
| virtual void | InitDefaultCommand () |
| Initialize the default command for this subsystem This is meant to be the place to call SetDefaultCommand in a subsystem and will be called on all the subsystems by the CommandBase method before the program starts running by using the list of all registered Subsystems inside the Scheduler. More... | |
| virtual std::string | GetName () const |
| virtual std::shared_ptr< ITable > | GetTable () const |
Public Member Functions inherited from ErrorBase | |
| ErrorBase (const ErrorBase &)=delete | |
| ErrorBase & | operator= (const ErrorBase &)=delete |
| virtual Error & | GetError () |
| Retrieve the current error. More... | |
| virtual const Error & | GetError () const |
| virtual void | SetErrnoError (llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef 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, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
| Set the current error information associated from the nivision Imaq API. More... | |
| virtual void | SetError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
| Set the current error information associated with this sensor. More... | |
| virtual void | SetWPIError (llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const |
| Set the current error information associated with this sensor. More... | |
| virtual void | CloneError (const 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... | |
Public Member Functions inherited from PIDSource | |
| virtual void | SetPIDSourceType (PIDSourceType pidSource) |
| Set which parameter you are using as a process control variable. More... | |
| PIDSourceType | GetPIDSourceType () const |
Protected Member Functions | |
| std::shared_ptr< PIDController > | GetPIDController () |
| Returns the PIDController used by this PIDSubsystem. More... | |
| virtual double | ReturnPIDInput ()=0 |
| virtual void | UsePIDOutput (double output)=0 |
Additional Inherited Members | |
Static Public Member Functions inherited from ErrorBase | |
| static void | SetGlobalError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) |
| static void | SetGlobalWPIError (llvm::StringRef errorMessage, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) |
| static Error & | GetGlobalError () |
| Retrieve the current global error. | |
Protected Attributes inherited from Subsystem | |
| std::shared_ptr< ITable > | m_table |
Protected Attributes inherited from ErrorBase | |
| Error | m_error |
Protected Attributes inherited from PIDSource | |
| PIDSourceType | m_pidSource = PIDSourceType::kDisplacement |
Static Protected Attributes inherited from ErrorBase | |
| static priority_mutex | _globalErrorMutex |
| static Error | _globalError |
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.
| PIDSubsystem::PIDSubsystem | ( | const std::string & | name, |
| double | p, | ||
| double | i, | ||
| double | d | ||
| ) |
Instantiates a PIDSubsystem that will use the given p, i and d values.
| name | the name |
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| PIDSubsystem::PIDSubsystem | ( | const std::string & | name, |
| double | p, | ||
| double | i, | ||
| double | d, | ||
| double | f | ||
| ) |
Instantiates a PIDSubsystem that will use the given p, i and d values.
| name | the name |
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| f | the feedforward value |
| PIDSubsystem::PIDSubsystem | ( | const std::string & | 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.
| name | the name |
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| f | the feedfoward value |
| period | the time (in seconds) between calculations |
| 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.
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| 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.
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| f | the feedforward value |
| 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.
| p | the proportional value |
| i | the integral value |
| d | the derivative value |
| f | the feedforward value |
| period | the time (in seconds) between calculations |
|
protected |
Returns the PIDController used by this PIDSubsystem.
Use this if you would like to fine tune the pid loop.
| double PIDSubsystem::GetPosition | ( | ) |
Returns the current position.
| double PIDSubsystem::GetRate | ( | ) |
Returns the current rate.
| double PIDSubsystem::GetSetpoint | ( | ) |
Return the current setpoint.
|
virtual |
Reimplemented from Subsystem.
|
virtual |
Initializes a table for this sendable object.
| subtable | The table to put the values in. |
Reimplemented from Subsystem.
| void PIDSubsystem::SetInputRange | ( | float | minimumInput, |
| float | maximumInput | ||
| ) |
Sets the maximum and minimum values expected from the input.
| minimumInput | the minimum value expected from the input |
| maximumInput | the maximum value expected from the output |
| void PIDSubsystem::SetOutputRange | ( | float | minimumOutput, |
| float | maximumOutput | ||
| ) |
Sets the maximum and minimum values to write.
| minimumOutput | the minimum value to write to the output |
| maximumOutput | the maximum value to write to the output |
| void PIDSubsystem::SetSetpoint | ( | double | setpoint | ) |
Sets the setpoint to the given value.
If double) SetRange(...) was called, then the given setpoint will be trimmed to fit within the range.
| setpoint | the new setpoint |
| 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.
| deltaSetpoint | the change in the setpoint |