From fda8b070b8bc5aa3ce84c6478d5ac4cb0982c8b8 Mon Sep 17 00:00:00 2001 From: "LIN\\54376" <543769318@qq.com> Date: Fri, 26 Sep 2025 16:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E9=87=8C=E5=AE=9E=E6=97=B6=E8=B0=83=E6=95=B4=E8=A1=A5?= =?UTF-8?q?=E5=81=BF=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .settings/language.settings.xml | 4 ++-- Core/Src/robot_state.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 13fd3c0..7c1ad0a 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/Core/Src/robot_state.c b/Core/Src/robot_state.c index adfb70d..6e79d47 100644 --- a/Core/Src/robot_state.c +++ b/Core/Src/robot_state.c @@ -215,6 +215,21 @@ void Auto() } break; case 2: + //水平 + if ((AM_Pa.ExpectationAngle >= 45 && AM_Pa.ExpectationAngle <= 135)) + { + AM_Pa.ExpectationAngle = 90 - GV.Right_Compensation; + } + else if ((AM_Pa.ExpectationAngle >= -135 && AM_Pa.ExpectationAngle <= -45)) + { + AM_Pa.ExpectationAngle = -90 + GV.Left_Compensation; + } + + //垂直 + else if ((AM_Pa.ExpectationAngle > -45 && AM_Pa.ExpectationAngle < 45)) + { + AM_Pa.ExpectationAngle = 0; + } VehicleAutoForward(angle, GV.PV.Robot_LeftCompensation, GV.PV.Robot_RightCompensation);//自动前进 break; @@ -247,6 +262,21 @@ void Auto() } break; case 4: + //水平 + if ((AM_Pa.ExpectationAngle >= 45 && AM_Pa.ExpectationAngle <= 135)) + { + AM_Pa.ExpectationAngle = 90 + GV.Left_Compensation; + } + if ((AM_Pa.ExpectationAngle >= -135 && AM_Pa.ExpectationAngle <= -45)) + { + AM_Pa.ExpectationAngle = - 90 - GV.Right_Compensation; + } + + //垂直 + if ((AM_Pa.ExpectationAngle > -45 && AM_Pa.ExpectationAngle < 45)) + { + AM_Pa.ExpectationAngle = 0; + } VehicleAutoBackward(angle, GV.PV.Robot_LeftCompensation, GV.PV.Robot_RightCompensation);//自动后退 break;