|
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
|
|
版权所有 (C), 2018-2099, Radkil
|
|
|
|
|
|
|
|
|
|
******************************************************************************
|
|
|
|
|
文 件 名 : BHBF.h
|
|
|
|
|
版 本 号 : 初稿
|
|
|
|
|
作 者 : radkil
|
|
|
|
|
生成日期 : 2026年6月8日
|
|
|
|
|
最近修改 :
|
|
|
|
|
功能描述 : BHBF.c 的头文件
|
|
|
|
|
|
|
|
|
|
修改历史 :
|
|
|
|
|
1.日 期 : 2026年6月8日
|
|
|
|
|
作 者 : radkil
|
|
|
|
|
修改内容 : 创建文件
|
|
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 外部变量说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 外部函数原型说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 内部函数原型说明 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 全局变量 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 模块级变量 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 常量定义 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------*
|
|
|
|
|
* 宏定义 *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#ifndef __BHBF_H__
|
|
|
|
|
#define __BHBF_H__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
#if __cplusplus
|
|
|
|
|
extern "C"{
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*==============================================*
|
|
|
|
|
* include header files *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
#include "drv_interface.h"
|
|
|
|
|
#include "rd_time.h"
|
|
|
|
|
#include "msg_center.h"
|
|
|
|
|
#include "cmsis_os.h"
|
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
|
|
|
|
|
|
/*==============================================*
|
|
|
|
|
* constants or macros define *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
#define MODULE_NAME_RBCORE "RBcore"
|
|
|
|
|
#define MODULE_NAME_MOTOR "motor"
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
MOTOR_CMD_SET_SPEED = 0x0001, // 设置速度
|
|
|
|
|
MOTOR_CMD_SET_POSITION, // 设置位置
|
|
|
|
|
MOTOR_CMD_STOP, // 停止
|
|
|
|
|
MOTOR_CMD_GET_STATUS, // 获取状态
|
|
|
|
|
MOTOR_CMD_SET_HOME, // 设置零点
|
|
|
|
|
MOTOR_CMD_SPEED_MODE, // 速度模式
|
|
|
|
|
MOTOR_CMD_POSITION_MODE, // 位置模式
|
|
|
|
|
MOTOR_CMD_END = 0x0100,
|
|
|
|
|
|
|
|
|
|
RBCORE_CMD_MANUAL_FORWARD, // 机器人手动前进
|
|
|
|
|
RBCORE_CMD_MANUAL_BACKWARD, // 机器人手动后退
|
|
|
|
|
RBCORE_CMD_MANUAL_TURNLEFT, // 机器人手动左转
|
|
|
|
|
RBCORE_CMD_MANUAL_TURNRIGHT, // 机器人手动右转
|
|
|
|
|
} Motor_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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*==============================================*
|
|
|
|
|
* routines' or functions' implementations *
|
|
|
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
#if __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __BHBF_ROBOT_H__ */
|