diff --git a/RBcore/BHBF.c b/RBcore/BHBF.c index 787846c..9004f98 100644 --- a/RBcore/BHBF.c +++ b/RBcore/BHBF.c @@ -59,7 +59,7 @@ static void RBcore_ModuleHandler(const Msg_t *pstMsg) static int aiMotorSpeed[2] = {0}; //0索引表示左,1索引表示右,多轮时到对应motor的MOTOR_CMD_SET_SPEED命令自行处理 switch (pstMsg->m_uiMsgID) { - case CMD_STOP_ALL: + case RBCORE_CMD_STOP_ALL: { MsgCenter_SendTo(MODULE_NAME_MOTOR, pstMsg->m_uiMsgID, NULL, 0); break; diff --git a/RBcore/drv_interface.c b/RBcore/drv_interface.c index e2e224c..dc86928 100644 --- a/RBcore/drv_interface.c +++ b/RBcore/drv_interface.c @@ -265,6 +265,7 @@ extern void ground_manger_init(void); extern void Custom_Task(void *argument); void SendIV_Init(void); void TL720D_Init(void); +void RBcore_Init(void); void Drv_InterfaceInit(void) { diff --git a/RBcore/include/BHBF.h b/RBcore/include/BHBF.h index c4f0c7f..5e216cc 100644 --- a/RBcore/include/BHBF.h +++ b/RBcore/include/BHBF.h @@ -62,7 +62,6 @@ extern "C"{ #include "drv_interface.h" #include "rd_time.h" #include "cmsis_os.h" -#include "FreeRTOS.h" #include /*==============================================* @@ -80,11 +79,14 @@ typedef enum { MOTOR_GET_FAULT_CODE, // 获取错误码 MOTOR_CMD_END = 0x0100, - CMD_STOP_ALL, // 机器人停止 + RBCORE_CMD_STOP_ALL, // 机器人停止 RBCORE_CMD_MANUAL_FORWARD, // 机器人手动前进 RBCORE_CMD_MANUAL_BACKWARD, // 机器人手动后退 RBCORE_CMD_MANUAL_TURNLEFT, // 机器人手动左转 RBCORE_CMD_MANUAL_TURNRIGHT, // 机器人手动右转 + RBCORE_CMD_VERTICAL, // 机器人竖直前进(带PID) + RBCORE_CMD_HORIZONTAL_LEFT, // 机器人水平向左(带PID) + RBCORE_CMD_HORIZONTAL_RIGHT, // 机器人水平向右(带PID) RBCORE_GET_VEHICLE_SPEED, // 获取机器人速度 RBCORE_CMD_END = 0x0200, @@ -95,40 +97,10 @@ typedef enum { CUSTOM_CMD_PAINTGUN, // 控制喷枪 CUSTOM_CMD_END = 0x0300, } BHBF_Cmd_e; - -// 电机命令数据结构 -typedef struct { - uint8_t m_ucMotorIndex; // 电机索引(0=左轮,1=右轮) - int32_t m_iValue; // 值(速度/位置等) -} Motor_CmdData_t; - -// 电机状态数据结构 -typedef struct { - uint8_t m_ucMotorIndex; - int32_t m_iPosition; - int32_t m_iVelocity; - uint32_t m_uiFaultCode; -} Motor_StatusData_t; - -typedef enum { - GF_CMD_DEFAULT_NULL = 0, - GF_CMD_STOP_ALL, - GF_CMD_MANUAL_FORWARD, - GF_CMD_MANUAL_BACKWARD, - GF_CMD_AUTO_FORWARD -} GF_CMD; - -typedef struct _GV_struct_define -{ - int m_iWorkMode; - GF_CMD m_eGFCmd; - int32_t m_iMoveSpeed[2];//索引1对应左轮,索引2对应右轮 -} GV_define; /*==============================================* * project-wide global variables * *----------------------------------------------*/ -void RBcore_Init(void); /*==============================================* diff --git a/motor/msp_motor_leisai.c b/motor/msp_motor_leisai.c index ea6c900..2d5c418 100644 --- a/motor/msp_motor_leisai.c +++ b/motor/msp_motor_leisai.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "msp_motor_leisai.h" -#include "rd_time.h" #include "BHBF.h" #include "msg_center.h" diff --git a/project/paint_robot_new/paint_robot_new.c b/project/paint_robot_new/paint_robot_new.c index dc5f905..7404224 100644 --- a/project/paint_robot_new/paint_robot_new.c +++ b/project/paint_robot_new/paint_robot_new.c @@ -145,7 +145,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) if (abs(g_stMK32.CH2_LY_V) <= g_stCV.Joy_Sticker_Value_Allowance && abs(g_stMK32.CH3_LY_H) <= g_stCV.Joy_Sticker_Value_Allowance) { - MsgCenter_SendTo(MODULE_NAME_RBCORE, CMD_STOP_ALL, NULL, 0); + MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0); break; } @@ -169,7 +169,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg) } else { - MsgCenter_SendTo(MODULE_NAME_RBCORE, CMD_STOP_ALL, NULL, 0); + MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0); } break; } diff --git a/project/paint_robot_new/paint_robot_new_motors.c b/project/paint_robot_new/paint_robot_new_motors.c index 59ba299..c9ef1f6 100644 --- a/project/paint_robot_new/paint_robot_new_motors.c +++ b/project/paint_robot_new/paint_robot_new_motors.c @@ -72,7 +72,7 @@ static void Motor_ModuleHandler(const Msg_t *pstMsg) g_aiMotorSpeed[1] = MotorMgr_SpeedConvert(g_apstMotors[1], aiMotorSpeed[1]); break; } - case CMD_STOP_ALL: + case RBCORE_CMD_STOP_ALL: { for (int i = 0; i < 2; i++) {