Generates a PID controller with parameters K_p, K_d and K_i
Dependents: locomotion_pid_action_refactor_EMG
Diff: controller.cpp
- Revision:
- 0:229271adbb37
diff -r 000000000000 -r 229271adbb37 controller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controller.cpp Mon Oct 16 09:41:19 2017 +0000 @@ -0,0 +1,15 @@ +#include "controller.h" +#include "mbed.h" + +// Member function definitions +controller::controller(float k_p, float k_d, float k_i):k_p(k_p), k_d(k_d), k_i(k_i){ + + } + +float controller::control(float e_pos, float e_der, float e_int){ + float motorValue; + motorValue = k_p*e_pos + k_d*e_der + k_i*e_int; + return motorValue; + } + + \ No newline at end of file