new brench

This commit is contained in:
Zorua
2026-01-17 17:43:42 +08:00
parent 80c832a16b
commit 26f210da12
2 changed files with 3 additions and 4 deletions

View File

@@ -240,7 +240,7 @@ static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
if(current_single<0.0f) current_single+=360.0f; if(current_single<0.0f) current_single+=360.0f;
if (fabsf(norm_rotation) > threshold) { if (norm_rotation > threshold) {
int32_t round_diff = (int32_t)((target_angle-actual_angle) / 360.0f); int32_t round_diff = (int32_t)((target_angle-actual_angle) / 360.0f);
*angle = actual_angle + norm_rotation-180.0f+round_diff*360.0f; *angle = actual_angle + norm_rotation-180.0f+round_diff*360.0f;
*speed = -(*speed); *speed = -(*speed);
@@ -386,8 +386,8 @@ void ChassisTask()
chassis_cmd_recv.wz = 0; chassis_cmd_recv.wz = 0;
break; break;
case CHASSIS_FOLLOW_GIMBAL_YAW: // 跟随云台,不单独设置pid,以误差角度平方为速度输出 case CHASSIS_FOLLOW_GIMBAL_YAW: // 跟随云台,不单独设置pid,以误差角度平方为速度输出
// float single_round_offset = chassis_cmd_recv.offset_angle;
float single_round_offset = chassis_cmd_recv.offset_angle; float single_round_offset = chassis_cmd_recv.offset_angle;
// float single_round_offset = fmodf(chassis_cmd_recv.offset_angle, 360.0f);
if(single_round_offset > 180.0f) if(single_round_offset > 180.0f)
{ {
single_round_offset -= 360.0f; single_round_offset -= 360.0f;
@@ -395,7 +395,6 @@ void ChassisTask()
else if(single_round_offset < -180.0f) else if(single_round_offset < -180.0f)
{ {
single_round_offset += 360.0f; single_round_offset += 360.0f;
} }
chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, single_round_offset, 0)/100; chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, single_round_offset, 0)/100;
// chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, chassis_cmd_recv.offset_angle, 0)/100; // chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, chassis_cmd_recv.offset_angle, 0)/100;