Files
Gimbal/application/robot_def.h
T
SkyLiCoder 4d1702b577 refactor: migrate from DJI motors to DM motors, simplify to gimbal-only control
- Rewrite DM motor driver based on DM_6220 reference protocol (MIT/PosVel/Velocity modes)
- Use velocity control mode: MCU runs angle PID with IMU feedback, motor handles speed loop
- Rewrite vision protocol with 3 frame types (0xA5 auto data, 0xA6 manual data, 0xA7 command)
- Decouple serial parsing (opencv module) from mode switching (robot_cmd module)
- Implement dual-loop architecture: vision PID outer loop → angle ref → motor PID inner loop
- Add KF/PID reset on mode switch transitions
- Merge motor_reverse_flag and feedback_reverse_flag into single output_reverse flag
- Remove DMMotorEnable/DMMotorStop (motor always runs, controlled by angle ref)
- Remove unused modules: DJI/LK/HT/step/servo motors, chassis, shoot, referee
- Add ExitRun0Mode() for STM32H723 power supply configuration
- Clean up CMakeLists: 115 → 76 C source files
2026-05-29 23:37:36 +08:00

69 lines
1.4 KiB
C

#pragma once
#ifndef ROBOT_DEF_H
#define ROBOT_DEF_H
#include "ins_task.h"
#include "master_process.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
{
ROBOT_STOP = 0,
ROBOT_READY,
} Robot_Status_e;
/* 应用状态 */
typedef enum
{
APP_OFFLINE = 0,
APP_ONLINE,
APP_ERROR,
} App_Status_e;
/* 云台模式 */
typedef enum
{
GIMBAL_ZERO_FORCE = 0,
GIMBAL_GYRO_MODE,
} gimbal_mode_e;
/* ---- CMD 发布给 gimbal 的控制数据 ---- */
typedef struct
{
float yaw; // yaw 目标角度 (degrees, multi-turn)
float pitch; // pitch 目标角度 (degrees)
gimbal_mode_e gimbal_mode;
} Gimbal_Ctrl_Cmd_s;
/* ---- gimbal 发布给 CMD 的反馈数据 ---- */
typedef struct
{
attitude_t gimbal_imu_data;
uint16_t yaw_motor_single_round_angle;
uint8_t gimbal_power;
} Gimbal_Upload_Data_s;
#pragma pack()
#endif // !ROBOT_DEF_H