From 98ac55ad353ccc5bf09b62f7c96568d738ad8c0e Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Fri, 30 Oct 2026 15:35:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8A=E8=80=B3=E5=88=87=E5=89=B2=E3=80=90?= =?UTF-8?q?=E8=B0=83=E9=80=9A=E6=89=93=E6=A0=87=E3=80=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=AD=A5=E8=BF=9B=E8=BF=9B=E8=BD=A6=E9=80=9F=E5=BA=A6=E5=86=99?= =?UTF-8?q?=E6=AD=BB1m/min=EF=BC=88=E6=94=B9=E9=80=9F=E5=BA=A6=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9B=91=E6=8E=A7IV.Robot=5FMove=5FSpeed=E5=92=8CRef?= =?UTF-8?q?=5FSpeed=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/Src/robot_state.c | 63 ++++++++++++++++--- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c index d33bbad..d78382a 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c @@ -60,6 +60,10 @@ void SetMoveMotorSpeed(float Speed) } } +#define ONCE_MOVE_COUNT 45 +int g_iMoveCount = 0; +int g_iMoveOnce = 0; + void Manual_State_Do(void) { double Rocker_Range = 2000; //摇杆范围 @@ -233,15 +237,58 @@ void low_Speed_Manual_State_Do(void) } else { - R1_Speed_Con = 0; - L1_Speed_Con = 0; - R2_Speed_Con = 0; - L2_Speed_Con = 0; + int iTargetTimeCount = (int)(ONCE_MOVE_COUNT / 1 * 45);//车速写死1m/min + if (GV.MK32_Key.CH5_SB == -1000) + { + if (g_iMoveOnce == 0) + { + g_iMoveOnce = 1; + g_iMoveCount = HAL_GetTick(); + } + R1_Speed_Con = -1; + L1_Speed_Con = 1; + R2_Speed_Con = -1; + L2_Speed_Con = 1; + if (HAL_GetTick() - g_iMoveCount > iTargetTimeCount) + { + R1_Speed_Con = 0; + L1_Speed_Con = 0; + R2_Speed_Con = 0; + L2_Speed_Con = 0; + } + } + else if (GV.MK32_Key.CH5_SB == 1000) + { + if (g_iMoveOnce == 0) + { + g_iMoveOnce = 1; + g_iMoveCount = HAL_GetTick(); + } + R1_Speed_Con = 1; + L1_Speed_Con = -1; + R2_Speed_Con = 1; + L2_Speed_Con = -1; + if (HAL_GetTick() - g_iMoveCount > iTargetTimeCount) + { + R1_Speed_Con = 0; + L1_Speed_Con = 0; + R2_Speed_Con = 0; + L2_Speed_Con = 0; + } + } + else + { + g_iMoveOnce = 0; + R1_Speed_Con = 0; + L1_Speed_Con = 0; + R2_Speed_Con = 0; + L2_Speed_Con = 0; + } } - GV.LeftFrontMotor.Target_Velcity = L1_Speed_Con * Ref_Speed; - GV.RightFrontMotor.Target_Velcity = R1_Speed_Con * Ref_Speed; - GV.LeftBackMotor.Target_Velcity = L2_Speed_Con * Ref_Speed; - GV.RightBackMotor.Target_Velcity = R2_Speed_Con * Ref_Speed; + GV.LeftFrontMotor.Target_Velcity = L1_Speed_Con * 166;//166对应1m/min + GV.RightFrontMotor.Target_Velcity = R1_Speed_Con * 166; + GV.LeftBackMotor.Target_Velcity = L2_Speed_Con * 166; + GV.RightBackMotor.Target_Velcity = R2_Speed_Con * 166; } void high_Speed_Manual_State_Do(void)