|
|
@ -173,7 +173,7 @@ void IO_Control() |
|
|
#define FORWARD_STATE 11 |
|
|
#define FORWARD_STATE 11 |
|
|
#define BACKWARD_STATE 21 |
|
|
#define BACKWARD_STATE 21 |
|
|
|
|
|
|
|
|
int32_t MaxLaserSensor = -255; // 激光传感器最大值,初始化为非法值
|
|
|
int32_t MaxLaserSensor = 10000; // 激光传感器最大值,初始化为非法值
|
|
|
int32_t knife_descent_height = -255; // "下降高度"迭代值,初始赋值为非法值
|
|
|
int32_t knife_descent_height = -255; // "下降高度"迭代值,初始赋值为非法值
|
|
|
int32_t ScanTimeCount = 0; |
|
|
int32_t ScanTimeCount = 0; |
|
|
int32_t ScanState = RISE_KINFE_STATE; |
|
|
int32_t ScanState = RISE_KINFE_STATE; |
|
|
@ -183,8 +183,9 @@ void Automatic_Laser_Scanning() |
|
|
{ |
|
|
{ |
|
|
CurrentMoveState = Manual_State; |
|
|
CurrentMoveState = Manual_State; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
|
|
|
knife_descent_height = 0; |
|
|
|
|
|
|
|
|
if(GV.MK32_Key.CH7_SD == -1000) |
|
|
if(GV.MK32_Key.CH7_SD == 1000) |
|
|
{ |
|
|
{ |
|
|
StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE; //刀具不转动
|
|
|
StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE; //刀具不转动
|
|
|
|
|
|
|
|
|
@ -192,9 +193,11 @@ void Automatic_Laser_Scanning() |
|
|
int32_t b = GV.ZHR29_200_measure_results.laser_sensor_2_measure_distance; |
|
|
int32_t b = GV.ZHR29_200_measure_results.laser_sensor_2_measure_distance; |
|
|
int32_t c = GV.ZHR29_200_measure_results.laser_sensor_3_measure_distance; |
|
|
int32_t c = GV.ZHR29_200_measure_results.laser_sensor_3_measure_distance; |
|
|
|
|
|
|
|
|
|
|
|
if (a != 0 && b != 0 && c != 0) |
|
|
|
|
|
{ |
|
|
int32_t max = (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c); |
|
|
int32_t max = (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c); |
|
|
|
|
|
|
|
|
MaxLaserSensor = (max < MaxLaserSensor) ? max : MaxLaserSensor; |
|
|
MaxLaserSensor = (max < MaxLaserSensor) ? max : MaxLaserSensor; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#if 0 |
|
|
#if 0 |
|
|
if (RISE_KINFE_STATE == ScanState) |
|
|
if (RISE_KINFE_STATE == ScanState) |
|
|
@ -258,7 +261,7 @@ void Automatic_Operation() |
|
|
int32_t knife_current_altitude = 0; // 激光1读数
|
|
|
int32_t knife_current_altitude = 0; // 激光1读数
|
|
|
uint8_t IsAllowRotation_AutoMode = 0; // 是否允许转刀
|
|
|
uint8_t IsAllowRotation_AutoMode = 0; // 是否允许转刀
|
|
|
|
|
|
|
|
|
if (-255 == knife_descent_height && -255 == MaxLaserSensor) |
|
|
if (-255 == knife_descent_height) |
|
|
{ |
|
|
{ |
|
|
// 跑到这说明一上来直接自动作业了,没有先进行扫描
|
|
|
// 跑到这说明一上来直接自动作业了,没有先进行扫描
|
|
|
return; |
|
|
return; |
|
|
@ -310,7 +313,7 @@ void Automatic_Operation() |
|
|
else if(GV.MK32_Key.CH7_SD == 1000) |
|
|
else if(GV.MK32_Key.CH7_SD == 1000) |
|
|
{ |
|
|
{ |
|
|
knife_flag = 1; // 关闭自动作业时恢复标志
|
|
|
knife_flag = 1; // 关闭自动作业时恢复标志
|
|
|
MaxLaserSensor = -255; // 恢复为未扫描状态
|
|
|
MaxLaserSensor = 10000; // 恢复为未扫描状态
|
|
|
knife_descent_height = -255; // 恢复为未扫描状态
|
|
|
knife_descent_height = -255; // 恢复为未扫描状态
|
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
|