Files
Gimbal/application/robot_def.h
T
SkyLiCoder da6acdcc89 refactor: manual mode from absolute setpoint to velocity control, remove auto-enable at motor init
Manual mode now receives angular velocity (degrees/s) via 0xA6 frame instead of
absolute angle reference. The firmware integrates velocity * dt into gimbal angle ref.
Motors are no longer auto-enabled at DMMotorInit — they stay disabled until a mode
switch out of DEBUG. Extract ROBOT_CMD_DELAY macro to replace magic number.
Fix "volity" typo → "velocity" and update docs/protocol comments accordingly.
2026-06-02 16:27:07 +08:00

69 lines
1.5 KiB
C

#pragma once
#ifndef ROBOT_DEF_H
#define ROBOT_DEF_H
#include "ins_task.h"
#include "stdint.h"
// 机器人核心任务的延时时间(ms)
#define ROBOT_CMD_DELAY 2
/* 开发板类型定义 */
#define ONE_BOARD // 单板控制整车
//#define VISION_USE_VCP // 使用虚拟串口发送视觉数据
#define VISION_USE_UART // 使用串口发送视觉数据
/* 云台参数 */
#define YAW_CHASSIS_ALIGN_ECD 2711
#define PITCH_HORIZON_ECD 3412
#define PITCH_MAX_ANGLE 0
#define PITCH_MIN_ANGLE 0
/* IMU->云台方向 */
#define GYRO2GIMBAL_DIR_YAW 1
#define GYRO2GIMBAL_DIR_PITCH 1
#define GYRO2GIMBAL_DIR_ROLL 1
#pragma pack(1)
/* 应用状态 */
typedef enum
{
APP_OFFLINE = 0,
APP_ONLINE,
APP_ERROR,
} App_Status_e;
/* ---- CMD 发布给 gimbal 的控制数据 ---- */
typedef struct
{
float yaw; // yaw 目标角度 (degrees, multi-turn)
float pitch; // pitch 目标角度 (degrees)
} Gimbal_Ctrl_Cmd_s;
/* ---- gimbal 发布给 CMD 的反馈数据 ---- */
typedef struct
{
INS_t *gimbal_imu_data; // 指向 INS 实例的指针
uint16_t yaw_motor_single_round_angle;
uint8_t gimbal_power;
} Gimbal_Upload_Data_s;
/* ---- CMD 发布给 gimbal 的电机使能指令 ---- */
typedef struct
{
uint8_t enable; // 0=失能, 1=使能
} Motor_Enable_s;
/* ---- CMD 发布给 gimbal 的电机角度环 PID 参数 ---- */
typedef struct
{
float yaw_Kp, yaw_Ki, yaw_Kd;
float pitch_Kp, pitch_Ki, pitch_Kd;
} Motor_PID_Tune_s;
#pragma pack()
#endif // !ROBOT_DEF_H