Compare commits

2 Commits
15 changed files with 553 additions and 363 deletions
+43 -72
View File
@@ -1,92 +1,63 @@
--- ---
name: readme 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 / 文档 - 区分“已验证可用”“根据配置推断”和“尚未验证”,不要把编译成功描述为运行或实机验证成功。
- 主入口脚本 - 不编造版本、性能指标、兼容平台、许可证、维护状态或安全保证。
- 启动脚本 - 不在README中写入密码、令牌、内网地址、个人路径或其他敏感信息。
- `CMakeLists.txt` - 信息不足时优先省略非必要章节;必要信息缺失时明确标注待确认内容。
- `package.xml`
- `requirements.txt`
- `pyproject.toml`
- `package.json`
- `docker-compose.yml`
- `Dockerfile`
- 配置文件
- launch 文件
- ROS / ROS2 相关目录
- 核心源码目录
- 设备通信、底盘控制、导航、感知、驱动相关代码
需要识别: ### 5. 验证结果
- 项目名称 - 检查README中的名称、路径、文件和命令仍真实存在。
- 项目用途 - 检查中英文或多语言版本的关键事实、命令和链接保持一致。
- 运行平台 - 对能够安全执行的核心命令进行适度验证;未执行时明确说明。
- 技术栈 - 查看最终差异,避免无关重写、重复章节和过度宣传。
- 编程语言
- ROS / ROS2 版本(如果存在)
- 构建方式
- 启动方式
- 主要模块
- 依赖项
- 是否有实际设备、仿真环境、域控一体机、阿克曼底盘、CAN、串口、网络通信等内容
**重要:只写代码和文档中真实存在的内容。** ## 写作要求
不要编造: - 面向首次接触仓库的开发者,使用直接、具体、可操作的语言。
- 说明“是什么、怎么用、如何验证”,避免空泛的优势描述。
- 未确认的算法 - 保持章节简短;复杂设计链接到专门文档,不把README写成完整设计说明书。
- 未确认的性能指标 - 代码块标注正确语言,命令应可复制,并注明必要的工作目录或前置条件。
- 未确认的硬件型号
- 未确认的 ROS 版本
- 未确认的启动命令
- 未确认的部署流程
- 未确认的许可证
如果信息不足,用“待补充”明确标注,不要用通用模板假装完整。
---
## 2. 文件命名与语言切换
### 默认文件
生成:
```text
README.md
README_en.md
+41 -78
View File
@@ -1,93 +1,56 @@
################################################## # .NET / MSBuild生成目录
# Visual Studio **/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/
**/.vs/ .idea/
.vscode/
# 用户配置
*.user *.user
*.suo *.suo
*.userosscache *.userosscache
*.sln.docstates *.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*/ _ReSharper*/
*.DotSettings.user *.DotSettings.user
################################################## # 日志、临时文件和本地缓存
# 缓存 *.log
################################################## *.tmp
*.temp
*.cache *.cache
################################################## # 本地数据库
# 数据库(如果有)
##################################################
*.db *.db
*.sqlite *.sqlite
*.sqlite3 *.sqlite3
*.csv # 操作系统生成文件
*.png Thumbs.db
Desktop.ini
.DS_Store
# 不要全局忽略*.dllMedullaAdapter/ref和MultiWheelC/ref中的宿主依赖需要保留。
@@ -1190,7 +1190,8 @@ namespace CommonUsage.Chassis
float vx, float vx,
float vy, float vy,
float vth, float vth,
TimeSpan? deltaTime = null) TimeSpan? deltaTime = null,
bool enableDifferentialSteerFeedforward = false)
{ {
const string operationName = "SendXYThSpeed"; const string operationName = "SendXYThSpeed";
@@ -1313,13 +1314,42 @@ namespace CommonUsage.Chassis
var driveScale = _xyThWheelsAligned var driveScale = _xyThWheelsAligned
? alignmentSpeedScale ? alignmentSpeedScale
: 0f; : 0f;
#region
// vth传入单位为deg/s,这里换算成rad/s。
var omegaRadiansPerSecond =
vth * (float)Math.PI / 180f;
// 只有调用者主动开启并且存在旋转运动时,
// 才启用差速舵轮左右轮的几何速度前馈。
var useDifferentialSteerFeedforward =
enableDifferentialSteerFeedforward &&
Math.Abs(omegaRadiansPerSecond) > 1e-4f;
var rotationCenter = Vector2.Zero;
if (useDifferentialSteerFeedforward)
{
// 根据车体速度场:
// vx(point) = vx - omega * y
// vy(point) = vy + omega * x
// 计算车体坐标系中的瞬时旋转中心。
//
// vx、vy单位为m/s,计算结果原本是m;
// 舵轮Position使用mm,因此乘以1000。
rotationCenter = new Vector2(
-vy / omegaRadiansPerSecond * 1000f,
vx / omegaRadiansPerSecond * 1000f);
}
#endregion
for (var i = 0; i < _steerWheels.Count; i++) for (var i = 0; i < _steerWheels.Count; i++)
AccumulateSpeed( AccumulateSpeed(
i, i,
driveScale * driveScale *
sendSpeed[i], sendSpeed[i],
false, useDifferentialSteerFeedforward,
new Vector2(0f, 0f), rotationCenter,
deltaTime); deltaTime);
if (writeDiagnostics) if (writeDiagnostics)
@@ -34,7 +34,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="FundamentalLib"> <Reference Include="FundamentalLib">
<HintPath>..\..\MedullaAdapter\ref\RefFundamentalLib.dll</HintPath> <HintPath>.\ref\RefFundamentalLib.dll</HintPath>
</Reference> </Reference>
<!-- <Reference Include="ClumsyCore"> <!-- <Reference Include="ClumsyCore">
<HintPath>..\..\MultiWheelC\ref\RefClumsyCore.dll</HintPath> <HintPath>..\..\MultiWheelC\ref\RefClumsyCore.dll</HintPath>
+2
View File
@@ -67,6 +67,8 @@ namespace MedullaAdapter
[AsInitParam(desc = "MCU端口号")] public string MCUPort = "COM4"; [AsInitParam(desc = "MCU端口号")] public string MCUPort = "COM4";
[AsInitParam(desc = "遥控器速度上限")] public float TransmitterSpeedUpperLimit = 1.0f; [AsInitParam(desc = "遥控器速度上限")] public float TransmitterSpeedUpperLimit = 1.0f;
[AsInitParam(desc = "遥控器速度下限")] public float TransmitterSpeedLowerLimit = 0.0f; [AsInitParam(desc = "遥控器速度下限")] public float TransmitterSpeedLowerLimit = 0.0f;
[AsInitParam(desc = "实体遥控器SB模式防抖时间,单位ms")]
public int TransmitterModeDebounceMilliseconds = 200;
[AsInitParam(desc = "手动控制夹臂速度系数")] public float ManualArmSpeedFac = 1.0f; [AsInitParam(desc = "手动控制夹臂速度系数")] public float ManualArmSpeedFac = 1.0f;
[AsInitParam(desc = "遥控转弯舵角同步限速宽度,单位为度")] [AsInitParam(desc = "遥控转弯舵角同步限速宽度,单位为度")]
public float ManualSteeringAlignmentSigmaDegrees = 8.0f; public float ManualSteeringAlignmentSigmaDegrees = 8.0f;
+66 -14
View File
@@ -11,6 +11,10 @@ namespace MedullaAdapter
{ {
private bool _wasTransmitterControlling; private bool _wasTransmitterControlling;
private DateTime _lastMoveTime = DateTime.Now; private DateTime _lastMoveTime = DateTime.Now;
private DiverCartDefinition.ManualControlMode?
_pendingTransmitterControlMode;
private DateTime _pendingTransmitterControlModeSince =
DateTime.MinValue;
public override void Operation(int iteration) public override void Operation(int iteration)
{ {
if (!cart.GhostMode && cart.State == -1) return; if (!cart.GhostMode && cart.State == -1) return;
@@ -68,25 +72,70 @@ namespace MedullaAdapter
// 更新红黄绿灯状态。 // 更新红黄绿灯状态。
UpdateLightMode(); UpdateLightMode();
} }
// M层物理遥控器:只有SB档位连续稳定指定时间后才确认模式切换。
private bool TryGetStableTransmitterControlMode(
out DiverCartDefinition.ManualControlMode stableMode)
{
stableMode = cart.TransmitterControlMode;
DiverCartDefinition.ManualControlMode? requestedMode;
switch (cart.Transmitter_SB)
{
case TransmitterState.Mode0:
requestedMode =
DiverCartDefinition.ManualControlMode.Normal;
break;
case TransmitterState.Mode1:
requestedMode =
DiverCartDefinition.ManualControlMode.Crab;
break;
case TransmitterState.Mode2:
requestedMode =
DiverCartDefinition.ManualControlMode.Spin;
break;
default:
_pendingTransmitterControlMode = null;
_pendingTransmitterControlModeSince =
DateTime.MinValue;
return false;
}
if (_pendingTransmitterControlMode != requestedMode)
{
_pendingTransmitterControlMode = requestedMode;
_pendingTransmitterControlModeSince = DateTime.Now;
return false;
}
var debounceMilliseconds = Math.Max(
0,
cart.TransmitterModeDebounceMilliseconds);
if ((DateTime.Now -
_pendingTransmitterControlModeSince)
.TotalMilliseconds < debounceMilliseconds)
{
return false;
}
stableMode = requestedMode.Value;
return true;
}
// 物理遥控器设置 // 物理遥控器设置
public void TransmitterChassisControl() public void TransmitterChassisControl()
{ {
var interval = DateTime.Now - cart.TransmitterLastTime; var interval = DateTime.Now - cart.TransmitterLastTime;
switch (cart.Transmitter_SB)
if (!TryGetStableTransmitterControlMode(
out var stableControlMode))
{ {
case TransmitterState.Mode0: // SB处于中间档或尚未稳定时立即停车,
cart.TransmitterControlMode = // 保持当前模式,不下发新的模式目标角。
DiverCartDefinition.ManualControlMode.Normal;
break;
case TransmitterState.Mode1:
cart.TransmitterControlMode =
DiverCartDefinition.ManualControlMode.Crab;
break;
case TransmitterState.Mode2:
cart.TransmitterControlMode =
DiverCartDefinition.ManualControlMode.Spin;
break;
default:
cart.ManualControl( cart.ManualControl(
cart.TransmitterControlMode, cart.TransmitterControlMode,
0, 0, 0, 0, 0, 0,
@@ -95,6 +144,9 @@ namespace MedullaAdapter
StopClampArms(); StopClampArms();
return; return;
} }
cart.TransmitterControlMode = stableControlMode;
// SA关闭后立即停车。 // SA关闭后立即停车。
if (!cart.Transmitter_SA) if (!cart.Transmitter_SA)
{ {
+70
View File
@@ -0,0 +1,70 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonUsage-MultiVehicleSync", "CommonUsage-MultiVehicleSync", "{2291F6EE-0AD9-D010-97BA-674682470F91}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commonusage", "commonusage", "{0A043828-FC50-B2F1-03BD-49EF4E42C81C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonUsage", "CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj", "{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MedullaAdapter", "MedullaAdapter\MedullaAdapter.csproj", "{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiWheelC", "MultiWheelC\MultiWheelC.csproj", "{29520219-FA63-4B59-AA80-91B4FFA0D9B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|x64.ActiveCfg = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|x64.Build.0 = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|x86.ActiveCfg = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Debug|x86.Build.0 = Debug|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|Any CPU.Build.0 = Release|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|x64.ActiveCfg = Release|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|x64.Build.0 = Release|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|x86.ActiveCfg = Release|Any CPU
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41}.Release|x86.Build.0 = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|x64.ActiveCfg = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|x64.Build.0 = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|x86.ActiveCfg = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Debug|x86.Build.0 = Debug|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|Any CPU.Build.0 = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|x64.ActiveCfg = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|x64.Build.0 = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|x86.ActiveCfg = Release|Any CPU
{95F7BD98-C801-4E4E-B8A6-C0EFE3535C5C}.Release|x86.Build.0 = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|x64.ActiveCfg = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|x64.Build.0 = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|x86.ActiveCfg = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Debug|x86.Build.0 = Debug|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|Any CPU.Build.0 = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|x64.ActiveCfg = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|x64.Build.0 = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|x86.ActiveCfg = Release|Any CPU
{29520219-FA63-4B59-AA80-91B4FFA0D9B1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0A043828-FC50-B2F1-03BD-49EF4E42C81C} = {2291F6EE-0AD9-D010-97BA-674682470F91}
{DAAF1A42-FA55-4FC0-8083-F5A2FEFE0A41} = {0A043828-FC50-B2F1-03BD-49EF4E42C81C}
EndGlobalSection
EndGlobal
+95 -92
View File
@@ -8,10 +8,10 @@
1. 先实现单台停车机器人小车的基本功能; 1. 先实现单台停车机器人小车的基本功能;
2. 在单车闭环稳定后逐步增加停车作业功能; 2. 在单车闭环稳定后逐步增加停车作业功能;
3. 基于仿真、台架和实车数据优化轨迹跟踪方法; 3. 基于台架和实车数据优化轨迹跟踪方法;
4. 最后再考虑多车通信、编队和协同控制。 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 上层动作、轨迹跟踪人工测试; - `MultiWheelC`Clumsy 上层C 层)动作、轨迹跟踪人工测试和实验记录
- `MedullaAdapter`Medulla 下层 MCU、CAN、串口、轮组、夹臂、遥控和报警适配; - `MedullaAdapter`Medulla 下层M 层)MCU、CAN、串口、轮组、夹臂、遥控和报警适配;
- `Shared`统一的二维坐标、底盘命令、坐标变换和多轮底盘适配; - `Shared`M/C 共享的二维坐标、底盘命令、坐标变换和多轮底盘适配(无独立 `.csproj`,由两端编译引入)
- `CommonUsage-MultiVehicleSync/commonusage`:仓库内的 `CommonUsage` 底盘公共库源码; - `CommonUsage-MultiVehicleSync/commonusage`:仓库内的 `CommonUsage` 底盘公共库源码;
- `Simulation`:基于 ASP.NET Core 的单车 Web 仿真器; - `data_process`:轨迹实验与舵轮响应的 Python 分析工具。
- `data_process`:轨迹实验 CSV 的 Python 分析工具。
仓库中没有 ROS/ROS 2 或 Docker 配置 仓库中没有 ROS/ROS 2、Docker 或 Web 仿真项目。插件由 Clumsy / Medulla 宿主加载,不能通过 `dotnet run` 独立启动
## 当前已接入能力 ## 当前已接入能力
@@ -48,7 +47,6 @@ MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层
| 驱动与反馈 | 8 个驱动电机和 4 个舵轮的命令、速度/位置/舵角反馈及远程帧状态 | | 驱动与反馈 | 8 个驱动电机和 4 个舵轮的命令、速度/位置/舵角反馈及远程帧状态 |
| 车辆状态 | 急停、启停、抱闸、灯光、电池 SOC/SOH 和驱动使能状态 | | 车辆状态 | 急停、启停、抱闸、灯光、电池 SOC/SOH 和驱动使能状态 |
| 诊断 | CAN 轮速事件与周期快照 CSV、轨迹实验 CSV、控制命令和 Detour 位姿记录 | | 诊断 | CAN 轮速事件与周期快照 CSV、轨迹实验 CSV、控制命令和 Detour 位姿记录 |
| 仿真 | 浏览器二维车辆显示、模式按钮、手动控制、车辆配置、复位和 REST API |
以上表示代码和测试入口已经存在,不等同于所有工况均已完成实车验收。 以上表示代码和测试入口已经存在,不等同于所有工况均已完成实车验收。
@@ -58,7 +56,7 @@ MyParking 是一个面向多轮停车机器人底盘的 C# 工程,覆盖上层
Clumsy 宿主 Clumsy 宿主
ClumsyPilot ───────────────┐ MultiWheelC ───────────────┐
│ │ │ │
▼ │ 实验 CSV ▼ │ 实验 CSV
Shared / CommonUsage ├──────────► data_process Shared / CommonUsage ├──────────► data_process
@@ -74,35 +72,46 @@ mcu_serial_bridge.dll │
│ │ │ │
▼ │ ▼ │
MCU ─► CAN / Serial / IO ──┘ 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 ```text
MyParking/ MyParking/
├── ParkingRobot.sln ├── ParkingRobot.sln # 根解决方案(CommonUsage / M / C
├── ClumsyPilot/ # 上层动作、跟踪、测试和实验记录 ├── build-and-package.ps1 # 官方构建与 M/C 打包脚本
├── MedullaAdapter/ # MCU、CAN、轮组、夹臂、遥控和报警 ├── AGENTS.md # 协作与代码规范
├── Shared/ # 共享命令、坐标变换和底盘适配 ├── MultiWheelC/ # C 层动作、跟踪、测试和实验记录
├── MedullaAdapter/ # M 层 MCU、CAN、轮组、夹臂、遥控和报警
├── Shared/ # 共享模型、数学方法和底盘适配
├── CommonUsage-MultiVehicleSync/ ├── CommonUsage-MultiVehicleSync/
│ └── commonusage/ # CommonUsage 公共底盘库源码 │ └── commonusage/ # CommonUsage 公共底盘库源码
├── Simulation/ # .NET 8 Web 仿真器 ├── ref/ # 构建生成的 CommonUsage.dll(勿手工覆盖)
│ ├── Commands/ # 可由特性自动发现的仿真动作 ├── data_process/
│ ├── Core/ # 仿真车辆、舵轮、时钟和世界 │ ├── 轨迹测试处理/ # 轨迹对比、误差、速度与角速度绘图
── Models/ # Web API DTO ── 电机响应处理/ # 舵轮响应快照分析
│ └── wwwroot/ # 浏览器界面 ├── docs/
├── data_process/ # Python 实验绘图脚本 │ ├── SteeringConstraintDesign.md # 舵轮限位设计讨论
├── ref/ # 两个插件共同使用的 CommonUsage.dll │ ├── chassis参考.json # 底盘参数样例
├── 测试方案.txt # 单车轨迹实验方案 ├── 测试方案.txt # 单车轨迹实验方案
── 记录.txt # 项目调试记录 │ └── 记录.txt # 项目调试记录
└── 电机记录.txt # 电机调试记录 └── output/ # 打包输出(gitignore
├── M/ # MedullaAdapter.dll + CommonUsage.dll
└── C/ # MultiWheelC.dll + CommonUsage.dll
``` ```
根目录 `ParkingRobot.sln` 当前只包含 `ClumsyPilot``MedullaAdapter``CommonUsage``Simulation` 需要分别构建 根目录 `ParkingRobot.sln` 包含 `CommonUsage``MedullaAdapter``MultiWheelC`,便于在 Visual Studio 中打开整仓。`Shared` 无独立项目,由 M/C 编译引入。部署打包仍以 `build-and-package.ps1` 为准
## 开发环境与依赖 ## 开发环境与依赖
@@ -111,74 +120,62 @@ MyParking/
- Python 环境,用于可选的实验数据绘图; - Python 环境,用于可选的实验数据绘图;
- Clumsy / Medulla 内部框架程序集,位于各项目的 `ref` 目录; - Clumsy / Medulla 内部框架程序集,位于各项目的 `ref` 目录;
- 实机所需的 `mcu_serial_bridge.dll`,当前仓库中未包含该文件; - 实机所需的 `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` - `MultiWheelC``netstandard2.0``Newtonsoft.Json 13.0.3``System.Numerics.Vectors 4.6.1`
- `CommonUsage``MQTTnet 4.3.7.1207``Newtonsoft.Json 13.0.3` - `MedullaAdapter``net8.0`):无 NuGet PackageReference,依赖本地 `ref` 程序集
- `data_process`NumPy、pandas、Matplotlib、SciPy。 - `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 ```powershell
dotnet restore CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj 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 ```text
ClumsyPilot/build/Clumsy/ClumsyPilot.dll
MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll
MultiWheelC/build/Clumsy/MultiWheelC.dll
``` ```
### 3. 构建 Web 仿真器 不要直接编辑 `bin``obj``build``output` 中的产物,也不要手工覆盖 `ref/CommonUsage.dll`
```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` 特性后,调度器会自动发现并在网页生成对应动作。
## 实车运行与 MCU 配置 ## 实车运行与 MCU 配置
实车插件不能通过 `dotnet run` 独立启动需要由匹配版本的 Clumsy/Medulla 宿主加载两个 DLL。宿主版本、部署目录和完整启动步骤尚未随仓库提供,待补充。 实车插件不能通过 `dotnet run` 独立启动需要由匹配版本的 Clumsy / Medulla 宿主分别加载:
```text
output/C/MultiWheelC.dll
output/M/MedullaAdapter.dll
```
宿主版本、部署目录和完整启动步骤尚未随仓库提供,待补充。
当前源码中的 MCU 默认参数: 当前源码中的 MCU 默认参数:
@@ -192,13 +189,13 @@ http://localhost:5203
| 自转最大角速度 | `30 deg/s` | | 自转最大角速度 | `30 deg/s` |
| 轮速诊断目录 | `logs\wheel-speed` | | 轮速诊断目录 | `logs\wheel-speed` |
当前工作区存在 `chassis.json` 底盘参数样例,但源码中尚未发现自动加载该文件的入口实车参数仍应以宿主实际配置为准。 `docs/chassis参考.json` 底盘参数样例源码中尚未发现自动加载该文件的入口实车参数仍应以宿主实际配置为准。
实机测试前必须确认端口、车号、舵轮零位与限位、速度单位、驱动方向、夹臂限位和急停链路。建议先架空驱动轮或在隔离区域低速测试,并保留独立可靠的物理急停,不能只依赖软件停车。 实机测试前必须确认端口、车号、舵轮零位与限位、速度单位、驱动方向、夹臂限位和急停链路。建议先架空驱动轮或在隔离区域低速、短距离测试,并保留独立可靠的物理急停,不能只依赖软件停车。
## 单车测试入口 ## 单车测试入口
`ClumsyPilot/MovementTests.cs` 当前注册: `MultiWheelC/MovementTests.cs` 当前注册:
- `准备:四个舵轮与车头方向一致` - `准备:四个舵轮与车头方向一致`
- `SendMotion:连续前进4m` - `SendMotion:连续前进4m`
@@ -227,25 +224,29 @@ Medulla 的轮速诊断可通过 `StartWheelSpeedDiagnostic` / `StopWheelSpeedDi
logs/wheel-speed/ logs/wheel-speed/
``` ```
在自行管理的 Python 环境中安装依赖: ### 轨迹测试处理
```powershell ```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 ```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` 当前仅为占位; - 多车通信、编队、同步和安全降级;`FleetKinematics.cs` 当前仅为占位;
- 宿主版本、插件部署目录、配置文件位置和发布流程。 - 宿主版本、插件部署目录、配置文件位置和发布流程。
@@ -253,12 +254,14 @@ python data_process\run_all_plots.py "路径\实验1.csv" "路径\实验2.csv" -
## 参与开发 ## 参与开发
1. 当前改动优先服务于单车闭环、停车功能和跟踪质量,不提前启用多车代码; 1. 当前改动优先服务于单车闭环、停车功能和跟踪质量,不提前启用多车代码;
2. 保持上层动作、共享运动学、底层硬件协议和仿真模块边界; 2. 保持 `CommonUsage``Shared``MedullaAdapter``MultiWheelC`模块边界;
3. 新增参数时注明坐标系、单位、默认值、车型和安全范围; 3. 新增参数时注明坐标系、单位、默认值、车型和安全范围;
4. 提交前构建受影响的项目,并记录仿真、台架或实车验证条件 4. 修改相关项目后运行 `build-and-package.ps1`,并确认 M/C 部署包使用同一份 `CommonUsage.dll`
5. 修改 `CommonUsage` 后同步更新根目录 `ref/CommonUsage.dll` 5. 未经明确要求,不改变速度或舵角符号、CAN ID、遥控器映射、机械限位和模式切换策略
6. 分支、评审和发布流程待团队补充。 6. 分支、评审和发布流程待团队补充。
更细的协作约定见 [`AGENTS.md`](AGENTS.md)。
## 许可证 ## 许可证
仓库中暂未提供许可证文件。使用和分发范围请遵循公司内部规定。 仓库中暂未提供许可证文件。使用和分发范围请遵循公司内部规定。
+95 -92
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; 1. Implement the basic functions of one parking robot first;
2. Add parking-operation features after the single-robot loop is stable; 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. 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 | | Stage | Current status | Notes |
| --- | --- | --- | | --- | --- | --- |
@@ -22,18 +22,17 @@ The current work remains focused on the **single robot** and has progressed from
## Overview ## 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; - `MultiWheelC`: Clumsy upper layer (C layer) for actions, tracking, manual tests, and experiment recording;
- `MedullaAdapter`: Medulla MCU, CAN, serial, wheel, clamp, remote-control, and alarm adaptation; - `MedullaAdapter`: Medulla lower layer (M layer) for MCU, CAN, serial, wheel, clamp, remote-control, and alarm adaptation;
- `Shared`: common 2D coordinates, chassis commands, frame transforms, and multi-wheel 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; - `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 experiments and steering-response analysis.
- `data_process`: Python tools for tracking-experiment CSV files.
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 ## 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 | | 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 | | 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 | | 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. 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 Clumsy host
ClumsyPilot ───────────────┐ MultiWheelC ───────────────┐
│ │ │ │
▼ │ experiment CSV ▼ │ experiment CSV
Shared / CommonUsage ├──────────► data_process Shared / CommonUsage ├──────────► data_process
@@ -74,35 +72,46 @@ mcu_serial_bridge.dll │
│ │ │ │
▼ │ ▼ │
MCU ─► CAN / Serial / IO ──┘ 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 ## Repository Layout
```text ```text
MyParking/ MyParking/
├── ParkingRobot.sln ├── ParkingRobot.sln # Root solution (CommonUsage / M / C)
├── ClumsyPilot/ # Upper-layer actions, tracking, tests, and recording ├── build-and-package.ps1 # Official build and M/C packaging script
├── MedullaAdapter/ # MCU, CAN, wheel, clamp, remote, and alarms ├── AGENTS.md # Collaboration and coding rules
├── Shared/ # Shared commands, frame transforms, and chassis adapter ├── 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-MultiVehicleSync/
│ └── commonusage/ # CommonUsage chassis-library source │ └── commonusage/ # CommonUsage chassis-library source
├── Simulation/ # .NET 8 Web simulator ├── ref/ # Generated CommonUsage.dll (do not overwrite by hand)
│ ├── Commands/ # Attribute-discovered simulation actions ├── data_process/
│ ├── Core/ # Vehicles, steer wheels, clock, and world │ ├── 轨迹测试处理/ # Trajectory comparison, error, speed, and yaw plots
── Models/ # Web API DTOs ── 电机响应处理/ # Steering-response snapshot analysis
│ └── wwwroot/ # Browser UI ├── docs/
├── data_process/ # Python experiment-plotting scripts │ ├── SteeringConstraintDesign.md # Steering-limit design notes
├── ref/ # CommonUsage.dll shared by both plugins │ ├── chassis参考.json # Sample chassis parameters
├── 测试方案.txt # Single-robot tracking experiment plan ├── 测试方案.txt # Single-robot tracking experiment plan
── 记录.txt # Project debugging notes │ └── 记录.txt # Project debugging notes
└── 电机记录.txt # Motor 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. The root `ParkingRobot.sln` includes `CommonUsage`, `MedullaAdapter`, and `MultiWheelC` for opening the repo in Visual Studio. `Shared` has no standalone project and is compiled into the M/C projects. Packaging still uses `build-and-package.ps1`.
## Development Environment and Dependencies ## Development Environment and Dependencies
@@ -111,74 +120,62 @@ The root `ParkingRobot.sln` currently contains only `ClumsyPilot` and `MedullaAd
- A Python environment for optional experiment plotting; - 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; - `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`; - `MultiWheelC` (`netstandard2.0`): `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; - `MedullaAdapter` (`net8.0`): no NuGet PackageReferences; depends on local `ref` assemblies;
- `data_process`: NumPy, pandas, Matplotlib, and SciPy. - `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 ```powershell
dotnet restore CommonUsage-MultiVehicleSync\commonusage\CommonUsage.csproj 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. Primary intermediate outputs:
### 2. Build Physical-Robot Plugins
```powershell
dotnet restore ParkingRobot.sln
dotnet build ParkingRobot.sln -c Debug
```
Primary outputs:
```text ```text
ClumsyPilot/build/Clumsy/ClumsyPilot.dll
MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll MedullaAdapter/build/Medulla/plugins/MedullaAdapter.dll
MultiWheelC/build/Clumsy/MultiWheelC.dll
``` ```
### 3. Build the Web Simulator Do not edit artifacts under `bin`, `obj`, `build`, or `output`, and do not manually overwrite `ref/CommonUsage.dll`.
```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.
## Physical Runtime and MCU Configuration ## 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: MCU defaults confirmed from the current source:
@@ -192,13 +189,13 @@ MCU defaults confirmed from the current source:
| Maximum spin rate | `30 deg/s` | | Maximum spin rate | `30 deg/s` |
| Wheel-speed diagnostic directory | `logs\wheel-speed` | | 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 ## Single-Robot Test Entries
`ClumsyPilot/MovementTests.cs` currently registers: `MultiWheelC/MovementTests.cs` currently registers:
- `准备:四个舵轮与车头方向一致` - `准备:四个舵轮与车头方向一致`
- `SendMotion:连续前进4m` - `SendMotion:连续前进4m`
@@ -227,25 +224,29 @@ Medulla wheel-speed diagnostics can be controlled with the `StartWheelSpeedDiagn
logs/wheel-speed/ logs/wheel-speed/
``` ```
Install dependencies in a Python environment managed by your team: ### Trajectory processing
```powershell ```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 ```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 ## Incomplete or Pending Validation
- Lidar point clouds, tire recognition, automatic vehicle entry, vehicle release, and the complete parking-operation state machine; - 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; - 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; - Automated unit tests and continuous integration;
- Multi-robot communication, formation, synchronization, and safety fallback; `FleetKinematics.cs` is currently only a placeholder; - 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. - Host versions, plugin deployment directories, configuration-file locations, and the release process.
@@ -253,12 +254,14 @@ When no CSV path is supplied, the scripts search the `data_process` directory. T
## Contributing ## Contributing
1. Prioritize single-robot closed-loop behavior, parking functions, and tracking quality; do not enable multi-robot code prematurely. 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. 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. 4. After changing the related projects, run `build-and-package.ps1` and confirm that the M/C packages use the same `CommonUsage.dll`.
5. After changing `CommonUsage`, update the root `ref/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. 6. The team still needs to document its branch, review, and release processes.
See [`AGENTS.md`](AGENTS.md) for more detailed collaboration rules.
## License ## License
No license file is currently included. Use and distribution must follow internal company policy. No license file is currently included. Use and distribution must follow internal company policy.
+2 -1
View File
@@ -291,7 +291,8 @@ namespace MyParking.Shared
vxMetersPerSecond, vxMetersPerSecond,
vyMetersPerSecond, vyMetersPerSecond,
omegaDegreesPerSecond, omegaDegreesPerSecond,
interval); interval,
enableDifferentialSteerFeedforward: true);
if (!success) if (!success)
{ {
// 防止分解失败后继续执行上一条运动命令。 // 防止分解失败后继续执行上一条运动命令。
+95
View File
@@ -0,0 +1,95 @@
{
"MaxManualSpeed": 0.3,
"MaxManualAngularSpeed": 45.0,
"test3": 24,
"trigger": 0,
"ManualArmSpeedFac": 5.0,
"CarNum": 1,
"MusicVolume": 5,
"LeftArmLowerPos": -76358,
"LeftArmUpperPos": 38224,
"RightArmLowerPos": -41976,
"RightArmUpperPos": 73519,
"MCUPort": "COM3",
"TransmitterSpeedUpperLimit": 1.0,
"TransmitterSpeedLowerLimit": 0.0,
"ThBiasLeftFront": -342.0,
"ThBiasLeftRear": -185.35,
"ThBiasRightFront": -58.5,
"ThBiasRightRear": -1198.85,
"TurnAccSpeed": 1000.0,
"MaxManualTheta": 45.0,
"IsDiffSteer": true,
"ManualThetaPow": 2.0,
"DiffSteerKp": 0.003,
"DiffSteerKi": 0.0,
"DiffSteerKd": 0.0,
"DiffSteerMaxI": 0.0,
"DiffSteerThresh": 0.3,
"DiffSteerDeadZone": 0.1,
"DiffSteerSpeedAcc": 1.0,
"Ghost_ActualSpeedLeftFront_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftFront_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedLeftRear_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftRear_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightFront_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightFront_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightRear_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightRear_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedLeftFrontLeft_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftFrontLeft_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedLeftFrontRight_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftFrontRight_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedLeftRearLeft_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftRearLeft_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedLeftRearRight_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedLeftRearRight_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightFrontLeft_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightFrontLeft_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightFrontRight_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightFrontRight_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightRearLeft_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightRearLeft_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualSpeedRightRearRight_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualSpeedRightRearRight_GhostPIDUpdater_threshold": 200.0,
"Ghost_ActualThLeftFront_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualThLeftFront_GhostPIDUpdater_threshold": 5.0,
"Ghost_ActualThLeftRear_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualThLeftRear_GhostPIDUpdater_threshold": 5.0,
"Ghost_ActualThRightFront_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualThRightFront_GhostPIDUpdater_threshold": 5.0,
"Ghost_ActualThRightRear_GhostPIDUpdater_kp": 0.5,
"Ghost_ActualThRightRear_GhostPIDUpdater_threshold": 5.0,
"WheelAngleChangeLimit": 20.0,
"ElectricDebugMode": false,
"PostGPSToDetour": false,
"GPSBaseLongitude": 0.0,
"GPSBaseLatitude": 0.0,
"GPSInCarX": 0.0,
"GPSInCarY": 0.0,
"GPSInCarTh": 0.0,
"LowBatteryAlarmThreshold": 15.0,
"LowBatteryStopThreshold": 10.0,
"GhostMode": false,
"QrMode": false,
"GhostEnableSimBattery": false,
"GhostTimeBatteryFac": 600.0,
"ReductionRatio": 1.74,
"WheelDiameter": 165.0,
"CloseMusic": false,
"IOObstaclSlowFac": 0.5,
"ManualSpeed": 0.2,
"ManualRotateSpeed": 10.0,
"GamepadRotateSpeed": 1.0,
"RecoveryTime": 2000.0,
"ManualModeArea": 0,
"ManualModeIOArea": 1,
"UseLessTag": true,
"MaxAngularSpeed": 75.0,
"SafetyRelayShielded": false,
"SafetyRelayShieldedRleaseTime": 30,
"RotateIoArea": 16,
"ChargeMaxThreshold": 95.0,
"TransmitterCOMNum": "COM5",
"UseTransmitter": true
}
View File