From f5d0e9108cb62a6ff5965e8a80dff287cf0ee2f2 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Thu, 7 May 2026 15:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E3=80=91=E5=B0=86=E5=88=80=E5=85=B7=E4=BD=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=AF=BB=E5=8F=96=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.settings/language.settings.xml | 4 +-- .../BHBF_Robot_Lifting_Lug/Core/Src/FSM.c | 2 +- .../Core/Src/robot_state.c | 26 +++---------------- .../services/USBSerialPortHelper.java | 2 +- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml index 07f8dd5..15fa460 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c index 4cfdfbe..8fc97c5 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c @@ -467,7 +467,7 @@ 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; - IV.kinfe_position = KinfePosition; + IV.kinfe_position = (KinfePosition == 1000) ? KinfePosition : (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition);// 这里上传的是原始数据,需要APP上缩小20000倍 } void Robot_Control() 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 1979377..11b6e54 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c @@ -250,11 +250,7 @@ void Manual_Up_State_Do(void) if (!Pin2) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; - KinfePosition = 0; - } - else - { - KinfePosition = 1000; //只要不是在步进模式下移动了主轴,且未在限位就恢复为未标定状态 + KinfePosition = GV.LS_FrontEnd_Motor.Real_Position; } } @@ -275,10 +271,6 @@ void Manual_Down_State_Do(void) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; } - else - { - KinfePosition = 1000; //只要不是在步进模式下移动了主轴,且未在限位就恢复为未标定状态 - } } // 定义前端升降电机速度,单位0.1mm/s @@ -300,11 +292,7 @@ void Manual_Low_Speed_Up_State_Do(void) if (!Pin2) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; - KinfePosition = 0; - } - else - { - KinfePosition = 1000; //只要不是在步进模式下移动了主轴,且未在限位就恢复为未标定状态 + KinfePosition = GV.LS_FrontEnd_Motor.Real_Position; } } @@ -325,13 +313,9 @@ void Manual_low_speed_Down_State_Do(void) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; } - else - { - KinfePosition = 1000; //只要不是在步进模式下移动了主轴,且未在限位就恢复为未标定状态 - } } -#define STEP_LEN_COUNT 18000 // 位置环每18000个count对应1mm +#define STEP_LEN_COUNT 20000 // 位置环每20000个count对应1mm void Manual_step_Up_State_Do(void) { @@ -340,7 +324,6 @@ void Manual_step_Up_State_Do(void) int32_t SliderSpeed_PPS = SliderSpeed_mmps_2_pps(leisai_low_speed); GV.LS_FrontEnd_Motor.Target_Position = GV.LS_FrontEnd_Motor.Real_Position - (GV.PV.step_len * STEP_LEN_COUNT); GV.LS_FrontEnd_Motor.Target_Velcity = SliderSpeed_PPS; - KinfePosition -= GV.PV.step_len; StrongSingleShotFlag = 1; } @@ -354,7 +337,7 @@ void Manual_step_Up_State_Do(void) if (!Pin2) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; - KinfePosition = 0; + KinfePosition = GV.LS_FrontEnd_Motor.Real_Position; } } @@ -365,7 +348,6 @@ void Manual_step_Down_State_Do(void) int32_t SliderSpeed_PPS = SliderSpeed_mmps_2_pps(leisai_low_speed); GV.LS_FrontEnd_Motor.Target_Position = GV.LS_FrontEnd_Motor.Real_Position + (GV.PV.step_len * STEP_LEN_COUNT); GV.LS_FrontEnd_Motor.Target_Velcity = SliderSpeed_PPS; - KinfePosition += GV.PV.step_len; StrongSingleShotFlag = 1; } diff --git a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java index 2d613b9..79b26d5 100644 --- a/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java +++ b/diaoerqiege/diaoerqige_V1.0/app/src/main/java/com/example/diaoerqiegeapp/services/USBSerialPortHelper.java @@ -364,7 +364,7 @@ public class USBSerialPortHelper implements SerialInputOutputManager.Listener { } else { - activityPolish.mainBinding.kinfePosition.setText(String.format("%d", _toReceiveIV1.getKinfePosition())); + activityPolish.mainBinding.kinfePosition.setText(String.format("%.2f", (double)_toReceiveIV1.getKinfePosition() / 20000)); } } }