9b8e204ff7
- Add DEBUG mode (parallel to AUTO/MANUAL) for real-time PID parameter tuning - New 0xA8 debug frame: 12 floats for vision/motor angle PID tuning params - DMMotorSetMode: send zero-velocity before disable, clear PID to prevent jumps - motor_enable topic: pub from robot_cmd, sub in gimbal, controls motor on/off - motor_pid topic: pub from robot_cmd, sub in gimbal, updates motor angle PID - Rename DM motor enums (DM_CMD_ENABLE_MODE/DISABLE_MODE, DM_Motor_Ctrl_Mode_e) - SwitchToAuto/Manual: re-enable motors when switching back from DEBUG mode - Static-allocate enable_msg/pid_tune in GimbalTask to avoid stack churn - Add docs/host_comm_guide.md with Python Tkinter tuning GUI example - Remove ARCHITECTURE.md
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
#pragma once
|
|
#ifndef ROBOT_DEF_H
|
|
#define ROBOT_DEF_H
|
|
|
|
#include "ins_task.h"
|
|
#include "stdint.h"
|
|
|
|
/* 开发板类型定义 */
|
|
#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
|