更新项目结构,修改自述文件
This commit is contained in:
1 parent
bc5bd0c72e
commit
a4ccd91c75
28 files changed
+129
-50
No files matched your search
@@ -38,6 +38,11 @@ MDK-ARM/RM-2026-Classis/
|
|||||||
# ============================
|
# ============================
|
||||||
.mxproject
|
.mxproject
|
||||||
|
|
||||||
|
# ============================
|
||||||
|
# 废弃文件
|
||||||
|
# ============================
|
||||||
|
readme.txt
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
# VS Code
|
# VS Code
|
||||||
# ============================
|
# ============================
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -340,7 +340,7 @@
|
|||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define>USE_HAL_DRIVER,STM32F407xx</Define>
|
<Define>USE_HAL_DRIVER,STM32F407xx</Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath>../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;../A-Driver;../A-DEvice;../A-APPlication</IncludePath>
|
<IncludePath>../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;../00-Driver;../01-Device;../02-Application</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Cads>
|
</Cads>
|
||||||
<Aads>
|
<Aads>
|
||||||
@@ -1174,52 +1174,52 @@
|
|||||||
<File>
|
<File>
|
||||||
<FileName>BSP_USART.c</FileName>
|
<FileName>BSP_USART.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-Driver\BSP_USART.c</FilePath>
|
<FilePath>..\00-Driver\BSP_USART.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BSP_USART.h</FileName>
|
<FileName>BSP_USART.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\BSP_USART.h</FilePath>
|
<FilePath>..\00-Driver\BSP_USART.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BSP_CAN.c</FileName>
|
<FileName>BSP_CAN.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-Driver\BSP_CAN.c</FilePath>
|
<FilePath>..\00-Driver\BSP_CAN.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BSP_CAN.h</FileName>
|
<FileName>BSP_CAN.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\BSP_CAN.h</FilePath>
|
<FilePath>..\00-Driver\BSP_CAN.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Parameter.h</FileName>
|
<FileName>Parameter.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\Parameter.h</FilePath>
|
<FilePath>..\00-Driver\Parameter.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088Middleware.c</FileName>
|
<FileName>BMI088Middleware.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-Driver\BMI088Middleware.c</FilePath>
|
<FilePath>..\00-Driver\BMI088Middleware.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088Middleware.h</FileName>
|
<FileName>BMI088Middleware.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\BMI088Middleware.h</FilePath>
|
<FilePath>..\00-Driver\BMI088Middleware.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088reg.h</FileName>
|
<FileName>BMI088reg.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\BMI088reg.h</FilePath>
|
<FilePath>..\00-Driver\BMI088reg.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088driver.c</FileName>
|
<FileName>BMI088driver.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-Driver\BMI088driver.c</FilePath>
|
<FilePath>..\00-Driver\BMI088driver.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088driver.h</FileName>
|
<FileName>BMI088driver.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-Driver\BMI088driver.h</FilePath>
|
<FilePath>..\00-Driver\BMI088driver.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -1229,32 +1229,32 @@
|
|||||||
<File>
|
<File>
|
||||||
<FileName>Remote.c</FileName>
|
<FileName>Remote.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-DEvice\Remote.c</FilePath>
|
<FilePath>..\01-Device\Remote.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Remote.h</FileName>
|
<FileName>Remote.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-DEvice\Remote.h</FilePath>
|
<FilePath>..\01-Device\Remote.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Motor.c</FileName>
|
<FileName>Motor.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-DEvice\Motor.c</FilePath>
|
<FilePath>..\01-Device\Motor.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Motor.h</FileName>
|
<FileName>Motor.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-DEvice\Motor.h</FilePath>
|
<FilePath>..\01-Device\Motor.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088.c</FileName>
|
<FileName>BMI088.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-DEvice\BMI088.c</FilePath>
|
<FilePath>..\01-Device\BMI088.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>BMI088.h</FileName>
|
<FileName>BMI088.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-DEvice\BMI088.h</FilePath>
|
<FilePath>..\01-Device\BMI088.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -1264,42 +1264,42 @@
|
|||||||
<File>
|
<File>
|
||||||
<FileName>PID.c</FileName>
|
<FileName>PID.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-APPlication\PID.c</FilePath>
|
<FilePath>..\02-Application\PID.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PID.h</FileName>
|
<FileName>PID.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-APPlication\PID.h</FilePath>
|
<FilePath>..\02-Application\PID.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Classis_Wheels.c</FileName>
|
<FileName>Classis_Wheels.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-APPlication\Classis_Wheels.c</FilePath>
|
<FilePath>..\02-Application\Classis_Wheels.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Classis_Wheels.h</FileName>
|
<FileName>Classis_Wheels.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-APPlication\Classis_Wheels.h</FilePath>
|
<FilePath>..\02-Application\Classis_Wheels.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Chassis_Yaw_Big.c</FileName>
|
<FileName>Chassis_Yaw_Big.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-APPlication\Chassis_Yaw_Big.c</FilePath>
|
<FilePath>..\02-Application\Chassis_Yaw_Big.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Chassis_Yaw_Big.h</FileName>
|
<FileName>Chassis_Yaw_Big.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-APPlication\Chassis_Yaw_Big.h</FilePath>
|
<FilePath>..\02-Application\Chassis_Yaw_Big.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Chassis_CtoC.c</FileName>
|
<FileName>Chassis_CtoC.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\A-APPlication\Chassis_CtoC.c</FilePath>
|
<FilePath>..\02-Application\Chassis_CtoC.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>Chassis_CtoC.h</FileName>
|
<FileName>Chassis_CtoC.h</FileName>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
<FilePath>..\A-APPlication\Chassis_CtoC.h</FilePath>
|
<FilePath>..\02-Application\Chassis_CtoC.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
@@ -1,30 +1,114 @@
|
|||||||
@2026.1.23
|
# RM-2026-Chassis
|
||||||
|
|
||||||
新建本工程,分成三个层级:Driver、Device、APPlication。
|
RoboMaster 2026 赛季底盘控制固件,基于 STM32F407IGHx + Keil MDK 开发。
|
||||||
|
|
||||||
其中:
|
## 项目概述
|
||||||
|
|
||||||
Driver最底层,只实现“怎么做”,不关心“做什么”;
|
本项目为 RoboMaster 步兵/英雄机器人底盘控制器固件,支持麦克纳姆轮全向移动、多电机协同控制、遥控器/键鼠操控及 IMU 姿态反馈。
|
||||||
|
|
||||||
Device中间层,依赖hardware,绑定到具体硬件;
|
| 项目信息 | 内容 |
|
||||||
|
|---------|------|
|
||||||
|
| MCU | STM32F407IGHx |
|
||||||
|
| 开发环境 | Keil MDK-ARM (UV5) |
|
||||||
|
| HAL 库 | STM32CubeF4 HAL |
|
||||||
|
| 遥控器 | DJI DT7 (SBUS 协议) |
|
||||||
|
| 电机 | DJI M3508 × 4 (底盘驱动) |
|
||||||
|
| IMU | BMI088 (加速度计 + 陀螺仪) |
|
||||||
|
| 通信 | CAN1 / CAN2 |
|
||||||
|
|
||||||
Application层,专注功能实现,不关心硬件。
|
## 代码架构
|
||||||
|
|
||||||
工作小结:
|
采用三层架构设计,职责分离:
|
||||||
|
|
||||||
弄完了底盘板子的轮子驱动代码,明天结合pid和遥控器实现基本运动控制
|
```
|
||||||
|
00-Driver/ // 底层驱动 —— "怎么做",不关心业务逻辑
|
||||||
|
├── BSP_CAN.c/h CAN 总线底层封装
|
||||||
|
├── BSP_USART.c/h 串口底层封装
|
||||||
|
├── BMI088driver.c/h BMI088 寄存器级驱动
|
||||||
|
└── Parameter.h 全局参数/宏定义
|
||||||
|
|
||||||
@2026.1.24
|
01-Device/ // 设备层 —— 绑定具体硬件,抽象硬件接口
|
||||||
|
├── Motor.c/h DJI 电机 (M3508/GM6020/M2006) 管理与 CAN 数据解析
|
||||||
|
├── Remote.c/h DT7 遥控器 SBUS 数据接收与解析
|
||||||
|
└── BMI088.c/h BMI088 姿态数据处理与 CAN 转发
|
||||||
|
|
||||||
写完了初步的麦轮转向移动逻辑,能用遥控器控制
|
02-Application/ // 应用层 —— "做什么",专注功能与算法
|
||||||
|
├── Classis_Wheels.c/h 麦轮底盘运动学解算与速度控制
|
||||||
|
├── Chassis_CtoC.c/h 遥控器/键鼠数据映射与 CAN 转发 (Chassis to Chassis)
|
||||||
|
├── Chassis_Yaw_Big.c/h 底盘Yaw控制 (预留)
|
||||||
|
└── PID.c/h 位置式 / 增量式 PID 控制器
|
||||||
|
```
|
||||||
|
|
||||||
@2026.1.25
|
### 架构原则
|
||||||
|
|
||||||
1、加入了看门狗!非常重要,用于遥控器连接检测!**后面要加入软硬件结合的限功率**!
|
- **Driver 层**:仅实现硬件操作的“怎么做”,如寄存器读写、时序控制、总线收发。
|
||||||
|
- **Device 层**:依赖 HAL/Driver,将硬件原始数据封装为可直接使用的设备状态(电机转速、遥控器通道值、IMU 姿态角)。
|
||||||
|
- **Application 层**:专注功能算法与业务逻辑,完全不关心底层硬件细节。
|
||||||
|
|
||||||
2、can线设备id有所变动
|
## 硬件连接
|
||||||
|
|
||||||
@2026.2.6
|
| 功能模块 | 接口 | 说明 |
|
||||||
|
|---------|------|------|
|
||||||
|
| 底盘电机 (M3508 × 4) | CAN1 | ID: 0x201 ~ 0x204 |
|
||||||
|
| BMI088 | CAN2 | 姿态数据回传 |
|
||||||
|
| DT7 遥控器 | USART1 | SBUS 协议,100 Hz |
|
||||||
|
| 看门狗 (IWDG) | 内部 | 用于遥控器断连保护 |
|
||||||
|
|
||||||
1.简单保存一下,较为完善的代码
|
## 核心功能
|
||||||
|
|
||||||
|
### 1. 麦克纳姆轮运动控制 (`Classis_Wheels`)
|
||||||
|
|
||||||
|
- 支持遥控器摇杆控制底盘前后、左右、旋转运动
|
||||||
|
- 麦轮速度解算,输出到四个 M3508 电机
|
||||||
|
- 基于增量式 PID 的闭环速度控制
|
||||||
|
|
||||||
|
### 2. 遥控器/键鼠输入 (`Remote` / `Chassis_CtoC`)
|
||||||
|
|
||||||
|
- DT7 遥控器 SBUS 信号解析(16 通道 + 拨杆 + 鼠标 + 键盘)
|
||||||
|
- 支持键鼠操控模式(WASD 移动、鼠标控制)
|
||||||
|
- 将控制指令通过 CAN 转发给底盘各模块
|
||||||
|
|
||||||
|
### 3. 电机驱动 (`Motor`)
|
||||||
|
|
||||||
|
- 支持 DJI M3508 / GM6020 / M2006 三种电机
|
||||||
|
- 自动编码器圈数累加、角度/转速/电流换算
|
||||||
|
- 标准 CAN 帧发送电流/电压控制指令
|
||||||
|
|
||||||
|
### 4. PID 控制器 (`PID`)
|
||||||
|
|
||||||
|
- 位置式 PID:适用于角度/位置控制
|
||||||
|
- 增量式 PID:适用于速度/电流控制
|
||||||
|
- 支持输出限幅、误差死区、积分清零
|
||||||
|
|
||||||
|
### 5. IMU 姿态 (`BMI088`)
|
||||||
|
|
||||||
|
- 读取加速度、陀螺仪原始数据
|
||||||
|
- 计算 Yaw / Pitch / Roll 姿态角
|
||||||
|
- 通过 CAN 转发给云台或上位机
|
||||||
|
|
||||||
|
## 开发日志
|
||||||
|
|
||||||
|
| 日期 | 内容 |
|
||||||
|
|------|------|
|
||||||
|
| 2026.01.23 | 新建工程,确立三层架构;完成底盘轮子驱动代码 |
|
||||||
|
| 2026.01.24 | 实现麦轮转向移动逻辑,接入遥控器控制 |
|
||||||
|
| 2026.01.25 | 加入独立看门狗 (IWDG) 用于遥控器断连检测;调整 CAN 设备 ID |
|
||||||
|
| 2026.02.06 | 代码阶段性整理,基础功能趋于完善 |
|
||||||
|
|
||||||
|
## 编译与烧录
|
||||||
|
|
||||||
|
1. 使用 Keil MDK 打开 `MDK-ARM/RM-2026-Classis.uvprojx`
|
||||||
|
2. 确认 Debug 配置为 ST-Link / J-Link
|
||||||
|
3. 点击 **Build** 编译,**Download** 烧录
|
||||||
|
|
||||||
|
> 注意:`.uvguix.*` 和 `.uvoptx` 为用户本地配置文件,已加入 `.gitignore`,无需提交。
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- 看门狗用于检测遥控器连接状态,若遥控器断连将触发复位,**后续需加入软硬件结合的功率限制**
|
||||||
|
- CAN 总线终端电阻需根据实际布线确认
|
||||||
|
- 电机 ID 与 `Motor.h` 中的枚举定义保持一致
|
||||||
|
|
||||||
|
## 许可证
|
||||||
|
|
||||||
|
本项目为 Simba Robotics 内部开发,仅供 RoboMaster 2026 赛季使用。
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
2026.1.23
|
|
||||||
新建本工程,分成三个层级:Driver、Device、APPlication。
|
|
||||||
其中:
|
|
||||||
Driver最底层,只实现“怎么做”,不关心“做什么”;
|
|
||||||
Device中间层,依赖hardware,绑定到具体硬件;
|
|
||||||
Application层,专注功能实现,不关心硬件。
|
|
||||||
工作小结:
|
|
||||||
弄完了底盘板子的轮子驱动代码,明天结合pid和遥控器实现基本运动控制
|
|
||||||
2026.1.24
|
|
||||||
写完了初步的麦轮转向移动逻辑,能用遥控器控制
|
|
||||||
Reference in new issue
Block a user