control for robotic arm that can play chess using a granular gripper

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

PID/PID.h

Committer:
annesteenbeek
Date:
2015-10-09
Revision:
51:1e6334b993a3
Child:
54:c14c3bc48b8a

File content as of revision 51:1e6334b993a3:

#ifndef PID_H
#define PID_H

class PID{
	public:
	#define MANUAL 0
	#define AUTOMATIC 1

	PID(float*, float*, float*, float, float, float);

	void SetMode(int Mode);

	bool Compute();  // returns false when in Manual mode

	void SetOutputLimits(float, float);

	void SetSampleTime(float);

	void SetTunings(float, float, float);

	private:
	void Initialize();

	float curTime;
	float prevTime;
	float timeChange;

	float *myInput;              // * Pointers to the Input, Output, and Setpoint variables
    float *myOutput;             //   This creates a hard link between the variables and the 
    float *mySetpoint;           //   PID, freeing the user from having to constantly tell us
                                  //   what these values are.  with pointers we'll just know.
	float error, errSum, dErr; 
	float SampleTime = 1; // 1 second
	float Kp, Ki, Kd;
	float outMin, outMax;
	bool inAuto;

};

#endif