mi-task/struct.cpp

63 lines
2.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#define int8_t int
#define int16_t int
#define int32_t int
#define int64_t int
/**
* 基本控制
* URL: udpm://239.255.76.67:7671?ttl=255
* 通道: robot_control_cmd
* 频率: 2~500Hz超时500ms触发趴下保护
*/
struct robot_control_cmd_lcmt {
int8_t mode; // 控制模式
int8_t gait_id; // 步态ID
int8_t contact; // 四足着地状态
int8_t life_count; // 生命计数,计数增加时命令生效
float vel_des[3]; // 期望速度 [x, y(1.6), yaw(2.5)] m/s
float rpy_des[3]; // 期望姿态 [roll, pitch, yaw(0.45)] rad
float pos_des[3]; // 期望位置 [x, y, z(0.1-0.32)] m
float acc_des[6]; // 跳跃加速度 m^2/s
float ctrl_point[3]; // 姿态控制点 m
float foot_pose[6]; // 前后足位置 [x,y,z] m
float step_height[2]; // 小跑步态步高 0~0.08m
int32_t value; // 控制标志位
// bit0: 舞蹈模式下是否使用MPC轨迹
// bit1: 0-内八节能步态 1-垂直步态
int32_t duration; // 命令执行时间
};
/** 状态反馈
* URL: "udpm://239.255.76.67:7670?ttl=255"
* channel: "robot_control_response"
* frequncy: 50HZ
*/
struct robot_control_response_lcmt {
int8_t mode; // 控制模式
int8_t gait_id; // 步态ID
int8_t contact; // 四足着地状态
int8_t order_process_bar; // 进度条 order process, 1 == 1 %
int8_t switch_status; // 0:Done, 1:TRANSITIONING, 2:ESTOP, 3:EDAMP, 4:LIFTED 5:BAN_TRANS 6:OVER_HEAT 7:LOW_BAT
int8_t ori_error; // 姿态误差
int16_t footpos_error; // 足端位置误差
int32_t motor_error[12]; // 电机误差
};
/** 里程计数据
* URL: "udpm://239.255.76.67:7667?ttl=255"
* channel: "global_to_robot"
* frequncy: 50HZ
*/
struct localization_lcmt {
float xyz[3]; // 表达在腿式里程计坐标系的机身位置
float vxyz[3]; // 表达在腿式里程计坐标系的机身线速度
float rpy[3]; // 表达在腿式里程计坐标系的机身欧拉角
float omegaBody[3]; // 表达在机身坐标系的机身角速度
float vBody[3]; // 表达在机身坐标系的机身线速度
int64_t timestamp; // 时间戳,单位 nanoseconds
};