1.0
This commit is contained in:
37
App/Contract/robot_cmd_slot.h
Normal file
37
App/Contract/robot_cmd_slot.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef ROBOT_CMD_SLOT_H
|
||||
#define ROBOT_CMD_SLOT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief 算法层生成的抽象目标指令
|
||||
*/
|
||||
typedef struct {
|
||||
float target_vx; // 目标线速度 (m/s)
|
||||
float target_wz; // 目标角速度 (rad/s)
|
||||
uint8_t ctrl_flags; // 控制模式/标志
|
||||
uint32_t gen_tick_ms; // 指令生成时的系统时间 (用于底层判断算法是否卡死)
|
||||
} RobotTargetCmd_t;
|
||||
|
||||
/* =========================================================
|
||||
* API 接口
|
||||
* ========================================================= */
|
||||
|
||||
/**
|
||||
* @brief 写入接口:由主导航/控制任务调用
|
||||
* @param vx 期望线速度 (m/s)
|
||||
* @param wz 期望角速度 (rad/s)
|
||||
* @param flags 扩展控制标志
|
||||
*/
|
||||
void CmdSlot_Push(float vx, float wz, uint8_t flags);
|
||||
|
||||
/**
|
||||
* @brief 读取接口:由 20ms 的 CAN Tx 任务专属调用
|
||||
* @param out_cmd 获取到的指令拷贝
|
||||
* @param timeout_ms 容忍算法不更新的最大时间 (推荐 100ms)
|
||||
* @return true: 指令新鲜可用; false: 算法超时太久,建议强制发 0 停车保护
|
||||
*/
|
||||
bool CmdSlot_Pop(RobotTargetCmd_t *out_cmd, uint32_t timeout_ms);
|
||||
|
||||
#endif // ROBOT_CMD_SLOT_H
|
||||
Reference in New Issue
Block a user