diff --git a/software/MySrc/Flight/mixer.c b/software/MySrc/Flight/mixer.c index e96a6f9..2631178 100644 --- a/software/MySrc/Flight/mixer.c +++ b/software/MySrc/Flight/mixer.c @@ -2,7 +2,7 @@ void mixing(mixer_handle_t *mixer_h, motor_output_t *motor_output){ int16_t motor_low_limit = 200; - int16_t motor_high_limit = 1850; + int16_t motor_high_limit = 1600; float throttle = ((float)mixer_h->input.throttle)*mixer_h->percentages.throttle; float roll = ((float)mixer_h->input.roll)* mixer_h->percentages.roll; @@ -13,10 +13,10 @@ void mixing(mixer_handle_t *mixer_h, motor_output_t *motor_output){ - motor_output->motor4 = (int16_t)((throttle + roll- pitch - yaw)); //must be motor 4 was motor 1 - motor_output->motor3 = (int16_t)((throttle - roll - pitch + yaw)); //must be motor 3 was motor 2 - motor_output->motor1 = (int16_t)((throttle - roll + pitch - yaw)); //must be motor 1 was motor 3 - motor_output->motor2 = (int16_t)((throttle + roll + pitch + yaw)); //must be motor 2 was motor 4 + motor_output->motor4 = (int16_t)((throttle + pitch + roll - yaw)); //must be motor 4 was motor 1 + motor_output->motor3 = (int16_t)((throttle - pitch + roll + yaw)); //must be motor 3 was motor 2 + motor_output->motor1 = (int16_t)((throttle - pitch - roll - yaw)); //must be motor 1 was motor 3 + motor_output->motor2 = (int16_t)((throttle + pitch - roll + yaw)); //must be motor 2 was motor 4 if(motor_output->motor1 > motor_high_limit){ temp = motor_output->motor1 - motor_high_limit; @@ -128,8 +128,8 @@ void mixing(mixer_handle_t *mixer_h, motor_output_t *motor_output){ } void init_mixer_percentages(mixer_handle_t *mixer_h){ - mixer_h->percentages.roll = 0.8; + mixer_h->percentages.roll = 1; mixer_h->percentages.pitch = 0.8; - mixer_h->percentages.yaw = 0.8; - mixer_h->percentages.throttle = 0.8; + mixer_h->percentages.yaw = 1; + mixer_h->percentages.throttle = 1; } \ No newline at end of file diff --git a/software/MySrc/Flight/pid_controller.c b/software/MySrc/Flight/pid_controller.c index fe9f1f3..628310c 100644 --- a/software/MySrc/Flight/pid_controller.c +++ b/software/MySrc/Flight/pid_controller.c @@ -12,9 +12,9 @@ #define TAU 0.00065 -#define KD 0.6 -#define KI 0.4 -#define KP 1.2 +#define KP 0.6 +#define KI 0.2 +#define KD 1.8 diff --git a/software/MySrc/mymain.c b/software/MySrc/mymain.c index 170c351..f850e8b 100644 --- a/software/MySrc/mymain.c +++ b/software/MySrc/mymain.c @@ -147,6 +147,7 @@ void mymain(void) { //imu_process(&imu_h); flight_ctrl_cycle(); + motors_process(&motors_h);