PID Controller
Dependencies: HIDScope MODSERIAL PinDetect QEI biquadFilter
Diff: pidControl.h
- Revision:
- 2:53d2f9b8fed1
- Parent:
- 1:fe23126b0389
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidControl.h Tue Oct 20 08:04:38 2015 +0000 @@ -0,0 +1,26 @@ +PinName m1_enc_a = D12; +PinName m1_enc_b = D13; +PinName m1_pwm = D6; +PinName m1_dir = D7; + +PinName m2_enc_a = D11; +PinName m2_enc_b = D10; +PinName m2_pwm = D5; +PinName m2_dir = D4; + +PinName m2_pot = A0; +PinName m1_pot = A1; + +const double pid_upper_limit = 1, pid_lower_limit = 0; + +const double motor1_kp = 0.75f, motor1_ki = 0.001f, motor1_kd = 0.005f; +const double motor2_kp = 0.75f, motor2_ki = 0.001f, motor2_kd = 0.005f; + +const double m1_f_a1 = 1.0, m1_f_a2 = 2.0, m1_f_b0 = 1.0, m1_f_b1 = 3.0, m1_f_b2 = 4.0; +const double m2_f_a1 = 1.0, m2_f_a2 = 2.0, m2_f_b0 = 1.0, m2_f_b1 = 3.0, m2_f_b2 = 4.0; + +int sigPerRev = 4192; +float tickRate = 0.01f; +float graphTickRate = 0.01f; + +float toRadians(int pulses);