From e424bd04ca0d5857e6384f8435fa5fc610f79a59 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Fri, 4 Sep 2026 16:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=80=E4=B8=AA=E5=85=A8?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project_old/paint_robot_old/FSM/Inc/fsm_state_control.h | 2 +- project_old/paint_robot_old/FSM/Inc/robot_move_actions.h | 2 +- project_old/paint_robot_old/FSM/Src/fsm_state_control.c | 8 +++----- project_old/paint_robot_old/FSM/Src/robot_move_actions.c | 5 +++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/project_old/paint_robot_old/FSM/Inc/fsm_state_control.h b/project_old/paint_robot_old/FSM/Inc/fsm_state_control.h index 0f1281c..4a83ab8 100644 --- a/project_old/paint_robot_old/FSM/Inc/fsm_state_control.h +++ b/project_old/paint_robot_old/FSM/Inc/fsm_state_control.h @@ -18,7 +18,7 @@ void GF_Dispatch(); void IV_control(); void MoveControl(); -int32_t GetVehicleSpeed( ); + extern int32_t speed_selection; extern char is_upper_computer_take_over_control; #endif /* FSM_INC_FSM_STATE_CONTROL_H_ */ diff --git a/project_old/paint_robot_old/FSM/Inc/robot_move_actions.h b/project_old/paint_robot_old/FSM/Inc/robot_move_actions.h index b6a6421..6da5da2 100644 --- a/project_old/paint_robot_old/FSM/Inc/robot_move_actions.h +++ b/project_old/paint_robot_old/FSM/Inc/robot_move_actions.h @@ -36,7 +36,7 @@ extern void Move_Head_To_Right_Do(transition_t *p_this); extern void HALT_State_Enter(transition_t *p_this); extern void HALT_State_Exit(transition_t *p_this); -extern int32_t GetVehicleSpeed(int speed_selection); +extern int32_t GetVehicleSpeed(); extern int32_t* DHRoughening_Speed[10]; diff --git a/project_old/paint_robot_old/FSM/Src/fsm_state_control.c b/project_old/paint_robot_old/FSM/Src/fsm_state_control.c index 9b9c7b7..0ee204a 100644 --- a/project_old/paint_robot_old/FSM/Src/fsm_state_control.c +++ b/project_old/paint_robot_old/FSM/Src/fsm_state_control.c @@ -35,7 +35,6 @@ void paint_joysticker_manual_control(); int AbnormalDetect();//异常检测); char is_upper_computer_take_over_control=0; int CH13_S2_Value ; -int32_t speed_selection=0; //旋钮速度0-30 int paintOffCount=0; //5° 计数 超过1s 关枪 uint8_t angle_protect_lock=0; //作业时角度偏差过5°,停车标记位 int32_t power_on_lock = 0; /*上电锁*/ @@ -169,9 +168,8 @@ void MoveControl() } /* 速度选择索引 0-30 */ - speed_selection = 3 * (P_MK32->CH11_RD1 + 1000) / 200; - GV.Robot_Move_Speed = speed_M_min_toE01_M_min( GetVehicleSpeed(speed_selection) );/*获取旋钮速度*/ - IV.RobotMoveSpeed= GetVehicleSpeed(speed_selection); + GV.Robot_Move_Speed = speed_M_min_toE01_M_min( GetVehicleSpeed() );/*获取旋钮速度*/ + IV.RobotMoveSpeed= GetVehicleSpeed(); //换道优先级优于普通的运行; if (LaneChangeControl_Paint() == 1) @@ -367,7 +365,7 @@ void IV_control() /* 返回值是脉冲/s P*60/10000/70/(Πd)=V */ IV.CurrentSpeed=GV.LeftMotor.Real_Velcity*60.0/CV.pulse_Per_Circle/CV.wheel_Reduction_Ratio*M_PI*CV.wheel_Diameter_m; - IV.RobotMoveSpeed=GetVehicleSpeed(speed_selection); + IV.RobotMoveSpeed=GetVehicleSpeed(); IV.CurrentAngle = GV.Robot_Angle; IV.SBUS_State=GV.P_MK32.IsOnline; IV.SystemError = GV.SystemErrorData.Com_Error_Code; /* SystemErrorCode = &GV.SystemErrorData.Com_Error_Code; */ diff --git a/project_old/paint_robot_old/FSM/Src/robot_move_actions.c b/project_old/paint_robot_old/FSM/Src/robot_move_actions.c index 2bf8be0..44d8479 100644 --- a/project_old/paint_robot_old/FSM/Src/robot_move_actions.c +++ b/project_old/paint_robot_old/FSM/Src/robot_move_actions.c @@ -89,7 +89,7 @@ void HALT_State_Do(transition_t *p_this) } if (CompareTimer( - 600 * CV.Paint_Gun_Shutdown_Distance / GetVehicleSpeed( speed_selection), + 600 * CV.Paint_Gun_Shutdown_Distance / GetVehicleSpeed(), &timer_handler_3)) //喷枪开 计时停 关 直接停 { IsRobotHaltSateChangedFlag = 0; @@ -302,8 +302,9 @@ void Calbrate_Robot_Positon(int Target_Angle) /* 车体速度选择 具体车速在配置结构体CV 0.01m/min */ -int32_t GetVehicleSpeed(int speed_selection) +int32_t GetVehicleSpeed(void) { + int speed_selection = 3 * (P_MK32->CH11_RD1 + 1000) / 200; if(speed_selection==0) { return 1;