|
|
@ -62,7 +62,6 @@ extern "C"{ |
|
|
#include "drv_interface.h" |
|
|
#include "drv_interface.h" |
|
|
#include "rd_time.h" |
|
|
#include "rd_time.h" |
|
|
#include "cmsis_os.h" |
|
|
#include "cmsis_os.h" |
|
|
#include "FreeRTOS.h" |
|
|
|
|
|
#include <stdint.h> |
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
/*==============================================*
|
|
|
/*==============================================*
|
|
|
@ -80,11 +79,14 @@ typedef enum { |
|
|
MOTOR_GET_FAULT_CODE, // 获取错误码
|
|
|
MOTOR_GET_FAULT_CODE, // 获取错误码
|
|
|
MOTOR_CMD_END = 0x0100, |
|
|
MOTOR_CMD_END = 0x0100, |
|
|
|
|
|
|
|
|
CMD_STOP_ALL, // 机器人停止
|
|
|
RBCORE_CMD_STOP_ALL, // 机器人停止
|
|
|
RBCORE_CMD_MANUAL_FORWARD, // 机器人手动前进
|
|
|
RBCORE_CMD_MANUAL_FORWARD, // 机器人手动前进
|
|
|
RBCORE_CMD_MANUAL_BACKWARD, // 机器人手动后退
|
|
|
RBCORE_CMD_MANUAL_BACKWARD, // 机器人手动后退
|
|
|
RBCORE_CMD_MANUAL_TURNLEFT, // 机器人手动左转
|
|
|
RBCORE_CMD_MANUAL_TURNLEFT, // 机器人手动左转
|
|
|
RBCORE_CMD_MANUAL_TURNRIGHT, // 机器人手动右转
|
|
|
RBCORE_CMD_MANUAL_TURNRIGHT, // 机器人手动右转
|
|
|
|
|
|
RBCORE_CMD_VERTICAL, // 机器人竖直前进(带PID)
|
|
|
|
|
|
RBCORE_CMD_HORIZONTAL_LEFT, // 机器人水平向左(带PID)
|
|
|
|
|
|
RBCORE_CMD_HORIZONTAL_RIGHT, // 机器人水平向右(带PID)
|
|
|
RBCORE_GET_VEHICLE_SPEED, // 获取机器人速度
|
|
|
RBCORE_GET_VEHICLE_SPEED, // 获取机器人速度
|
|
|
RBCORE_CMD_END = 0x0200, |
|
|
RBCORE_CMD_END = 0x0200, |
|
|
|
|
|
|
|
|
@ -95,40 +97,10 @@ typedef enum { |
|
|
CUSTOM_CMD_PAINTGUN, // 控制喷枪
|
|
|
CUSTOM_CMD_PAINTGUN, // 控制喷枪
|
|
|
CUSTOM_CMD_END = 0x0300, |
|
|
CUSTOM_CMD_END = 0x0300, |
|
|
} BHBF_Cmd_e; |
|
|
} 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 * |
|
|
* project-wide global variables * |
|
|
*----------------------------------------------*/ |
|
|
*----------------------------------------------*/ |
|
|
void RBcore_Init(void); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*==============================================*
|
|
|
/*==============================================*
|
|
|
|