|
|
@ -150,7 +150,89 @@ void AutoBackSpray_On() |
|
|
} |
|
|
} |
|
|
//--
|
|
|
//--
|
|
|
//--车体停
|
|
|
//--车体停
|
|
|
void Off_AutoSpray() |
|
|
void Off_AutoSpray(MoveSTATE_t MoveState) |
|
|
|
|
|
{ |
|
|
|
|
|
//喷漆自动关闭
|
|
|
|
|
|
if(AutoSpray_Flag == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,1); |
|
|
|
|
|
AutoSpray_Stop_Count++; |
|
|
|
|
|
} |
|
|
|
|
|
//喷漆程序结束
|
|
|
|
|
|
|
|
|
|
|
|
//若自动喷漆启动,计数AutoSpray_Stop_Count*2ms后再停车
|
|
|
|
|
|
if(AutoSpray_Flag == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
if(AutoSpray_Stop_Count <= 250) |
|
|
|
|
|
{ |
|
|
|
|
|
AutoSpray_Flag = 0; |
|
|
|
|
|
AutoSpray_Stop_Count = 0; |
|
|
|
|
|
CurrentMoveState = Move_HALT; //停车
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_HALT; //停车
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//停车,禁止其它置位
|
|
|
|
|
|
if(Current_T_F4_Value.AutoForWard == 1 |
|
|
|
|
|
|| Current_T_F4_Value.AutoBackWard == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GV.AuTo_Flag = 99; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GV.AuTo_Flag = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GV.Chg_Flag = 1; |
|
|
|
|
|
Chg_Pa.change_road_finish_flag = 1; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GV.Chg_Flag = 0; |
|
|
|
|
|
Chg_Pa.change_road_finish_flag = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
void Off_Emergency(MoveSTATE_t MoveState) |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,1); |
|
|
|
|
|
AutoSpray_Flag = 0; |
|
|
|
|
|
CurrentMoveState = Move_HALT; //停车
|
|
|
|
|
|
//停车,禁止其它置位
|
|
|
|
|
|
if(Current_T_F4_Value.AutoForWard == 1 |
|
|
|
|
|
|| Current_T_F4_Value.AutoBackWard == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GV.AuTo_Flag = 99; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GV.AuTo_Flag = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GV.Chg_Flag = 1; |
|
|
|
|
|
Chg_Pa.change_road_finish_flag = 1; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GV.Chg_Flag = 0; |
|
|
|
|
|
Chg_Pa.change_road_finish_flag = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Off_ESpray() |
|
|
{ |
|
|
{ |
|
|
//喷漆自动关闭
|
|
|
//喷漆自动关闭
|
|
|
if(AutoSpray_Flag == 1) |
|
|
if(AutoSpray_Flag == 1) |
|
|
@ -201,10 +283,17 @@ void Off_AutoSpray() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//--
|
|
|
|
|
|
|
|
|
//--
|
|
|
//--
|
|
|
//--探边检测
|
|
|
//--探边检测
|
|
|
void Dangerous_Test() |
|
|
void Dangerous_Test() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if(Current_T_F4_Value.AutoForWard == 0 |
|
|
|
|
|
&& Current_T_F4_Value.AutoBackWard == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//计数,置位标志
|
|
|
//计数,置位标志
|
|
|
//前进探边计数
|
|
|
//前进探边计数
|
|
|
if(GV.Robot_Ultrasonic.USValue_1 >= 5000 || GV.Robot_Ultrasonic.USValue_1 == 0) |
|
|
if(GV.Robot_Ultrasonic.USValue_1 >= 5000 || GV.Robot_Ultrasonic.USValue_1 == 0) |
|
|
@ -374,166 +463,165 @@ void Dangerous_Flag_Delete() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//--遥控器急停判断
|
|
|
|
|
|
void RC_Emergency() |
|
|
//运动部分 Move Region
|
|
|
|
|
|
void Robot_Move() |
|
|
{ |
|
|
{ |
|
|
|
|
|
//--遥控器急停判断
|
|
|
if(Current_T_F4_Value.emergency_stop == 1) |
|
|
if(Current_T_F4_Value.emergency_stop == 1) |
|
|
{ |
|
|
{ |
|
|
GF_BSP_GPIO_SetIO(Out_Spray,1); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(0,1); |
|
|
GF_BSP_GPIO_SetIO(0,1); |
|
|
CurrentMoveState = Move_Emergency; |
|
|
Off_Emergency(Move_Emergency); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.robot_Heart_Error == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(0,1); |
|
|
|
|
|
Off_Emergency(Move_Emergency); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
GF_BSP_GPIO_SetIO(0,0); |
|
|
GF_BSP_GPIO_SetIO(0,0); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GF_Dispatch()//2ms调用一次 给车体速度等赋值
|
|
|
if((Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
{ |
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1 |
|
|
//--遥控器急停判断
|
|
|
|| Current_T_F4_Value.AutoForWard == 1 || Current_T_F4_Value.AutoBackWard == 1) |
|
|
RC_Emergency(); |
|
|
&& (Current_T_F4_Value.robot_forward_backward_speed >= 0X7A |
|
|
//--自动作业模式下的探边检测判断
|
|
|
&& Current_T_F4_Value.robot_forward_backward_speed <= 0X84) |
|
|
if(Current_T_F4_Value.AutoForWard == 1 |
|
|
&& (Current_T_F4_Value.robot_left_right_turn_speed >= 0X7A |
|
|
|| Current_T_F4_Value.AutoBackWard == 1) |
|
|
&& Current_T_F4_Value.robot_left_right_turn_speed <= 0X84) |
|
|
|
|
|
&& GV.Robot_Ultrasonic.Dym_Value_Flag != 1) |
|
|
{ |
|
|
{ |
|
|
Dangerous_Test(); |
|
|
if((Current_T_F4_Value.AutoForWard == 1 || Current_T_F4_Value.AutoBackWard == 1) |
|
|
} |
|
|
&&(Current_T_F4_Value.ChgDown_Ver != 1 && Current_T_F4_Value.ChgUp_Ver != 1 |
|
|
//--
|
|
|
&& Current_T_F4_Value.ChgLeft_Hor != 1 && Current_T_F4_Value.ChgRight_Hor != 1))//自动作业与换道互斥
|
|
|
//--气压判断
|
|
|
{ |
|
|
Dym_Test(); |
|
|
if(Current_T_F4_Value.AutoForWard == 1) |
|
|
//--
|
|
|
{ |
|
|
//运动部分 Move Region
|
|
|
//如启停喷枪按下后判断前进速度到达后,喷漆自动开启
|
|
|
if((Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
AutoForSpray_On(); |
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1 |
|
|
//喷漆程序结束
|
|
|
|| Current_T_F4_Value.AutoForWard == 1 || Current_T_F4_Value.AutoBackWard == 1) |
|
|
} |
|
|
&& (Current_T_F4_Value.robot_forward_backward_speed >= 0X7A |
|
|
else if(Current_T_F4_Value.AutoBackWard == 1) |
|
|
&& Current_T_F4_Value.robot_forward_backward_speed <= 0X84) |
|
|
{ |
|
|
&& (Current_T_F4_Value.robot_left_right_turn_speed >= 0X7A |
|
|
//如启停喷枪按下后判断前进速度到达后,喷漆自动开启
|
|
|
&& Current_T_F4_Value.robot_left_right_turn_speed <= 0X84) |
|
|
AutoBackSpray_On(); |
|
|
&& GV.Robot_Ultrasonic.Dym_Value_Flag != 1) |
|
|
//喷漆程序结束
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if((Current_T_F4_Value.AutoForWard != 1 && Current_T_F4_Value.AutoBackWard != 1) |
|
|
|
|
|
&&(Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(GV.Chg_Flag == 1 && (Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
&& Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
{ |
|
|
{ |
|
|
if((Current_T_F4_Value.AutoForWard == 1 || Current_T_F4_Value.AutoBackWard == 1) |
|
|
CurrentMoveState = Move_ChgFinish; |
|
|
&&(Current_T_F4_Value.ChgDown_Ver != 1 && Current_T_F4_Value.ChgUp_Ver != 1 |
|
|
|
|
|
&& Current_T_F4_Value.ChgLeft_Hor != 1 && Current_T_F4_Value.ChgRight_Hor != 1))//自动作业与换道互斥
|
|
|
|
|
|
{ |
|
|
|
|
|
if(Current_T_F4_Value.AutoForWard == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
//如启停喷枪按下后判断前进速度到达后,喷漆自动开启
|
|
|
|
|
|
AutoForSpray_On(); |
|
|
|
|
|
//喷漆程序结束
|
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.AutoBackWard == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
//如启停喷枪按下后判断前进速度到达后,喷漆自动开启
|
|
|
|
|
|
AutoBackSpray_On(); |
|
|
|
|
|
//喷漆程序结束
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if((Current_T_F4_Value.AutoForWard != 1 && Current_T_F4_Value.AutoBackWard != 1) |
|
|
|
|
|
&&(Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(GV.Chg_Flag == 1 && (Current_T_F4_Value.ChgDown_Ver == 1 || Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
&& Current_T_F4_Value.ChgLeft_Hor == 1 || Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgFinish; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgUp; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgDown; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgLeft; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgRight_Hor == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgRight; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
else if((Current_T_F4_Value.ChgDown_Ver != 1 && Current_T_F4_Value.ChgUp_Ver != 1 |
|
|
else if(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
&& Current_T_F4_Value.ChgLeft_Hor!= 1 && Current_T_F4_Value.ChgRight_Hor != 1 |
|
|
&& !(Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
&& Current_T_F4_Value.AutoForWard != 1 && Current_T_F4_Value.AutoBackWard != 1) |
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
&& (Current_T_F4_Value.robot_forward_backward_speed < 0X7A //7A 84
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|| Current_T_F4_Value.robot_forward_backward_speed > 0X84 |
|
|
|
|
|
|| Current_T_F4_Value.robot_left_right_turn_speed < 0X7A |
|
|
|
|
|
|| Current_T_F4_Value.robot_left_right_turn_speed > 0X84)) |
|
|
|
|
|
{ |
|
|
{ |
|
|
if (Current_T_F4_Value.robot_forward_backward_speed < 0X7A)//前进
|
|
|
CurrentMoveState = Move_ChgUp; |
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_Forwards; |
|
|
|
|
|
} |
|
|
|
|
|
else if (Current_T_F4_Value.robot_forward_backward_speed > 0X84) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_Backwards; //后退
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if (Current_T_F4_Value.robot_left_right_turn_speed < 0X7A) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_TurnLeft; //右转
|
|
|
|
|
|
} |
|
|
|
|
|
else if (Current_T_F4_Value.robot_left_right_turn_speed > 0X84) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_TurnRight; //左转
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else if(Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
{ |
|
|
{ |
|
|
Off_AutoSpray(); |
|
|
CurrentMoveState = Move_ChgDown; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgLeft_Hor == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgRight_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgLeft; |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.ChgRight_Hor == 1 |
|
|
|
|
|
&& !(Current_T_F4_Value.ChgUp_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgDown_Ver == 1 |
|
|
|
|
|
|| Current_T_F4_Value.ChgLeft_Hor == 1)) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_ChgRight; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if((Current_T_F4_Value.ChgDown_Ver != 1 && Current_T_F4_Value.ChgUp_Ver != 1 |
|
|
|
|
|
&& Current_T_F4_Value.ChgLeft_Hor!= 1 && Current_T_F4_Value.ChgRight_Hor != 1 |
|
|
|
|
|
&& Current_T_F4_Value.AutoForWard != 1 && Current_T_F4_Value.AutoBackWard != 1) |
|
|
|
|
|
&& (Current_T_F4_Value.robot_forward_backward_speed < 0X7A //7A 84
|
|
|
|
|
|
|| Current_T_F4_Value.robot_forward_backward_speed > 0X84 |
|
|
|
|
|
|| Current_T_F4_Value.robot_left_right_turn_speed < 0X7A |
|
|
|
|
|
|| Current_T_F4_Value.robot_left_right_turn_speed > 0X84)) |
|
|
|
|
|
{ |
|
|
|
|
|
if (Current_T_F4_Value.robot_forward_backward_speed < 0X7A)//前进
|
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_Forwards; |
|
|
|
|
|
} |
|
|
|
|
|
else if (Current_T_F4_Value.robot_forward_backward_speed > 0X84) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_Backwards; //后退
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//--探边置位消除
|
|
|
else if (Current_T_F4_Value.robot_left_right_turn_speed < 0X7A) |
|
|
Dangerous_Flag_Delete(); |
|
|
{ |
|
|
//--
|
|
|
CurrentMoveState = Move_TurnLeft; //右转
|
|
|
|
|
|
} |
|
|
|
|
|
else if (Current_T_F4_Value.robot_left_right_turn_speed > 0X84) |
|
|
|
|
|
{ |
|
|
|
|
|
CurrentMoveState = Move_TurnRight; //左转
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Off_AutoSpray(Move_HALT); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/****************************************/ |
|
|
void GF_Dispatch()//2ms调用一次 给车体速度等赋值
|
|
|
//LU_Three控制升降
|
|
|
{ |
|
|
if(Current_T_F4_Value.Lift_Up == 1) |
|
|
//--气压判断
|
|
|
{ |
|
|
Dym_Test(); |
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,0); |
|
|
//--自动作业模式下的探边检测判断
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,1); |
|
|
Dangerous_Test(); |
|
|
} |
|
|
//--探边置位消除
|
|
|
else if(Current_T_F4_Value.Lift_Down == 1) |
|
|
Dangerous_Flag_Delete(); |
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,1); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,0); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,1); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//控制电磁阀喷枪
|
|
|
Robot_Move(); |
|
|
if(Current_T_F4_Value.FA && AutoSpray_Flag == 0) // && CurrentMoveState != Move_AutoForward&& CurrentMoveState != Move_AutoBackward)
|
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,0); |
|
|
|
|
|
} |
|
|
|
|
|
else if(!Current_T_F4_Value.FA && AutoSpray_Flag == 0) // && CurrentMoveState != Move_AutoForward && CurrentMoveState != Move_AutoBackward)
|
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************/ |
|
|
|
|
|
//LU_Three控制升降
|
|
|
|
|
|
if(Current_T_F4_Value.Lift_Up == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,0); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,1); |
|
|
|
|
|
} |
|
|
|
|
|
else if(Current_T_F4_Value.Lift_Down == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,1); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,0); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_2,1); |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Lift_1,1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//控制电磁阀喷枪
|
|
|
|
|
|
if(Current_T_F4_Value.FA && AutoSpray_Flag == 0) // && CurrentMoveState != Move_AutoForward&& CurrentMoveState != Move_AutoBackward)
|
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,0); |
|
|
|
|
|
} |
|
|
|
|
|
else if(!Current_T_F4_Value.FA && AutoSpray_Flag == 0) // && CurrentMoveState != Move_AutoForward && CurrentMoveState != Move_AutoBackward)
|
|
|
|
|
|
{ |
|
|
|
|
|
GF_BSP_GPIO_SetIO(Out_Spray,1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//计算速度档位m/min
|
|
|
//计算速度档位m/min
|
|
|
GV.Robot_Speed_mpm = Speed_Judge(&Current_T_F4_Value); |
|
|
GV.Robot_Speed_mpm = Speed_Judge(&Current_T_F4_Value); |
|
|
@ -547,12 +635,18 @@ void GF_Dispatch()//2ms调用一次 给车体速度等赋值 |
|
|
GV.Right_Compensation = Current_T_F4_Value.robot_Compensation_Right / 51.0; |
|
|
GV.Right_Compensation = Current_T_F4_Value.robot_Compensation_Right / 51.0; |
|
|
|
|
|
|
|
|
action_perfrom(MoveTransitions, sizeof(MoveTransitions) / sizeof(transition_t), CurrentMoveState);//结构体数组/大小/当前状态
|
|
|
action_perfrom(MoveTransitions, sizeof(MoveTransitions) / sizeof(transition_t), CurrentMoveState);//结构体数组/大小/当前状态
|
|
|
// action_perfrom(SwingTransitions,sizeof(SwingTransitions) / sizeof(transition_t), CurrentSwingState);
|
|
|
|
|
|
// action_perfrom(TiltTransitions, sizeof(TiltTransitions) / sizeof(transition_t), CurrentTiltState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GV.Robot_State = CurrentMoveState; |
|
|
|
|
|
if((GV.LeftFrontMotor.ERROR_Flag != 0 || GV.RightFrontMotor.ERROR_Flag != 0) |
|
|
|
|
|
&& Current_T_F4_Value.emergency_stop != 1) |
|
|
|
|
|
{ |
|
|
|
|
|
GV.Robot_State = Move_Error; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void action_perfrom(transition_t transitions[], int length, int state) |
|
|
void action_perfrom(transition_t transitions[], int length, int state) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|