This commit is contained in:
bmy
2024-03-04 15:07:54 +08:00
6 changed files with 20 additions and 23 deletions

View File

@@ -22,7 +22,7 @@ float gy_Ki = 0.0f;
float gy_Kd = 0.0f;
float in_gyro;
float out_gyro;
//float set_gyro = 0.0f;
// float set_gyro = 0.0f;
float po_Kp = 1.0f;
float po_Ki = 0.0f;
@@ -44,16 +44,18 @@ void sport_motion(void)
{
cnt1++;
in_gyro = imu660ra_gyro_z; // 陀螺仪输入
in_angle = 0; // 图像远端输入
in_pos = 0; // 图像近端输入
in_speed = encoder_get_count(TIM5_ENCOEDER) / 1024 / 0.01 * 0.25; // 速度输入m/s
encoder_clear_count(TIM5_ENCOEDER); // 清除计数
in_gyro = imu660ra_gyro_z; // 陀螺仪输入
// in_angle = 0; // 图像远端输入
// in_pos = 0; // 图像近端输入
// 清除计数
PID_Compute(&far_gyro_pid);
if (cnt1 >= 10) {
PID_Compute(&far_angle_pid);
PID_Compute(&speed_pid);
in_speed = encoder_get_count(TIM5_ENCOEDER); // 速度输入m/s
// printf("rate:%d\r\n", (int16)in_speed);
encoder_clear_count(TIM5_ENCOEDER);
cnt1 = 0;
}