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)); } } }