Decoupled position and current control working.

Dependencies:   QEI mbed-src

Revision:
3:cae0b305d54c
Parent:
2:89bb6272869b
Child:
4:5ae9f8b3a16f
--- a/PID.h	Fri Jun 28 19:03:06 2013 +0000
+++ b/PID.h	Fri Jul 12 00:13:37 2013 +0000
@@ -8,21 +8,41 @@
 class PIDController{
 public:
 
-PIDController(float desired_position, float p_gain, float d_gain, float i_gain);
+PIDController(float desired_position, float desired_torque, float p_gainp, float d_gainp, float i_gain_p, float p_gain_c, float i_gain_c);
 ~PIDController();
 
 float goal_position;
+float current_position;
 
-float kp;
-float kd;
-float ki;
+float kp_p;
+float kd_p;
+float ki_p;
+
+float kp_c;
+float ki_c;
+float c_error;
+float error_sum;
+float command;
+float torque_command;
+float c_torque;
 
 float error;
 float old_error;
 float integral_error;
 
-float Update(void);
+
+int counter;
+
+Timer timer;
 
+float torque;
+float direction;
+
+float past_currents [5];
+
+float command_position(void);
+float command_torque(void);
+float command_position_tm(void);
 private: