The unified diff between revisions [5a7404c7..] and [bfc9e27f..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'motor.c'
# # old_revision [5a7404c7ee458d3eab4b0548e4bc6b6a8b26135f] # new_revision [bfc9e27f5c40da31ae4269394aaf0545e5856a70] # # patch "motor.c" # from [0a5cff753a89545c1d3f23027cfb4f651db669cd] # to [743afb567c758bd114cb1dd29f25081f3454108c] # ============================================================ --- motor.c 0a5cff753a89545c1d3f23027cfb4f651db669cd +++ motor.c 743afb567c758bd114cb1dd29f25081f3454108c @@ -5,14 +5,15 @@ #include "dcm.h" #include "uart.h" #include "status.h" +#include "log.h" float integral[3] = {0.0f, 0.0f, 0.0f}; float last[3]; float throttle = 0.0f; -#define Kp 0.3 -#define Ki 0.02 +#define Kp 0.2 +#define Ki 0.04 #define Kd 0.08 #define Ka 0.0 @@ -33,7 +34,7 @@ void motor_pid_update(float troll, float { float derivative[3]; float out[3]; - float motor[3]; + float motor[4]; float roll, pitch, yaw; float error, max_error; float min_motor; @@ -145,6 +146,11 @@ void motor_pid_update(float troll, float set_thrust(1, motor[1]); set_thrust(2, motor[2]); set_thrust(3, motor[3]); + + log_put_uint16((unsigned int) (motor[0] * 65535)); + log_put_uint16((unsigned int) (motor[1] * 65535)); + log_put_uint16((unsigned int) (motor[2] * 65535)); + log_put_uint16((unsigned int) (motor[3] * 65535)); } void motor_kill(void) {