|
|
@ -119,6 +119,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
|
|
|
|
|
static int iLeft_Compensation = 0; |
|
|
static int iLeft_Compensation = 0; |
|
|
static int iRight_Compensation = 0; |
|
|
static int iRight_Compensation = 0; |
|
|
|
|
|
static int iVehicleSpeed = 1; |
|
|
switch (pstMsg->m_uiMsgID) |
|
|
switch (pstMsg->m_uiMsgID) |
|
|
{ |
|
|
{ |
|
|
case CUSTOM_GET_DAEMON_CODE: |
|
|
case CUSTOM_GET_DAEMON_CODE: |
|
|
@ -198,7 +199,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = 1, |
|
|
.m_iMode = 1, |
|
|
.m_iAngle = g_stCV.RobotLeftAngleValue + iLeft_Compensation, |
|
|
.m_iAngle = g_stCV.RobotLeftAngleValue + iLeft_Compensation, |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin() |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin(), |
|
|
|
|
|
.m_iSpeed = g_stCV.Lane_Change_Speed_m_per_min |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -207,7 +209,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = -1, |
|
|
.m_iMode = -1, |
|
|
.m_iAngle = g_stCV.RobotLeftAngleValue - iRight_Compensation, |
|
|
.m_iAngle = g_stCV.RobotLeftAngleValue - iRight_Compensation, |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin() |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin(), |
|
|
|
|
|
.m_iSpeed = g_stCV.Lane_Change_Speed_m_per_min |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -219,7 +222,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = -1, |
|
|
.m_iMode = -1, |
|
|
.m_iAngle = g_stCV.RobotRightAngleValue + iLeft_Compensation, |
|
|
.m_iAngle = g_stCV.RobotRightAngleValue + iLeft_Compensation, |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin() |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin(), |
|
|
|
|
|
.m_iSpeed = g_stCV.Lane_Change_Speed_m_per_min |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -228,7 +232,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = 1, |
|
|
.m_iMode = 1, |
|
|
.m_iAngle = g_stCV.RobotRightAngleValue - iRight_Compensation, |
|
|
.m_iAngle = g_stCV.RobotRightAngleValue - iRight_Compensation, |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin() |
|
|
.m_iTime = RunTime_DistanceCm_SpeedE_2MPMin(), |
|
|
|
|
|
.m_iSpeed = g_stCV.Lane_Change_Speed_m_per_min |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -307,7 +312,6 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
|
|
|
|
|
|
// 更新速度旋钮值
|
|
|
// 更新速度旋钮值
|
|
|
int iSpeedSelection = 3 * (g_stMK32.CH11_RD1 + 1000) / 200; |
|
|
int iSpeedSelection = 3 * (g_stMK32.CH11_RD1 + 1000) / 200; |
|
|
int iVehicleSpeed = 1; |
|
|
|
|
|
if (iSpeedSelection > 0) |
|
|
if (iSpeedSelection > 0) |
|
|
{ |
|
|
{ |
|
|
iVehicleSpeed = g_stCV.Speed_m_per_min*iSpeedSelection/30; |
|
|
iVehicleSpeed = g_stCV.Speed_m_per_min*iSpeedSelection/30; |
|
|
@ -405,7 +409,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = 1, |
|
|
.m_iMode = 1, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iTime = -1 |
|
|
.m_iTime = -1, |
|
|
|
|
|
.m_iSpeed = iVehicleSpeed |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -426,7 +431,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = -1, |
|
|
.m_iMode = -1, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iTime = -1 |
|
|
.m_iTime = -1, |
|
|
|
|
|
.m_iSpeed = iVehicleSpeed |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -460,7 +466,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = 1, |
|
|
.m_iMode = 1, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iTime = -1 |
|
|
.m_iTime = -1, |
|
|
|
|
|
.m_iSpeed = iVehicleSpeed |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
@ -480,7 +487,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
BHBF_straight_drive_Cmd stCmd = { |
|
|
.m_iMode = -1, |
|
|
.m_iMode = -1, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iAngle = g_stCV.RobotUpAngleValue + g_stPV.Vertical_Calibration, |
|
|
.m_iTime = -1 |
|
|
.m_iTime = -1, |
|
|
|
|
|
.m_iSpeed = iVehicleSpeed |
|
|
}; |
|
|
}; |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
MsgCenter_SendTo(MODULE_NAME_TIMER, TIMER_CMD_STRAIGHT_DRIVE, &stCmd, sizeof(stCmd)); |
|
|
} |
|
|
} |
|
|
|