chore: 导入 Simba-OmniInfantry 基线(云台/底盘双工程)
- 云台(ROBOT_TYPE_GIMBAL)与底盘(ROBOT_TYPE_CHASSIS)完整固件源码 - 新增根级 .gitignore,排除 Keil MDK-ARM 构建产物(.o/.d/.crf/.axf/.lnp/.map/.htm/.sct/.dep/.iex/.lst 等) 与 *.uvguix.* / DebugConfig/(与机器绑定的 UI 布局) - core.autocrlf=false,避免固件源码在检出时被改动换行符
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#ifndef GIMBAL_H
|
||||
#define GIMBAL_H
|
||||
|
||||
/* 云台双轴控制(串级 PID)
|
||||
* Yaw (2026-09 重写):双环都以陀螺仪为反馈——
|
||||
* 位置环:QEKF 多圈 yaw(°) -> 目标角速度(°/s)
|
||||
* 速度环:陀螺 z 轴角速度(°/s) -> GM6020 电压
|
||||
* 装配符号由上电自检自动测定(gimbal_detect_yaw_sign),
|
||||
* 两环共用同一符号,不可能再出现"两传感器符号打架"
|
||||
* Pitch:位置环用 QEKF 的 Roll(安装方向所致,勿改),速度环转子转速
|
||||
* 电机: Yaw=GM6020 CAN2 0x205(电压,0x1FF CAN2 槽1)
|
||||
* Pitch=GM6020 CAN1 0x206(电压,与拨弹共帧 0x1FF CAN1 槽2/3,legacy 方案)
|
||||
* 摩擦轮 M3508 0x201/0x202 与拨弹 M2006 0x207 的实例也在此初始化 */
|
||||
|
||||
#include "dji_motor.h"
|
||||
|
||||
/* 电机实例(由 gimbal_task 初始化,其他模块可读取反馈) */
|
||||
extern dji_motor_t motor_yaw_gimbal; // Yaw GM6020,CAN2 0x205
|
||||
extern dji_motor_t motor_pitch_gimbal; // Pitch GM6020,CAN1 0x206
|
||||
extern dji_motor_t motor_friction_l; // 左摩擦轮 M3508,CAN1 0x201
|
||||
extern dji_motor_t motor_friction_r; // 右摩擦轮 M3508,CAN1 0x202
|
||||
extern dji_motor_t motor_rammer; // 拨弹 M2006,CAN1 0x207
|
||||
|
||||
/* 初始化电机实例与 PID(can_start 之后调用) */
|
||||
extern void gimbal_motor_init(void);
|
||||
|
||||
/* Yaw 装配符号自检:给 Yaw 电机正向小电压脉冲,按陀螺 z 轴响应方向
|
||||
* 测定符号。阻塞约 200ms(HAL_Delay),检测期间云台会轻转几度。
|
||||
* 返回 1-成功(gimbal_yaw_sign() 可用) 0-失败(被按住/电机离线/无响应) */
|
||||
extern uint8_t gimbal_detect_yaw_sign(void);
|
||||
|
||||
/* 自检测得的装配符号(+1/-1;未检测时为 FALLBACK 参数值) */
|
||||
extern float gimbal_yaw_sign(void);
|
||||
|
||||
/* 编码器 tick 增大方向对应云台旋转方向:+1=逆时针(CCW) -1=顺时针(CW)
|
||||
* 0=尚未自检。随 0x1A9 flags bit1 下发,供底盘跟随符号自动综合 */
|
||||
extern int8_t gimbal_encoder_ccw(void);
|
||||
|
||||
/* 云台轴控制:根据 cmd 增量更新目标角并计算电压输出(2ms 调用)
|
||||
* 内部发送 CAN2 0x1FF(Yaw)与 CAN1 0x1FF(Pitch+拨弹) */
|
||||
extern void gimbal_control(float yaw_delta, float pitch_delta, uint8_t reset_flag);
|
||||
|
||||
/* 云台任一电机掉线返回 1 */
|
||||
extern uint8_t gimbal_motor_offline(void);
|
||||
|
||||
/* 云台输出清零(停车) */
|
||||
extern void gimbal_output_zero(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user