From 712722777d213e09fef06068cbe58fdd392b2f70 Mon Sep 17 00:00:00 2001
From: Lizongdi <1210855344@qq.com>
Date: Tue, 12 May 2026 15:04:50 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E9=80=9A=E6=89=93=E6=A0=87?=
=?UTF-8?q?=E3=80=91=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B7=BB=E5=8A=A0=E5=8D=95?=
=?UTF-8?q?=E7=8B=AC=E6=A8=A1=E5=BC=8F=EF=BC=9B=E4=B9=8B=E5=89=8D=E9=81=97?=
=?UTF-8?q?=E7=95=99=E4=BB=A3=E7=A0=81=E5=85=A8=E9=83=A8=E8=B0=83=E9=80=9A?=
=?UTF-8?q?=EF=BC=9B=E8=A7=A3=E5=86=B3=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=8C?=
=?UTF-8?q?=E6=AF=95=E6=97=B6=E9=9B=B6=E4=BD=8D=E6=98=BE=E7=A4=BA=E4=B8=BA?=
=?UTF-8?q?=E8=B4=9F=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h | 3 +-
.../BHBF_Robot_Lifting_Lug/Core/Src/FSM.c | 12 +++-
.../Core/Src/robot_state.c | 58 +++++--------------
.../.settings/language.settings.xml | 4 +-
4 files changed, 29 insertions(+), 48 deletions(-)
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
index 8ac6494..c72102f 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
@@ -39,7 +39,8 @@ typedef enum _Strong_Grinding_Machine_MoveSTATE_t
typedef enum _Robot_Operation_Mode_t
{
- MANUAL_OPERATION = 1,
+ INIT_OPERATION = 1,
+ MANUAL_OPERATION,
AUTO_OPERATION,
AUTO_LASER_SCAN
} Robot_Operation_Mode_t;
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
index 14ada2d..e4ef2f8 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
@@ -114,7 +114,7 @@ void Mode_Control()
{
if (0 == Mode_Init)
{
- Mode_Select_State = -255;// 这里单纯是为了区分正常值,对无符号类型赋值为负会使其变为一个大值
+ Mode_Select_State = INIT_OPERATION;
}
else
{
@@ -123,7 +123,7 @@ void Mode_Control()
switch(Mode_Select_State)
{
- case -255:
+ case INIT_OPERATION:
// 上电时刀具先回到最高位置
Automatic_Init();
break;
@@ -299,7 +299,7 @@ void Automatic_Operation()
if (knife_flag)
{
// 由于这里是循环,每次开自动作业只执行一次
- knife_descent_height += GV.PV.knife_descending_height * 100;
+ knife_descent_height += GV.PV.step_len * 100;
knife_flag = 0;
}
@@ -556,6 +556,12 @@ void IV_Control()
IV.laser_sensor_2_measure_distance = GV.ZHR29_200_measure_results.laser_sensor_2_measure_distance;
IV.laser_sensor_3_measure_distance = GV.ZHR29_200_measure_results.laser_sensor_3_measure_distance;
IV.kinfe_complete_signal = IsAllowRotation;
+
+ if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition < 0)
+ {
+ KinfePosition = GV.LS_FrontEnd_Motor.Real_Position; // 这里是确保不会出现负值
+ }
+
IV.kinfe_position = (KinfePosition == 1000) ? KinfePosition : (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition);// 这里上传的是原始数据,需要APP上缩小20000倍
IV.max_laser_sensor = MaxLaserSensor;
}
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 4451a23..aa84a89 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c
@@ -238,6 +238,19 @@ int StrongSingleShotFlag = 0;
extern uint8_t Mode_Init;// 初始化时第一次升刀的流程
+static void LimitDownPosition(void)
+{
+ if (!Pin3)
+ {
+ GV.LS_FrontEnd_Motor.Target_Velcity = 0;
+ }
+
+ if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
+ {
+ GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
+ }
+}
+
void Manual_Up_State_Do(void)
{
int32_t SliderSpeed_PPS = SliderSpeed_mmps_2_pps(SliderSpeed);
@@ -257,11 +270,6 @@ void Manual_Up_State_Do(void)
KinfePosition = GV.LS_FrontEnd_Motor.Real_Position;
Mode_Init = 1;// 表示自动初始化完成
}
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
}
void Manual_Down_State_Do(void)
@@ -277,15 +285,7 @@ void Manual_Down_State_Do(void)
GV.LS_FrontEnd_Motor.Target_Velcity = 0;
}*/
- if (!Pin3)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0;
- }
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
+ LimitDownPosition();
}
// 定义前端升降电机速度,单位0.1mm/s
@@ -310,11 +310,6 @@ void Manual_Low_Speed_Up_State_Do(void)
KinfePosition = GV.LS_FrontEnd_Motor.Real_Position;
Mode_Init = 1;// 表示自动初始化完成
}
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
}
void Manual_low_speed_Down_State_Do(void)
@@ -330,15 +325,7 @@ void Manual_low_speed_Down_State_Do(void)
GV.LS_FrontEnd_Motor.Target_Velcity = 0;
}*/
- if (!Pin3)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0;
- }
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
+ LimitDownPosition();
}
#define STEP_LEN_COUNT 20000 // 位置环每20000个count对应1mm
@@ -366,11 +353,6 @@ void Manual_step_Up_State_Do(void)
KinfePosition = GV.LS_FrontEnd_Motor.Real_Position;
Mode_Init = 1;// 表示自动初始化完成
}
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
}
void Manual_step_Down_State_Do(void)
@@ -390,15 +372,7 @@ void Manual_step_Down_State_Do(void)
GV.LS_FrontEnd_Motor.Target_Velcity = 0;
}*/
- if (!Pin3)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0;
- }
-
- if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
- {
- GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停
- }
+ LimitDownPosition();
}
void FrontEnd_Halt_State_Do(void)
diff --git a/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml b/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
index e4dea11..a25c702 100644
--- a/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
+++ b/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+