同步中英文README与当前工程结构,并整理文档目录与构建忽略规则

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-04 11:31:14 +08:00
co-authored by Cursor
parent 097853234f
commit 31ec941b07
9 changed files with 276 additions and 338 deletions
+43 -72
View File
@@ -1,92 +1,63 @@
---
name: readme
description: 为当前项目生成适配 Gitee / 公司内部代码仓库的中英文双语 README。默认生成 README.md(中文,Gitee 默认展示)和 README_en.md(英文)两个文件,顶部互相链接切换语言。适用于公司项目、算法项目、机器人项目、工程代码仓库。当用户说“写个README”“生成项目介绍”“生成Gitee README”“make a readme”时使用。
description: Create, update, audit, or synchronize repository README documentation from evidence in the codebase. Use when the user asks to write or improve a README, document setup/build/run/test workflows, explain project structure or architecture, fix stale README content, or maintain multilingual README files for any software project.
---
# Gitee 双语 README 生成
# README维护
为当前项目生成两个互相链接的 README 文件:
生成或更新准确、简洁、可执行的项目README,不预设托管平台、技术栈、运行环境或文档语言。
- `README.md`:简体中文,作为 Gitee 默认展示文件
- `README_en.md`:英文版,供中英文切换使用
## 工作流程
如果项目中已经存在 `README_zh.md``Readme_zh.md``Readme_en.md` 等命名,先读取已有文件,并尽量沿用当前仓库已有命名规范;如果没有明确规范,默认使用 `README.md` + `README_en.md`
### 1. 调研仓库
## 执行目标
- 读取适用的`AGENTS.md`、现有README和主要设计文档。
- 检查源码目录、项目清单、依赖文件、入口、配置、构建脚本、测试和CI配置。
- 使用`rg --files`和针对性搜索;排除`bin``obj``build`、依赖缓存及其他生成目录。
- 从代码和配置确认项目名称、用途、模块边界、环境要求及实际命令,不根据目录名猜测。
生成符合公司内部 Gitee 仓库风格的 README,不写成 GitHub 开源宣传页。
### 2. 确定范围
README 应该让新同事或项目参与者快速知道:
- 优先更新现有README,保留仍然准确的内容和仓库既有风格。
- 默认沿用现有文件名和主要语言。
- 只有用户明确要求或仓库已有约定时,才创建双语或多份README,并添加相对链接切换语言。
- 删除或修正已改名、已删除、不存在或无法验证的内容。
- 项目是什么
- 面向什么设备 / 平台 / 场景
- 软件架构大概是什么
- 如何安装依赖
- 如何编译 / 运行 / 启动
- 代码目录怎么组织
- 如何按公司流程参与开发
### 3. 组织内容
## 执行步骤
根据项目实际情况选择必要章节,不强制套用完整模板。常用顺序为:
### 1. 调研项目
1. 项目名称与一句话说明
2. 当前能力与适用范围
3. 目录或架构概览
4. 环境与依赖
5. 构建、运行和测试
6. 配置与部署
7. 已知限制或故障排查
8. 贡献方式与许可证(仅在仓库有依据时)
先充分了解项目,不要凭空编造内容
- 把最常用的成功路径放在前面
- 仅在能显著解释模块关系或执行流程时使用表格、目录树或Mermaid图。
- 使用相对路径链接仓库内文件,避免复制大段源码或生成完整文件清单。
必须优先读取和分析:
### 4. 保证事实准确
- 项目根目录结构
- 已有 README / 文档
- 主入口脚本
- 启动脚本
- `CMakeLists.txt`
- `package.xml`
- `requirements.txt`
- `pyproject.toml`
- `package.json`
- `docker-compose.yml`
- `Dockerfile`
- 配置文件
- launch 文件
- ROS / ROS2 相关目录
- 核心源码目录
- 设备通信、底盘控制、导航、感知、驱动相关代码
- 命令必须来自项目文件、脚本或已验证的工具链;不要编造安装、启动、部署或硬件步骤。
- 区分“已验证可用”“根据配置推断”和“尚未验证”,不要把编译成功描述为运行或实机验证成功。
- 不编造版本、性能指标、兼容平台、许可证、维护状态或安全保证。
- 不在README中写入密码、令牌、内网地址、个人路径或其他敏感信息。
- 信息不足时优先省略非必要章节;必要信息缺失时明确标注待确认内容。
需要识别:
### 5. 验证结果
- 项目名称
- 项目用途
- 运行平台
- 技术栈
- 编程语言
- ROS / ROS2 版本(如果存在)
- 构建方式
- 启动方式
- 主要模块
- 依赖项
- 是否有实际设备、仿真环境、域控一体机、阿克曼底盘、CAN、串口、网络通信等内容
- 检查README中的名称、路径、文件和命令仍真实存在。
- 检查中英文或多语言版本的关键事实、命令和链接保持一致。
- 对能够安全执行的核心命令进行适度验证;未执行时明确说明。
- 查看最终差异,避免无关重写、重复章节和过度宣传。
**重要:只写代码和文档中真实存在的内容。**
## 写作要求
不要编造:
- 未确认的算法
- 未确认的性能指标
- 未确认的硬件型号
- 未确认的 ROS 版本
- 未确认的启动命令
- 未确认的部署流程
- 未确认的许可证
如果信息不足,用“待补充”明确标注,不要用通用模板假装完整。
---
## 2. 文件命名与语言切换
### 默认文件
生成:
```text
README.md
README_en.md
- 面向首次接触仓库的开发者,使用直接、具体、可操作的语言。
- 说明“是什么、怎么用、如何验证”,避免空泛的优势描述。
- 保持章节简短;复杂设计链接到专门文档,不把README写成完整设计说明书。
- 代码块标注正确语言,命令应可复制,并注明必要的工作目录或前置条件。
+41 -78
View File
@@ -1,93 +1,56 @@
##################################################
# Visual Studio
##################################################
# .NET / MSBuild生成目录
**/bin/
**/obj/
**/build/
**/publish/
artifacts/
TestResults/
*.nupkg
packages/
# Visual Studio 工作区缓存
# MyParking构建脚本生成的部署文件
/output/
/ref/CommonUsage.dll
# Python缓存和本地虚拟环境
**/__pycache__/
*.py[cod]
.pytest_cache/
.mypy_cache/
.venv/
venv/
# 实验生成数据;保留脚本、requirements和README
/data_process/**/*.csv
/data_process/**/*.png
/data_process/**/plots/
/logs/
# IDE和用户配置
.vs/
**/.vs/
# 用户配置
.idea/
.vscode/
*.user
*.suo
*.userosscache
*.sln.docstates
##################################################
# Build 输出
##################################################
# 编译输出目录
bin/
obj/
**/bin/
**/obj/
##################################################
# Rider / VS Code
##################################################
.idea/
.vscode/
##################################################
# NuGet
##################################################
*.nupkg
packages/
##################################################
# 日志
##################################################
*.log
##################################################
# 临时文件
##################################################
*.tmp
*.temp
##################################################
# 测试结果
##################################################
TestResults/
##################################################
# 发布目录
##################################################
publish/
##################################################
# Windows
##################################################
Thumbs.db
Desktop.ini
##################################################
# JetBrains
##################################################
_ReSharper*/
*.DotSettings.user
##################################################
# 缓存
##################################################
# 日志、临时文件和本地缓存
*.log
*.tmp
*.temp
*.cache
##################################################
# 数据库(如果有)
##################################################
# 本地数据库
*.db
*.sqlite
*.sqlite3
*.csv
*.png
# 操作系统生成文件
Thumbs.db
Desktop.ini
.DS_Store
# 不要全局忽略*.dllMedullaAdapter/ref和MultiWheelC/ref中的宿主依赖需要保留。
@@ -34,7 +34,7 @@
<ItemGroup>
<Reference Include="FundamentalLib">
<HintPath>..\..\MedullaAdapter\ref\RefFundamentalLib.dll</HintPath>
<HintPath>.\ref\RefFundamentalLib.dll</HintPath>
</Reference>
<!-- <Reference Include="ClumsyCore">
<HintPath>..\..\MultiWheelC\ref\RefClumsyCore.dll</HintPath>
+96 -94
View File
@@ -8,10 +8,10 @@
1. 先实现单台停车机器人小车的基本功能;
2. 在单车闭环稳定后逐步增加停车作业功能;
3. 基于仿真、台架和实车数据优化轨迹跟踪方法;
3. 基于台架和实车数据优化轨迹跟踪方法;
4. 最后再考虑多车通信、编队和协同控制。
当前工作仍以**单车**为主,已经从基础框架搭建进入底盘联调、功能补充和跟踪实验阶段。多车配置位于 `PilotConfig.cs``#if false` 区域,`Shared/FleetKinematics.cs` 仍是占位文件,不能视为多车能力已经实现。
当前工作仍以**单车**为主,处于底盘联调、功能补充和跟踪实验阶段。多车配置位于 `MultiWheelC/PilotConfig.cs``#if false` 区域,`Shared/Fleet/FleetKinematics.cs` 仍是占位文件,不能视为多车能力已经实现。
| 阶段 | 当前状态 | 说明 |
| --- | --- | --- |
@@ -22,18 +22,17 @@
## 项目简介
MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层运动动作、共享运动学、底层硬件适配、离线 Web 仿真和实验数据分析。
MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层运动动作、共享运动学、底层硬件适配和实验数据分析。
核心代码分为
核心模块
- `ClumsyPilot`Clumsy 上层动作、轨迹跟踪人工测试;
- `MedullaAdapter`Medulla 下层 MCU、CAN、串口、轮组、夹臂、遥控和报警适配;
- `Shared`统一的二维坐标、底盘命令、坐标变换和多轮底盘适配;
- `MultiWheelC`Clumsy 上层C 层)动作、轨迹跟踪人工测试和实验记录
- `MedullaAdapter`Medulla 下层M 层)MCU、CAN、串口、轮组、夹臂、遥控和报警适配;
- `Shared`M/C 共享的二维坐标、底盘命令、坐标变换和多轮底盘适配(无独立 `.csproj`,由两端编译引入)
- `CommonUsage-MultiVehicleSync/commonusage`:仓库内的 `CommonUsage` 底盘公共库源码;
- `Simulation`:基于 ASP.NET Core 的单车 Web 仿真器;
- `data_process`:轨迹实验 CSV 的 Python 分析工具。
- `data_process`:轨迹实验与舵轮响应的 Python 分析工具。
仓库中没有 ROS/ROS 2 或 Docker 配置
仓库中没有 ROS/ROS 2、Docker 或 Web 仿真项目。插件由 Clumsy / Medulla 宿主加载,不能通过 `dotnet run` 独立启动
## 当前已接入能力
@@ -48,7 +47,6 @@ MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层
| 驱动与反馈 | 8 个驱动电机和 4 个舵轮的命令、速度/位置/舵角反馈及远程帧状态 |
| 车辆状态 | 急停、启停、抱闸、灯光、电池 SOC/SOH 和驱动使能状态 |
| 诊断 | CAN 轮速事件与周期快照 CSV、轨迹实验 CSV、控制命令和 Detour 位姿记录 |
| 仿真 | 浏览器二维车辆显示、模式按钮、手动控制、车辆配置、复位和 REST API |
以上表示代码和测试入口已经存在,不等同于所有工况均已完成实车验收。
@@ -58,7 +56,7 @@ MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层
Clumsy 宿主
ClumsyPilot ───────────────┐
MultiWheelC ───────────────┐
│ │
▼ │ 实验 CSV
Shared / CommonUsage ├──────────► data_process
@@ -74,111 +72,109 @@ mcu_serial_bridge.dll │
│ │
▼ │
MCU ─► CAN / Serial / IO ──┘
Simulation ─► Shared 数据类型 ─► 浏览器仿真界面
```
`ClumsyPilot` `MedullaAdapter` 生成插件类库,需由对应宿主加载`Simulation` 是可以独立启动的 ASP.NET Core Web 项目
`MultiWheelC` `MedullaAdapter` 生成插件类库,需由对应宿主加载`CommonUsage` 是独立底盘库,不反向依赖 `Shared`、M 层或 C 层
## 坐标系与单位
- `Shared` 统一使用 SI 单位:m、m/s、rad、rad/s。
- 车体坐标系:X 向前、Y 向左、逆时针为正。
- 旧接口单位只在边界处转换。
- 角度归一化、最短角差和度弧度转换统一使用 `Shared/Mathematics/AngleMath.cs`
- 弧度归一化范围为 `[-π, π)`,度归一化范围为 `[-180°, 180°)`
- 车辆航向可用圆周最短角差;受 `[-120°, 120°]` 限制的机械舵角误差必须直接使用目标值减实际值。
## 目录说明
```text
MyParking/
├── ParkingRobot.sln
├── ClumsyPilot/ # 上层动作、跟踪、测试和实验记录
├── MedullaAdapter/ # MCU、CAN、轮组、夹臂、遥控和报警
├── Shared/ # 共享命令、坐标变换和底盘适配
├── build-and-package.ps1 # 官方构建与 M/C 打包脚本
├── AGENTS.md # 协作与代码规范
├── MultiWheelC/ # C 层动作、跟踪、测试和实验记录
├── MedullaAdapter/ # M 层 MCU、CAN、轮组、夹臂、遥控和报警
├── Shared/ # 共享模型、数学方法和底盘适配
├── CommonUsage-MultiVehicleSync/
│ └── commonusage/ # CommonUsage 公共底盘库源码
├── Simulation/ # .NET 8 Web 仿真器
│ ├── Commands/ # 可由特性自动发现的仿真动作
│ ├── Core/ # 仿真车辆、舵轮、时钟和世界
── Models/ # Web API DTO
│ └── wwwroot/ # 浏览器界面
├── data_process/ # Python 实验绘图脚本
├── ref/ # 两个插件共同使用的 CommonUsage.dll
├── 测试方案.txt # 单车轨迹实验方案
── 记录.txt # 项目调试记录
└── 电机记录.txt # 电机调试记录
├── ref/ # 构建生成的 CommonUsage.dll(勿手工覆盖)
├── data_process/
│ ├── 轨迹测试处理/ # 轨迹对比、误差、速度与角速度绘图
── 电机响应处理/ # 舵轮响应快照分析
├── docs/
│ ├── SteeringConstraintDesign.md # 舵轮限位设计讨论
│ ├── chassis参考.json # 底盘参数样例
├── 测试方案.txt # 单车轨迹实验方案
│ └── 记录.txt # 项目调试记录
└── output/ # 打包输出(gitignore
├── M/ # MedullaAdapter.dll + CommonUsage.dll
└── C/ # MultiWheelC.dll + CommonUsage.dll
```
根目录的 `ParkingRobot.sln` 当前只包含 `ClumsyPilot``MedullaAdapter``CommonUsage``Simulation` 需要分别构建
仓库内没有根级 `ParkingRobot.sln`。唯一 solution 文件位于 `CommonUsage-MultiVehicleSync/commonusage/CommonUsageSln.sln`
## 开发环境与依赖
- Windows 开发/实机运行环境;
- Windows 开发 / 实机运行环境;
- Visual Studio 2022,或支持 .NET 8.0 和 .NET Standard 2.0 的 .NET SDK
- Python 环境,用于可选的实验数据绘图;
- Clumsy/Medulla 内部框架程序集,位于各项目的 `ref` 目录;
- Clumsy / Medulla 内部框架程序集,位于各项目的 `ref` 目录;
- 实机所需的 `mcu_serial_bridge.dll`,当前仓库中未包含该文件;
- 能够加载 `ClumsyPilot.dll``MedullaAdapter.dll` 的匹配版本宿主程序,当前仓库中未包含宿主。
- 能够加载 `MultiWheelC.dll``MedullaAdapter.dll` 的匹配版本宿主程序,当前仓库中未包含宿主。
主要 NuGet/Python 依赖:
主要依赖:
- `ClumsyPilot``Newtonsoft.Json 13.0.3``System.Numerics.Vectors 4.6.1`
- `CommonUsage``MQTTnet 4.3.7.1207``Newtonsoft.Json 13.0.3`
- `data_process`NumPy、pandas、Matplotlib、SciPy。
- `MultiWheelC``netstandard2.0``Newtonsoft.Json 13.0.3``System.Numerics.Vectors 4.6.1`
- `MedullaAdapter``net8.0`):无 NuGet PackageReference,依赖本地 `ref` 程序集
- `CommonUsage``netstandard2.0`):`MQTTnet 4.3.7.1207``Newtonsoft.Json 13.0.3` 等;
- `data_process`:见各子目录 `requirements.txt`
## 编译
## 编译与打包
### 1. 构建 CommonUsage
`MyParking` 目录执行官方脚本(默认 Debug):
修改公共底盘库后,先执行:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\build-and-package.ps1
```
Release 构建:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\build-and-package.ps1 -Configuration Release
```
脚本流程:
1. 构建 `CommonUsage`,并将 `CommonUsage.dll` 复制到根目录 `ref/`
2. 构建 `MedullaAdapter``MultiWheelC`
3. 将 M/C 产物分别打包到 `output/M``output/C`,两边使用同一份 `CommonUsage.dll`
首次克隆或依赖变更后,如遇 `--no-restore` 失败,可先恢复依赖再打包:
```powershell
dotnet restore CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj
dotnet build CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj -c Debug
dotnet restore MedullaAdapter\MedullaAdapter.csproj
dotnet restore MultiWheelC\MultiWheelC.csproj
```
该项目的构建目标会把生成的 `CommonUsage.dll` 复制到根目录 `ref`
### 2. 构建实车插件
```powershell
dotnet restore ParkingRobot.sln
dotnet build ParkingRobot.sln -c Debug
```
主要输出:
主要中间输出:
```text
ClumsyPilot/build/Clumsy/ClumsyPilot.dll
MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll
MultiWheelC/build/Clumsy/MultiWheelC.dll
```
### 3. 构建 Web 仿真器
```powershell
dotnet restore Simulation\MyParking.Simulation.csproj
dotnet build Simulation\MyParking.Simulation.csproj -c Debug
```
## 启动 Web 仿真
```powershell
dotnet run --project Simulation\MyParking.Simulation.csproj --launch-profile http
```
浏览器访问:
```text
http://localhost:5203
```
仿真界面提供正常、左蟹行、右蟹行、自转、前进、后退、左转、右转、停止和复位动作,并可修改车辆布局及手动控制输入。主要 API 包括:
- `GET /api/vehicles`
- `GET /api/actions`
- `GET/POST /api/configuration`
- `POST /api/vehicles/{vehicleId}/commands/{command}`
- `POST /api/vehicles/{vehicleId}/manual-control`
- `POST /api/reset`
`Simulation/Commands/MySimulationTests.cs` 给出了自定义仿真动作示例;为静态方法添加 `SimulationAction` 特性后,调度器会自动发现并在网页生成对应动作。
不要直接编辑 `bin``obj``build``output` 中的产物,也不要手工覆盖 `ref/CommonUsage.dll`
## 实车运行与 MCU 配置
实车插件不能通过 `dotnet run` 独立启动需要由匹配版本的 Clumsy/Medulla 宿主加载两个 DLL。宿主版本、部署目录和完整启动步骤尚未随仓库提供,待补充。
实车插件不能通过 `dotnet run` 独立启动需要由匹配版本的 Clumsy / Medulla 宿主分别加载:
```text
output/C/MultiWheelC.dll
output/M/MedullaAdapter.dll
```
宿主版本、部署目录和完整启动步骤尚未随仓库提供,待补充。
当前源码中的 MCU 默认参数:
@@ -192,13 +188,13 @@ http://localhost:5203
| 自转最大角速度 | `30 deg/s` |
| 轮速诊断目录 | `logs\wheel-speed` |
当前工作区存在 `chassis.json` 底盘参数样例,但源码中尚未发现自动加载该文件的入口实车参数仍应以宿主实际配置为准。
`docs/chassis参考.json` 底盘参数样例源码中尚未发现自动加载该文件的入口实车参数仍应以宿主实际配置为准。
实机测试前必须确认端口、车号、舵轮零位与限位、速度单位、驱动方向、夹臂限位和急停链路。建议先架空驱动轮或在隔离区域低速测试,并保留独立可靠的物理急停,不能只依赖软件停车。
实机测试前必须确认端口、车号、舵轮零位与限位、速度单位、驱动方向、夹臂限位和急停链路。建议先架空驱动轮或在隔离区域低速、短距离测试,并保留独立可靠的物理急停,不能只依赖软件停车。
## 单车测试入口
`ClumsyPilot/MovementTests.cs` 当前注册:
`MultiWheelC/MovementTests.cs` 当前注册:
- `准备:四个舵轮与车头方向一致`
- `SendMotion:连续前进4m`
@@ -227,25 +223,29 @@ Medulla 的轮速诊断可通过 `StartWheelSpeedDiagnostic` / `StopWheelSpeedDi
logs/wheel-speed/
```
在自行管理的 Python 环境中安装依赖:
### 轨迹测试处理
```powershell
python -m pip install -r data_process\requirements.txt
python -m pip install -r data_process\轨迹测试处理\requirements.txt
python data_process\轨迹测试处理\run_all_plots.py "路径\实验1.csv" "路径\实验2.csv" --output-dir "路径\plots"
```
对一份或多份轨迹 CSV 同时生成轨迹对比、跟踪误差、速度响应和角速度命令图:
默认重采样频率为 `20 Hz`,滤波窗口为 `0.55 s`,可通过 `--frequency``--window` 调整。
### 电机响应处理
```powershell
python data_process\run_all_plots.py "路径\实验1.csv" "路径\实验2.csv" --output-dir "路径\plots"
python -m pip install -r data_process\电机响应处理\requirements.txt
python data_process\电机响应处理\plot_steering_response.py
```
不传 CSV 路径时,脚本会查找 `data_process` 目录中的 CSV。默认重采样频率为 `20 Hz`,滤波窗口为 `0.55 s`,可通过 `--frequency``--window` 调整
默认读取 `logs\wheel-speed` 中最新的 `*_snapshot.csv`。详见 [`data_process/电机响应处理/README.md`](data_process/电机响应处理/README.md)
## 尚未完成或需要继续验证
- 雷达点云、轮胎识别、自动钻车、车辆释放和完整停车作业状态机;
- 当前运动和夹臂功能的完整实车验收、故障注入及长期稳定性测试;
- 舵轮软限位预测和自动车身重定向;`SteeringConstraintManager.cs` 当前主要是设计记录
- 舵轮软限位预测和自动车身重定向;当前仅有设计文档 [`docs/SteeringConstraintDesign.md`](docs/SteeringConstraintDesign.md)
- 自动化单元测试和持续集成;
- 多车通信、编队、同步和安全降级;`FleetKinematics.cs` 当前仅为占位;
- 宿主版本、插件部署目录、配置文件位置和发布流程。
@@ -253,12 +253,14 @@ python data_process\run_all_plots.py "路径\实验1.csv" "路径\实验2.csv" -
## 参与开发
1. 当前改动优先服务于单车闭环、停车功能和跟踪质量,不提前启用多车代码;
2. 保持上层动作、共享运动学、底层硬件协议和仿真模块边界;
2. 保持 `CommonUsage``Shared``MedullaAdapter``MultiWheelC`模块边界;
3. 新增参数时注明坐标系、单位、默认值、车型和安全范围;
4. 提交前构建受影响的项目,并记录仿真、台架或实车验证条件
5. 修改 `CommonUsage` 后同步更新根目录 `ref/CommonUsage.dll`
4. 修改相关项目后运行 `build-and-package.ps1`,并确认 M/C 部署包使用同一份 `CommonUsage.dll`
5. 未经明确要求,不改变速度或舵角符号、CAN ID、遥控器映射、机械限位和模式切换策略
6. 分支、评审和发布流程待团队补充。
更细的协作约定见 [`AGENTS.md`](AGENTS.md)。
## 许可证
仓库中暂未提供许可证文件。使用和分发范围请遵循公司内部规定。
+95 -93
View File
@@ -8,10 +8,10 @@ This repository is a rewrite of the parking-robot control software. Development
1. Implement the basic functions of one parking robot first;
2. Add parking-operation features after the single-robot loop is stable;
3. Improve tracking with simulation, bench, and physical-vehicle data;
3. Improve tracking with bench and physical-vehicle data;
4. Consider multi-robot communication, formation, and coordination last.
The current work remains focused on the **single robot** and has progressed from framework construction to chassis integration, feature development, and tracking experiments. Multi-robot settings remain inside the `#if false` section of `PilotConfig.cs`, while `Shared/FleetKinematics.cs` is still a placeholder. These files do not represent an implemented multi-robot system.
The current work remains focused on the **single robot** and is in chassis integration, feature development, and tracking experiments. Multi-robot settings remain inside the `#if false` section of `MultiWheelC/PilotConfig.cs`, while `Shared/Fleet/FleetKinematics.cs` is still a placeholder. These files do not represent an implemented multi-robot system.
| Stage | Current status | Notes |
| --- | --- | --- |
@@ -22,18 +22,17 @@ The current work remains focused on the **single robot** and has progressed from
## Overview
MyParking is a C# project for a multi-wheel parking-robot chassis. It covers upper-layer actions, shared kinematics, lower-layer hardware adaptation, an offline Web simulator, and experiment-data analysis.
MyParking is a C# project for a multi-wheel parking-robot chassis. It covers upper-layer actions, shared kinematics, lower-layer hardware adaptation, and experiment-data analysis.
The main components are:
Main modules:
- `ClumsyPilot`: Clumsy actions, tracking, and manual tests;
- `MedullaAdapter`: Medulla MCU, CAN, serial, wheel, clamp, remote-control, and alarm adaptation;
- `Shared`: common 2D coordinates, chassis commands, frame transforms, and multi-wheel adaptation;
- `MultiWheelC`: Clumsy upper layer (C layer) for actions, tracking, manual tests, and experiment recording;
- `MedullaAdapter`: Medulla lower layer (M layer) for MCU, CAN, serial, wheel, clamp, remote-control, and alarm adaptation;
- `Shared`: M/C-shared 2D coordinates, chassis commands, frame transforms, and multi-wheel adaptation (no standalone `.csproj`; compiled into both ends);
- `CommonUsage-MultiVehicleSync/commonusage`: in-repository source for the `CommonUsage` chassis library;
- `Simulation`: an ASP.NET Core single-robot Web simulator;
- `data_process`: Python tools for tracking-experiment CSV files.
- `data_process`: Python tools for tracking experiments and steering-response analysis.
No ROS/ROS 2 or Docker configuration is present.
No ROS/ROS 2, Docker, or Web simulator project is present. The plugins are loaded by Clumsy / Medulla hosts and cannot be started independently with `dotnet run`.
## Currently Integrated Capabilities
@@ -48,7 +47,6 @@ No ROS/ROS 2 or Docker configuration is present.
| Drive and feedback | Commands and speed/position/steering feedback for eight drive motors and four steer modules, plus remote-frame state |
| Vehicle state | Emergency stop, start/stop, brake, lights, battery SOC/SOH, and drive-enable state |
| Diagnostics | CAN wheel-speed events, periodic snapshot CSVs, tracking CSVs, command recording, and Detour pose recording |
| Simulation | Browser-based 2D display, mode actions, manual control, vehicle configuration, reset, and REST APIs |
The presence of code and test entries does not mean every operating condition has passed physical acceptance testing.
@@ -58,7 +56,7 @@ The presence of code and test entries does not mean every operating condition ha
Clumsy host
ClumsyPilot ───────────────┐
MultiWheelC ───────────────┐
│ │
▼ │ experiment CSV
Shared / CommonUsage ├──────────► data_process
@@ -74,111 +72,109 @@ mcu_serial_bridge.dll │
│ │
▼ │
MCU ─► CAN / Serial / IO ──┘
Simulation ─► Shared data types ─► browser simulator
```
`ClumsyPilot` and `MedullaAdapter` build as plugin libraries that require their respective hosts. `Simulation` is an independently runnable ASP.NET Core Web project.
`MultiWheelC` and `MedullaAdapter` build as plugin libraries that require their respective hosts. `CommonUsage` is an independent chassis library and must not depend back on `Shared`, the M layer, or the C layer.
## Coordinates and Units
- `Shared` uses SI units: m, m/s, rad, rad/s.
- Body frame: X forward, Y left, counterclockwise positive.
- Legacy API units are converted only at boundaries.
- Angle normalization, shortest angular difference, and degree/radian conversion use `Shared/Mathematics/AngleMath.cs`.
- Radian normalization range is `[-π, π)`; degree normalization range is `[-180°, 180°)`.
- Vehicle heading may use the shortest circular difference; mechanical steering error under the `[-120°, 120°]` limit must use target minus actual directly.
## Repository Layout
```text
MyParking/
├── ParkingRobot.sln
├── ClumsyPilot/ # Upper-layer actions, tracking, tests, and recording
├── MedullaAdapter/ # MCU, CAN, wheel, clamp, remote, and alarms
├── Shared/ # Shared commands, frame transforms, and chassis adapter
├── build-and-package.ps1 # Official build and M/C packaging script
├── AGENTS.md # Collaboration and coding rules
├── MultiWheelC/ # C-layer actions, tracking, tests, and recording
├── MedullaAdapter/ # M-layer MCU, CAN, wheel, clamp, remote, and alarms
├── Shared/ # Shared models, math, and chassis adapter
├── CommonUsage-MultiVehicleSync/
│ └── commonusage/ # CommonUsage chassis-library source
├── Simulation/ # .NET 8 Web simulator
│ ├── Commands/ # Attribute-discovered simulation actions
│ ├── Core/ # Vehicles, steer wheels, clock, and world
── Models/ # Web API DTOs
│ └── wwwroot/ # Browser UI
├── data_process/ # Python experiment-plotting scripts
├── ref/ # CommonUsage.dll shared by both plugins
├── 测试方案.txt # Single-robot tracking experiment plan
── 记录.txt # Project debugging notes
└── 电机记录.txt # Motor debugging notes
├── ref/ # Generated CommonUsage.dll (do not overwrite by hand)
├── data_process/
│ ├── 轨迹测试处理/ # Trajectory comparison, error, speed, and yaw plots
── 电机响应处理/ # Steering-response snapshot analysis
├── docs/
│ ├── SteeringConstraintDesign.md # Steering-limit design notes
│ ├── chassis参考.json # Sample chassis parameters
├── 测试方案.txt # Single-robot tracking experiment plan
│ └── 记录.txt # Project debugging notes
└── output/ # Packaging output (gitignored)
├── M/ # MedullaAdapter.dll + CommonUsage.dll
└── C/ # MultiWheelC.dll + CommonUsage.dll
```
The root `ParkingRobot.sln` currently contains only `ClumsyPilot` and `MedullaAdapter`. Build `CommonUsage` and `Simulation` separately.
There is no root-level `ParkingRobot.sln`. The only solution file is `CommonUsage-MultiVehicleSync/commonusage/CommonUsageSln.sln`.
## Development Environment and Dependencies
- Windows development and physical-runtime environment;
- Visual Studio 2022, or a .NET SDK supporting .NET 8.0 and .NET Standard 2.0;
- A Python environment for optional experiment plotting;
- Internal Clumsy/Medulla framework assemblies under each project's `ref` directory;
- Internal Clumsy / Medulla framework assemblies under each project's `ref` directory;
- `mcu_serial_bridge.dll` for physical operation; this file is not currently in the repository;
- Compatible hosts capable of loading `ClumsyPilot.dll` and `MedullaAdapter.dll`; the hosts are not included.
- Compatible hosts capable of loading `MultiWheelC.dll` and `MedullaAdapter.dll`; the hosts are not included.
Primary NuGet/Python dependencies:
Primary dependencies:
- `ClumsyPilot`: `Newtonsoft.Json 13.0.3` and `System.Numerics.Vectors 4.6.1`;
- `CommonUsage`: `MQTTnet 4.3.7.1207`, `Newtonsoft.Json 13.0.3`, and related packages;
- `data_process`: NumPy, pandas, Matplotlib, and SciPy.
- `MultiWheelC` (`netstandard2.0`): `Newtonsoft.Json 13.0.3` and `System.Numerics.Vectors 4.6.1`;
- `MedullaAdapter` (`net8.0`): no NuGet PackageReferences; depends on local `ref` assemblies;
- `CommonUsage` (`netstandard2.0`): `MQTTnet 4.3.7.1207`, `Newtonsoft.Json 13.0.3`, and related packages;
- `data_process`: see each subdirectory's `requirements.txt`.
## Build
## Build and Packaging
### 1. Build CommonUsage
From the `MyParking` directory, run the official script (Debug by default):
After changing the common chassis library, run:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\build-and-package.ps1
```
Release build:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\build-and-package.ps1 -Configuration Release
```
Script flow:
1. Build `CommonUsage` and copy `CommonUsage.dll` to the root `ref/` directory;
2. Build `MedullaAdapter` and `MultiWheelC`;
3. Package M/C outputs into `output/M` and `output/C`, both using the same `CommonUsage.dll`.
After a fresh clone or dependency change, if `--no-restore` fails, restore first and then package:
```powershell
dotnet restore CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj
dotnet build CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj -c Debug
dotnet restore MedullaAdapter\MedullaAdapter.csproj
dotnet restore MultiWheelC\MultiWheelC.csproj
```
The project includes a build target that copies the generated `CommonUsage.dll` to the root `ref` directory.
### 2. Build Physical-Robot Plugins
```powershell
dotnet restore ParkingRobot.sln
dotnet build ParkingRobot.sln -c Debug
```
Primary outputs:
Primary intermediate outputs:
```text
ClumsyPilot/build/Clumsy/ClumsyPilot.dll
MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll
MultiWheelC/build/Clumsy/MultiWheelC.dll
```
### 3. Build the Web Simulator
```powershell
dotnet restore Simulation\MyParking.Simulation.csproj
dotnet build Simulation\MyParking.Simulation.csproj -c Debug
```
## Run the Web Simulator
```powershell
dotnet run --project Simulation\MyParking.Simulation.csproj --launch-profile http
```
Open:
```text
http://localhost:5203
```
The UI provides normal, left-crab, right-crab, spin, forward, backward, left-turn, right-turn, stop, and reset actions. It also supports vehicle-layout configuration and manual-control input. Main APIs include:
- `GET /api/vehicles`
- `GET /api/actions`
- `GET/POST /api/configuration`
- `POST /api/vehicles/{vehicleId}/commands/{command}`
- `POST /api/vehicles/{vehicleId}/manual-control`
- `POST /api/reset`
`Simulation/Commands/MySimulationTests.cs` contains an example custom action. Add the `SimulationAction` attribute to a static method to have it discovered by the dispatcher and exposed in the Web UI.
Do not edit artifacts under `bin`, `obj`, `build`, or `output`, and do not manually overwrite `ref/CommonUsage.dll`.
## Physical Runtime and MCU Configuration
The physical-robot plugins cannot be started independently with `dotnet run`. Compatible Clumsy/Medulla hosts must load both DLLs. The required host versions, deployment directories, and complete startup procedure have not yet been provided.
The physical-robot plugins cannot be started independently with `dotnet run`. Compatible Clumsy / Medulla hosts must load:
```text
output/C/MultiWheelC.dll
output/M/MedullaAdapter.dll
```
The required host versions, deployment directories, and complete startup procedure have not yet been provided.
MCU defaults confirmed from the current source:
@@ -192,13 +188,13 @@ MCU defaults confirmed from the current source:
| Maximum spin rate | `30 deg/s` |
| Wheel-speed diagnostic directory | `logs\wheel-speed` |
A `chassis.json` chassis-parameter example is present in the current workspace, but no automatic loader for it was found in the source. Treat the actual host configuration as authoritative.
`docs/chassis参考.json` is a chassis-parameter example. No automatic loader for it was found in the source. Treat the actual host configuration as authoritative.
Before physical testing, verify the port, vehicle ID, steering zero and limits, speed units, motor direction, clamp limits, and emergency-stop chain. Begin with lifted drive wheels or a segregated low-speed test area and retain an independent physical emergency stop; never rely on software stopping alone.
Before physical testing, verify the port, vehicle ID, steering zero and limits, speed units, motor direction, clamp limits, and emergency-stop chain. Begin with lifted drive wheels or a segregated low-speed, short-distance test area and retain an independent physical emergency stop; never rely on software stopping alone.
## Single-Robot Test Entries
`ClumsyPilot/MovementTests.cs` currently registers:
`MultiWheelC/MovementTests.cs` currently registers:
- `准备:四个舵轮与车头方向一致`
- `SendMotion:连续前进4m`
@@ -227,25 +223,29 @@ Medulla wheel-speed diagnostics can be controlled with the `StartWheelSpeedDiagn
logs/wheel-speed/
```
Install dependencies in a Python environment managed by your team:
### Trajectory processing
```powershell
python -m pip install -r data_process\requirements.txt
python -m pip install -r data_process\轨迹测试处理\requirements.txt
python data_process\轨迹测试处理\run_all_plots.py "path\trial1.csv" "path\trial2.csv" --output-dir "path\plots"
```
Generate trajectory comparison, tracking error, speed response, and angular-command plots for one or more CSV files:
The default resampling frequency is `20 Hz`, and the default filter window is `0.55 s`; use `--frequency` and `--window` to change them.
### Steering-response processing
```powershell
python data_process\run_all_plots.py "path\trial1.csv" "path\trial2.csv" --output-dir "path\plots"
python -m pip install -r data_process\电机响应处理\requirements.txt
python data_process\电机响应处理\plot_steering_response.py
```
When no CSV path is supplied, the scripts search the `data_process` directory. The default resampling frequency is `20 Hz`, and the default filter window is `0.55 s`; use `--frequency` and `--window` to change them.
By default this reads the latest `*_snapshot.csv` under `logs\wheel-speed`. See [`data_process/电机响应处理/README.md`](data_process/电机响应处理/README.md).
## Incomplete or Pending Validation
- Lidar point clouds, tire recognition, automatic vehicle entry, vehicle release, and the complete parking-operation state machine;
- Full physical acceptance, fault injection, and long-duration testing for current motion and clamp functions;
- Steering soft-limit prediction and automatic body reorientation; `SteeringConstraintManager.cs` currently contains mainly design notes;
- Steering soft-limit prediction and automatic body reorientation; only the design document [`docs/SteeringConstraintDesign.md`](docs/SteeringConstraintDesign.md) exists today;
- Automated unit tests and continuous integration;
- Multi-robot communication, formation, synchronization, and safety fallback; `FleetKinematics.cs` is currently only a placeholder;
- Host versions, plugin deployment directories, configuration-file locations, and the release process.
@@ -253,12 +253,14 @@ When no CSV path is supplied, the scripts search the `data_process` directory. T
## Contributing
1. Prioritize single-robot closed-loop behavior, parking functions, and tracking quality; do not enable multi-robot code prematurely.
2. Preserve the boundaries between upper-layer actions, shared kinematics, hardware protocols, and simulation.
2. Preserve the boundaries among `CommonUsage`, `Shared`, `MedullaAdapter`, and `MultiWheelC`.
3. Document coordinate frames, units, defaults, applicable vehicle types, and safe ranges for new parameters.
4. Build every affected project before submission and record the simulation, bench, or physical-test conditions.
5. After changing `CommonUsage`, update the root `ref/CommonUsage.dll`.
4. After changing the related projects, run `build-and-package.ps1` and confirm that the M/C packages use the same `CommonUsage.dll`.
5. Do not change velocity or steering signs, CAN IDs, remote-control mappings, mechanical limits, or mode-switch policy unless explicitly requested.
6. The team still needs to document its branch, review, and release processes.
See [`AGENTS.md`](AGENTS.md) for more detailed collaboration rules.
## License
No license file is currently included. Use and distribution must follow internal company policy.
View File