WPILib 2012
WPILibRoboticsLibraryforFRC
SmartDashboard/SendablePIDController.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2011. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __SENDABLE_PID_CONTROLLER_H__
00008 #define __SENDABLE_PID_CONTROLLER_H__
00009 
00010 #include "NetworkTables/NetworkTableChangeListener.h"
00011 #include "PIDController.h"
00012 #include "SmartDashboard/SmartDashboardData.h"
00013 
00014 class NetworkTable;
00015 
00026 class SendablePIDController : public PIDController, public SmartDashboardData, public NetworkTableChangeListener
00027 {
00028 public:
00029         SendablePIDController(double p, double i, double d, PIDSource *source, PIDOutput *output);
00030         SendablePIDController(double p, double i, double d, PIDSource *source, PIDOutput *output, double period);
00031         virtual ~SendablePIDController();
00032 
00033         virtual void SetSetpoint(float setpoint);
00034         virtual void SetPID(double p, double i, double d); 
00035         virtual void Enable();
00036         virtual void Disable();
00037 
00038         // SmartDashboardData interface
00039         virtual std::string GetType() {return "PIDController";}
00040         virtual NetworkTable *GetTable();
00041 
00042         // NetworkTableChangeListener interface
00043         virtual void ValueChanged(NetworkTable *table, const char *name, NetworkTables_Types type);
00044         virtual void ValueConfirmed(NetworkTable *table, const char *name, NetworkTables_Types type) {}
00045 
00046 private:
00047         NetworkTable* m_table;
00048 };
00049 
00050 #endif
 All Classes Functions Variables