|
|
@ -108,13 +108,25 @@ void Limit_Detection() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t Mode_Select_State = MANUAL_OPERATION; |
|
|
uint8_t Mode_Select_State = MANUAL_OPERATION; |
|
|
|
|
|
uint8_t Mode_Init = 0;// 初始化时第一次升刀的流程
|
|
|
|
|
|
|
|
|
void Mode_Control() |
|
|
void Mode_Control() |
|
|
{ |
|
|
{ |
|
|
Mode_Select_State = GV.PV.robot_operation_mode; |
|
|
if (0 == Mode_Init) |
|
|
|
|
|
{ |
|
|
|
|
|
Mode_Select_State = -255;// 这里单纯是为了区分正常值,对无符号类型赋值为负会使其变为一个大值
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Mode_Select_State = GV.PV.robot_operation_mode; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
switch(Mode_Select_State) |
|
|
switch(Mode_Select_State) |
|
|
{ |
|
|
{ |
|
|
|
|
|
case -255: |
|
|
|
|
|
// 上电时刀具先回到最高位置
|
|
|
|
|
|
Automatic_Init(); |
|
|
|
|
|
break; |
|
|
case MANUAL_OPERATION: |
|
|
case MANUAL_OPERATION: |
|
|
// 机器人本体控制
|
|
|
// 机器人本体控制
|
|
|
Robot_Control(); |
|
|
Robot_Control(); |
|
|
@ -169,6 +181,13 @@ void IO_Control() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Automatic_Init() |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_HALT; |
|
|
|
|
|
CurrentFrontEndState = Manual_UP_STATE; |
|
|
|
|
|
StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#define RISE_KINFE_STATE -11 |
|
|
#define RISE_KINFE_STATE -11 |
|
|
#define FORWARD_STATE 11 |
|
|
#define FORWARD_STATE 11 |
|
|
#define BACKWARD_STATE 21 |
|
|
#define BACKWARD_STATE 21 |
|
|
@ -185,10 +204,10 @@ void Automatic_Laser_Scanning() |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
knife_descent_height = 0; |
|
|
knife_descent_height = 0; |
|
|
|
|
|
|
|
|
|
|
|
StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE; //刀具不转动
|
|
|
|
|
|
|
|
|
if(GV.MK32_Key.CH7_SD == 1000) |
|
|
if(GV.MK32_Key.CH7_SD == 1000) |
|
|
{ |
|
|
{ |
|
|
StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE; //刀具不转动
|
|
|
|
|
|
|
|
|
|
|
|
int32_t a = GV.ZHR29_200_measure_results.laser_sensor_1_measure_distance; |
|
|
int32_t a = GV.ZHR29_200_measure_results.laser_sensor_1_measure_distance; |
|
|
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; |
|
|
@ -245,7 +264,7 @@ void Automatic_Laser_Scanning() |
|
|
ScanTimeCount = HAL_GetTick(); |
|
|
ScanTimeCount = HAL_GetTick(); |
|
|
ScanState = RISE_KINFE_STATE; |
|
|
ScanState = RISE_KINFE_STATE; |
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
MaxLaserSensor = 10000;// 恢复非法值
|
|
|
MaxLaserSensor = 10000;// 恢复非法值
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
@ -253,7 +272,7 @@ void Automatic_Laser_Scanning() |
|
|
ScanTimeCount = HAL_GetTick(); |
|
|
ScanTimeCount = HAL_GetTick(); |
|
|
ScanState = RISE_KINFE_STATE; |
|
|
ScanState = RISE_KINFE_STATE; |
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentMoveState = Move_HALT; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
CurrentFrontEndState = HALT_STATE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|