feat: 开启速度闭环
fix: 暂时修复通信卡死问题
This commit is contained in:
@@ -70,25 +70,26 @@ void sport_motion(void)
|
||||
if (cnt1 >= 10) {
|
||||
PID_Compute(&far_angle_pid);
|
||||
PID_Compute(&speed_pid);
|
||||
// in_speed = -encoder_get_count(TIM5_ENCOEDER); // 速度输入,m/s
|
||||
in_speed = sport_get_speed();
|
||||
printf("rate:%d\r\n", (int16_t)in_speed);
|
||||
in_speed = -sport_get_speed();
|
||||
// printf("rate:%d\r\n", (int16_t)in_speed);
|
||||
PID_Compute(&near_pos_pid);
|
||||
cnt1 = 0;
|
||||
}
|
||||
|
||||
if (bt_run_flag == 1) {
|
||||
by_pwm_power_duty((int32_t)(500 + out_pos + out_gyro),
|
||||
(int32_t)(500 - out_pos - out_gyro),
|
||||
(int32_t)(500 + out_speed + out_gyro),
|
||||
(int32_t)(500 + out_speed - out_gyro));
|
||||
// by_pwm_power_duty((int32_t)(500 + out_pos + out_gyro),
|
||||
// (int32_t)(500 - out_pos - out_gyro),
|
||||
// (int32_t)(500 + out_speed + out_gyro),
|
||||
// (int32_t)(500 + out_speed - out_gyro));
|
||||
by_pwm_power_duty(500, 500, 500 + out_speed, 500 + out_speed);
|
||||
} else {
|
||||
by_pwm_power_duty(500, 500, 500, 500);
|
||||
}
|
||||
if (bt_fly_flag == 0) {
|
||||
bt_fly = 0;
|
||||
by_pwm_update_duty(0 + 500, 0 + 500);
|
||||
} else {
|
||||
by_pwm_update_duty(bt_fly + 500, bt_fly + 500);
|
||||
}
|
||||
by_pwm_update_duty(bt_fly + 500, bt_fly + 500);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user