refactor: 哨兵分支整理目录结构,按功能归类(只搬家,程序不变)

基于战队 main 9de485e。两块板统一改为三层目录,Keil 工程分组与文件夹一一对应:
- App/   本板业务,按功能分文件夹(system/ cmd/ comm/ referee/,
         云台另有 gimbal/ shoot/ vision/,底盘另有 chassis/,含 hlj_pc、supercap)
- Lib/   与业务无关的通用模块(algorithm/ motor/ imu/ sensor/ dev/),两板逐字节相同
- Bsp/   bsp_can、bsp_usart,不再分 Inc/Src

具体改动:
- 107 个文件全部 git mv(纯重命名,内容不变),文件名不变,#include 不用改
- .uvprojx:Application/Task、Modules、BSP 三个分组换成新分组,登记文件集合不变;
  头文件路径换成新目录,CubeMX/第三方目录不动
- .uvoptx 分组同步,文件序号重新连续编号
- 根 README 和两块板 README 的路径、代码地图、模块清单同步更新(补 hlj_pc、supercap)
- 新增 doc/目录整理说明.md(新旧路径对照、验证方法、以后如何跟进步兵更新)

验证(整理前后同一编译器):
- 两块板 Program Size 完全相同
  底盘 Code=111184 RO=1956 RW=432 ZI=62720
  云台 Code=109876 RO=1960 RW=420 ZI=62764
- .map 符号表(名字/类型/大小/所在 .o)底盘 1155 个、云台 1156 个,逐条一致

未改动:Core/、Drivers/、Middlewares/、USB_DEVICE/、CubeMX 分组名与任务名、module_test/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tmr.textandClaude Opus 5.5 committed 2026-11-30 11:38:19 +08:00
1 parent 9de485e4ef
commit 4b75e4ec6e
115 files changed
+1200 -818

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#ifndef DJI_MOTOR_H
#define DJI_MOTOR_H
#include "bsp_can.h"
typedef enum
{
DJI_MOTOR_3508,//M3508电机,减速比3591:187(约19:1),转矩常数0.3N·m/A
DJI_MOTOR_2006,//M2006电机,减速比36:1,转矩常数0.18N·m/A
DJI_MOTOR_6020,//GM6020电机,直驱,电流控制(ID1~4为0x1FE帧,±16384对应±3A)
} dji_motor_type_e;//大疆电机类型枚举
typedef struct
{
uint16_t raw_angle;//本次机械角度原始值(0~8191对应0~360°)
int64_t total_tick;//累计多圈机械位置原始值(8192*圈数+raw,无±1圈限制)
float rotor_angle_deg;//累计转子机械角度(°)
int16_t rotor_speed;//转子转速(RPM)
int16_t raw_torque;//转矩电流原始编码值
float torque_current;//换算后转矩电流(A)
uint8_t temperature;//电机温度(℃)
uint32_t last_online_tick;//最近一次收到反馈的系统tick(HAL_GetTick)
} dji_motor_feedback_t;//大疆电机反馈数据结构体
typedef struct
{
dji_motor_type_e type;//电机类型
hcan_t * hcan;//所属CAN总线句柄(&hcan1/&hcan2)
uint16_t rx_id;//反馈报文标准ID(3508/2006:0x201~0x208,6020:0x205~0x20B)
dji_motor_feedback_t fdb;//电机反馈数据
} dji_motor_t;//大疆电机实例结构体
void dji_motor_init(dji_motor_t * motor, hcan_t * hcan, uint16_t rx_id, dji_motor_type_e type);//初始化电机实例并注册CAN接收回调
void dji_motor_send_current_low(hcan_t * hcan, int16_t i1, int16_t i2, int16_t i3, int16_t i4);//发送3508/2006 ID1~4电流帧(0x200)
void dji_motor_send_current_high(hcan_t * hcan, int16_t i5, int16_t i6, int16_t i7, int16_t i8);//发送3508/2006 ID5~8电流帧(0x1FF)
void dji_motor_send_gm6020_current_low(hcan_t * hcan, int16_t i1, int16_t i2, int16_t i3, int16_t i4);//发送GM6020 ID1~4电流帧(0x1FE)
void dji_motor_send_gm6020_current_high(hcan_t * hcan, int16_t i5, int16_t i6, int16_t i7, int16_t i8);//发送GM6020 ID5~8电流帧(0x2FE)
void dji_motor_send_int16x4(hcan_t * hcan, uint32_t std_id, const int16_t val[4]);//通用4路int16大端打包CAN发送函数
#endif