Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PID.h
- Revision:
- 3:cae0b305d54c
- Parent:
- 2:89bb6272869b
- Child:
- 5:f82e86e63928
--- 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: