|
|
@ -50,7 +50,7 @@ static PV_struct_define g_stPV; |
|
|
static IV_struct_define g_stIV; |
|
|
static IV_struct_define g_stIV; |
|
|
static int g_Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位
|
|
|
static int g_Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位
|
|
|
static int g_ichangLineState = 0; // 换道状态,0表示起始状态,1表示第一次旋转完成,2表示计时行走 完成
|
|
|
static int g_ichangLineState = 0; // 换道状态,0表示起始状态,1表示第一次旋转完成,2表示计时行走 完成
|
|
|
static int g_bNotTable = 0; |
|
|
static int g_iRobot_Move_State = 0; // 机器人状态0表示默认,1表示调用TIMER_CMD_STRAIGHT_DRIVE
|
|
|
|
|
|
|
|
|
static int g_iLeft_Compensation = 0; |
|
|
static int g_iLeft_Compensation = 0; |
|
|
static int g_iRight_Compensation = 0; |
|
|
static int g_iRight_Compensation = 0; |
|
|
@ -498,7 +498,7 @@ static void Move_Halt_AngleError(void) |
|
|
|
|
|
|
|
|
void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
{ |
|
|
{ |
|
|
if (0 == g_bNotTable) g_bNotTable = 1; |
|
|
g_iRobot_Move_State = 0; |
|
|
// 急停
|
|
|
// 急停
|
|
|
if (_pstMK32->CH8_SE == -1000 && _pstMK32->CH9_SF == -1000) |
|
|
if (_pstMK32->CH8_SE == -1000 && _pstMK32->CH9_SF == -1000) |
|
|
{ |
|
|
{ |
|
|
@ -562,22 +562,6 @@ void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_stAngleError_Ctl.m_iPaintState, sizeof(int)); |
|
|
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_stAngleError_Ctl.m_iPaintState, sizeof(int)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if(_iMode == 2 || _iMode == 3) |
|
|
|
|
|
{ |
|
|
|
|
|
if (_pstMK32->CH13_S2 != g_iS2LastValue) |
|
|
|
|
|
{ |
|
|
|
|
|
if(g_stIV.CurrentSpeed != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
g_stAngleError_Ctl.m_iPaintState = 0; |
|
|
|
|
|
MsgCenter_SendTo(MODULE_NAME_CUSTOM, CUSTOM_CMD_PAINTGUN, &g_stAngleError_Ctl.m_iPaintState, sizeof(int)); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//log_w("cannot open paint with 0 move speed !");
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
g_iS2LastValue = _pstMK32->CH13_S2; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int aiMotorSpeed[2] = {0}; //0索引表示左,1索引表示右,多轮时到对应motor的MOTOR_CMD_SET_SPEED命令自行处理
|
|
|
int aiMotorSpeed[2] = {0}; //0索引表示左,1索引表示右,多轮时到对应motor的MOTOR_CMD_SET_SPEED命令自行处理
|
|
|
@ -595,6 +579,8 @@ void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
} |
|
|
} |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
{ |
|
|
{ |
|
|
|
|
|
g_iRobot_Move_State = 1; |
|
|
|
|
|
Robot_Paint_SP(); |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
{ |
|
|
{ |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
@ -621,6 +607,8 @@ void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
} |
|
|
} |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
{ |
|
|
{ |
|
|
|
|
|
g_iRobot_Move_State = 1; |
|
|
|
|
|
Robot_Paint_SP(); |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
{ |
|
|
{ |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
@ -666,6 +654,8 @@ void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
} |
|
|
} |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
{ |
|
|
{ |
|
|
|
|
|
g_iRobot_Move_State = 1; |
|
|
|
|
|
Robot_Paint_SP(); |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
{ |
|
|
{ |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
@ -691,6 +681,8 @@ void MK32_Key_Func(SP_MSP_MK32_Button *_pstMK32, int _iMode, int _iSubMode) |
|
|
} |
|
|
} |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
else if (_iMode == 2 || _iMode == 3) |
|
|
{ |
|
|
{ |
|
|
|
|
|
g_iRobot_Move_State = 1; |
|
|
|
|
|
Robot_Paint_SP(); |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
if (0 == g_stAngleError_Ctl.m_iAnglelock) |
|
|
{ |
|
|
{ |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
@ -931,8 +923,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
lua_print("PV Info\n"); |
|
|
lua_print("PV Info\n"); |
|
|
lua_print("{%d, %d, %d, %d, %d, %ld}\n", |
|
|
lua_print("{%d, %d, %d, %d, %d, %ld}\n", |
|
|
g_stPV.RunMode, g_stPV.RobotSpeed, g_stPV.LaneChangeDistance, (int)g_stPV.Vertical_Calibration, g_stPV.IV_IsRestart_Notified, (long long)g_stPV.TimeStamp); |
|
|
g_stPV.RunMode, g_stPV.RobotSpeed, g_stPV.LaneChangeDistance, (int)g_stPV.Vertical_Calibration, g_stPV.IV_IsRestart_Notified, (long long)g_stPV.TimeStamp); |
|
|
lua_print("\niPaint = %d\ng_stAngleError_Ctl.m_iPaintState = %d\ng_stAngleError_Ctl.m_iAnglelock = %d\ng_stAngleError_Ctl.m_ipaintOffCount = %d\ng_Is_All_Button_Reset = %d\ng_bNotTable = %d\n", |
|
|
lua_print("\niPaint = %d\ng_stAngleError_Ctl.m_iPaintState = %d\ng_stAngleError_Ctl.m_iAnglelock = %d\ng_stAngleError_Ctl.m_ipaintOffCount = %d\ng_Is_All_Button_Reset = %d\n", |
|
|
g_iPaint, g_stAngleError_Ctl.m_iPaintState, g_stAngleError_Ctl.m_iAnglelock, g_stAngleError_Ctl.m_ipaintOffCount, g_Is_All_Button_Reset, g_bNotTable); |
|
|
g_iPaint, g_stAngleError_Ctl.m_iPaintState, g_stAngleError_Ctl.m_iAnglelock, g_stAngleError_Ctl.m_ipaintOffCount, g_Is_All_Button_Reset); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
default: |
|
|
default: |
|
|
|