Now you can download a copy of these docs so you can use them offline! Download now
PIDSubsystem.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef __PID_SUBSYSTEM_H__
8 #define __PID_SUBSYSTEM_H__
9 
10 #include "Commands/Subsystem.h"
11 #include "PIDController.h"
12 #include "PIDSource.h"
13 #include "PIDOutput.h"
14 
25 class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource
26 {
27 public:
28  PIDSubsystem(const char *name, double p, double i, double d);
29  PIDSubsystem(const char *name, double p, double i, double d, double f);
30  PIDSubsystem(const char *name, double p, double i, double d, double f, double period);
31  PIDSubsystem(double p, double i, double d);
32  PIDSubsystem(double p, double i, double d, double f);
33  PIDSubsystem(double p, double i, double d, double f, double period);
34  virtual ~PIDSubsystem();
35 
36  void Enable();
37  void Disable();
38 
39  // PIDOutput interface
40  virtual void PIDWrite(float output);
41 
42  // PIDSource interface
43  virtual double PIDGet();
44  void SetSetpoint(double setpoint);
45  void SetSetpointRelative(double deltaSetpoint);
46  void SetInputRange(float minimumInput, float maximumInput);
47  double GetSetpoint();
48  double GetPosition();
49 
50  virtual void SetAbsoluteTolerance(float absValue);
51  virtual void SetPercentTolerance(float percent);
52  virtual bool OnTarget();
53 
54 protected:
56 
57  virtual double ReturnPIDInput() = 0;
58  virtual void UsePIDOutput(double output) = 0;
59 
60 private:
62  PIDController *m_controller;
63 
64 public:
65  virtual void InitTable(ITable* table);
66  virtual std::string GetSmartDashboardType();
67 };
68 
69 #endif
70 
void SetInputRange(float minimumInput, float maximumInput)
Definition: ITable.h:26
void SetSetpoint(double setpoint)
double GetPosition()
PIDController * GetPIDController()
PIDSubsystem(const char *name, double p, double i, double d)
void SetSetpointRelative(double deltaSetpoint)
virtual std::string GetSmartDashboardType()
double GetSetpoint()
virtual void InitTable(ITable *table)

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