From 113d0c9d9bb224d82ec2b734cd2c0b61d71e1c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=96=84=E4=BA=91?= Date: Tue, 4 Aug 2026 00:39:35 +0800 Subject: [PATCH] docs: record Stage 4 OSQP checkpoint --- .../progress/em-planner-progress.md | 98 +++++++++++-------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/docs/superpowers/progress/em-planner-progress.md b/docs/superpowers/progress/em-planner-progress.md index 7227c9c..213d169 100644 --- a/docs/superpowers/progress/em-planner-progress.md +++ b/docs/superpowers/progress/em-planner-progress.md @@ -2,10 +2,10 @@ ## Current State -- Current stage: 3 — OSQP contracts and native loading +- Current stage: 4 — OSQP solve lifecycle and status mapping - Stage status: Completed - Current branch: `trajplanner` -- Last checkpoint commit: `39c1708` (last Stage 3 functional commit; this file is the Stage 3 checkpoint) +- Last checkpoint commit: `61dfa79` (last Stage 4 functional commit; this file is the Stage 4 checkpoint) - Protocol design baseline: `554c84f` - Implementation-plan baseline: `8dd8ff0` @@ -22,21 +22,22 @@ | 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 1 — Solver-Neutral Sparse QP Contracts | `104081e` | RED: `optimization` failed with missing `SparseTripletBuilder`; GREEN: `PASS optimization` covered deterministic CSC canonicalization, duplicate summation, zero dropping, upper-triangular Hessians, QP validation, and defensive copies. | | 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 2 — Reproducible OSQP 1.0.0 Native Package | `2abb465` | RED: the planned package script was absent; GREEN: the fixed-tag build printed `OSQP v1.0.0 win-x64 package ready`. The package contains the pinned DLL, license files, version/build flags, and lowercase SHA-256 manifest; `dumpbin` verified x64 and the four required exports. | | 3 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 3 — Absolute-Path Native Loader and ABI Structures | `39c1708` | RED: `osqp-loader` failed with missing `OsqpNativeLoader`; GREEN: `PASS osqp-loader` verified missing/corrupt DLL diagnostics, real `1.0.0` loading from a copied plugin directory, and one stable handle across 16 parallel first-use calls. | +| 4 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 4 — OSQP Solve Lifecycle and Status Mapping | `a957fda` | RED: `osqp-loader` failed with missing `OsqpNativeSolver`; GREEN: fixed bounded, equality, infeasible and one-tick time-limit QPs pass inside a copied clean-plugin process. Status values 1–11 map to the planner-neutral contract, with finite metrics and captured native status. Twenty exact `osqp` solve/cleanup cycles printed `PASS osqp-solve` and `PASS osqp-loader` on every iteration. | +| 4 | `2026-08-03-em-planner-osqp-backend-implementation.md` | Task 5 — Backend Completion Gate | `61dfa79` | RED: `osqp` was rejected by the verification-host command parser; GREEN: it runs the full solver/loader group. README now records the pinned package, deployment layout, absolute-load rule, ownership and status mapping. `dumpbin /dependents` found only Windows/runtime DLLs; an externally located working directory still loaded a copied clean plugin bundle and solved the micro QPs. | ## Current Verification - Commands: - - `powershell -ExecutionPolicy Bypass -File ClumsyPilot/ThirdParty/OSQP/build-win-x64.ps1` - - `dumpbin /headers ClumsyPilot/ThirdParty/OSQP/win-x64/osqp.dll` - - `dumpbin /exports ClumsyPilot/ThirdParty/OSQP/win-x64/osqp.dll` - - `dotnet run --no-build --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization` - - `dotnet run --no-build --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp-loader` - - `dotnet run --no-build --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation` - - `dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore` + - `1..20 | ForEach-Object { dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp; if ($LASTEXITCODE -ne 0) { throw "OSQP verification failed on iteration $_" } }` + - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization` + - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp-loader` + - `dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation` + - `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe /dependents ClumsyPilot/ThirdParty/OSQP/win-x64/osqp.dll` + - Clean copied plugin bundle: run `EMPlannerVerificationHost.exe osqp-probe` from a separate working directory. - `git diff --check` -- Result: The pinned OSQP package built from tag `v1.0.0` with builtin algebra, shared library, double precision, int32 indices, unpacked settings, and printing/codegen/derivatives disabled. Its DLL is x64; `osqp_version`, `osqp_setup`, `osqp_solve`, and `osqp_cleanup` are exported; and the recomputed SHA-256 exactly matches `SHA256SUMS`. `optimization` and `osqp-loader` pass. The latter uses copied plugin directories to prove missing/corrupt native libraries return structured diagnostics without `BadImageFormatException` escaping, the real library reports `1.0.0`, and 16 concurrent first loads share one handle. `all-foundation` prints `PASS foundation`, `PASS segmentation`, `PASS frenet`, and `PASS corridor`. `git diff --check` has no whitespace diagnostics, and the staging area was empty before this checkpoint update. +- Result: `OsqpNativeSolver` pins input arrays, allocates managed-owned CSC/settings blocks, calls setup/warm-start/solve, copies native solution and information before cleanup, and releases the workspace, blocks and pins in reverse acquisition order. Native statuses 1/2/3–4/5–6/7/8/9–11 map respectively to `Solved`/`SolvedInaccurate`/`PrimalInfeasible`/`DualInfeasible`/`MaximumIterations`/`TimeLimit`/`NativeError`; unknown values also become `NativeError`. All twenty exact `osqp` cycles exited 0 and printed both PASS lines. `optimization`, `osqp-loader`, and all four `all-foundation` groups exited 0. The dependency list is `KERNEL32.dll`, `VCRUNTIME140.dll`, and API-set CRT DLLs only—no MKL, CUDA or external QDLDL. A freshly copied host/plugin bundle run with its working directory elsewhere reported `STATUS=Solved`, `VERSION=1.0.0`, and `SOLVE_CHECKS=PASS`. `git diff --check` had no whitespace diagnostics; immediately before this checkpoint update the staging area was empty and no Stage 4 scope files were uncommitted. - Normal-project baseline: `dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore` exits 1 only for the legacy `auto_avoidance/MultiWheelAutoAvoidance.cs` missing `NetTopologySuite` (3) and `OpenCvSharp` (1) references, plus that legacy file's duplicate-using warning. There are no EM Planner errors. -- Verified commits: `104081e`, `2abb465`, and `39c1708` +- Verified commits: `104081e`, `2abb465`, `39c1708`, `a957fda`, and `61dfa79` ## Preserved Workspace State @@ -47,53 +48,66 @@ ## Decisions Needed -- None. Stage 3 completed within scope. +- None. Stage 4 completed within scope. ## Next Stage -- Stage: 4 — OSQP solve lifecycle and status mapping -- Readiness: Ready for Stage 4 entry checks. -- Plan: `docs/superpowers/plans/2026-08-03-em-planner-osqp-backend-implementation.md` +- Stage: 5 — LS model and geometry validation +- Readiness: Ready for Stage 5 entry checks after this checkpoint is committed. +- Plan: `docs/superpowers/plans/2026-08-03-em-planner-lateral-ls-implementation.md` - Tasks: - - Task 4 — OSQP Solve Lifecycle and Status Mapping - - Task 5 — Backend Completion Gate + - Task 1 — Variable Layout and Exact Discrete Lateral Dynamics + - Task 2 — Normalized Objective and Linear Hard Constraints + - Task 3 — Nonlinear Geometry Evaluation and Independent Validation - Entry checks: - - Confirm branch `trajplanner`, commits through `39c1708`, and an empty staging area. + - Confirm branch `trajplanner`, `a957fda` and `61dfa79` are ancestors of `HEAD`, and the Stage 4 progress checkpoint is present. - Capture `git status --short` before editing and preserve every unrelated user change. - - Read the two EM Planner design documents, this progress file, and the OSQP implementation plan. - - Run `optimization`, `osqp-loader`, and `all-foundation` before Task 4. - - Confirm `CMake`, Visual Studio x64 Build Tools, and `dumpbin` remain available for package checks. + - Read the two EM Planner design documents, this progress file, and the lateral-LS implementation plan in full. + - Run `optimization`, `osqp`, and `all-foundation` before Task 1. + - Keep the OSQP boundary solver-neutral; LS must consume `IQpSolver` rather than native OSQP types. - Exit gate: - - Tasks 4 and 5 each have an independent commit and their prescribed RED/GREEN evidence. - - Feasible and infeasible QPs map to planner-neutral statuses; native workspace allocation/release and repeated loading are stable. - - The clean-plugin-directory loader check, `optimization`, `osqp-loader`, and `all-foundation` pass. - - `git diff --check` is clean; the staging area is empty; a Stage 4 progress checkpoint is committed alone. + - Tasks 1–3 each have an independent commit and their prescribed RED/GREEN evidence. + - Discrete LS dynamics, normalized objective/hard-constraint coefficients, nonlinear geometry evaluation and independent world-space validation all pass. + - `optimization`, `osqp`, `all-foundation`, LS plan gates and `git diff --check` pass; the staging area is empty; a Stage 5 progress checkpoint is committed alone. ## Next-Window Prompt ```text -Please continue the ParkingRobot repository EM Planner multi-window implementation. +请继续 ParkingRobot 仓库的 EM Planner 多窗口实施。 -Working directory: D:\Users\Desktop\项目\prakrobot\ParkingRobot +工作目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot -This window is Stage 4: OSQP solve lifecycle and status mapping. Execute only Task 4 and Task 5 of: -docs/superpowers/plans/2026-08-03-em-planner-osqp-backend-implementation.md -Do not start LS, ST, rolling execution, dynamic obstacles, or any later stage. +本窗口只执行阶段 5:LS 模型与几何验证。唯一授权范围是: +`docs/superpowers/plans/2026-08-03-em-planner-lateral-ls-implementation.md` 的 Task 1、Task 2、Task 3。 +不要开始该计划的 Task 4(SQP 外循环)或 Task 5(真实 OSQP 场景),更不要开始 ST、轨迹发布、滚动执行、控制适配、动态障碍物或任何后续阶段。 -Before working, fully read: -1. docs/superpowers/specs/2026-08-03-em-planner-ls-st-design.md -2. docs/superpowers/specs/2026-08-03-em-planner-windowed-execution-design.md -3. docs/superpowers/progress/em-planner-progress.md -4. docs/superpowers/plans/2026-08-03-em-planner-osqp-backend-implementation.md +开始任何检查或编辑前,必须完整读取: +1. `docs/superpowers/specs/2026-08-03-em-planner-ls-st-design.md` +2. `docs/superpowers/specs/2026-08-03-em-planner-windowed-execution-design.md` +3. `docs/superpowers/progress/em-planner-progress.md` +4. `docs/superpowers/plans/2026-08-03-em-planner-lateral-ls-implementation.md` -Use executing-plans, test-driven-development, and verification-before-completion. Do not use subagents. +使用 `executing-plans`、`test-driven-development` 和 `verification-before-completion`;不要使用子代理。只在 `trajplanner` 上工作。Stage 4 的功能提交必须可从 `HEAD` 追溯:`a957fda`(原生 solve/status)与 `61dfa79`(后端门禁);随后是本进度文件的独立 Stage 4 checkpoint。若这些提交、进度记录或入口验证任一不一致,停止实施并先报告事实,不要猜测或重做已提交工作。 -Before Task 4, confirm branch trajplanner, commits through 39c1708, an empty staging area, and preserve the saved git status --short baseline. Run: -dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization -dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp-loader -dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation +开始 Task 1 前: +- 保存完整 `git status --short` 基线,确认暂存区为空;工作区已有大量与 EM 无关的 Map、CoarsePath、PathSmoothing、报告、文档、项目文件和未跟踪修改,必须完整保留。 +- 不得使用 `git add .`、`git add -A`、`git reset --hard`、`git checkout --` 或任何清理命令;每次只用显式路径暂存计划指定文件。 +- 运行以下隔离入口验证,并确认全部退出码为 0: + ```powershell + dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- optimization + dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- osqp + dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- all-foundation + ``` +- `ClumsyPilot.csproj` 中有既有用户 hunk;正常项目构建仍会因旧 `auto_avoidance/MultiWheelAutoAvoidance.cs` 缺少 `NetTopologySuite` 与 `OpenCvSharp` 失败。不要修改、删除、屏蔽或绕过该旧模块,也不要把它当成 EM 回归。 -Use strict per-task TDD, explicit staging, and an independent commit for each task. Do not modify unrelated Map, CoarsePath, PathSmoothing, or legacy auto_avoidance content. The normal-project build's existing auto_avoidance dependency failure is a recorded baseline, not something to fix or bypass. +实施约束: +- 严格逐任务 TDD:先增加该任务的最小失败检查,观察其因缺少目标行为而失败,再写最小生产代码,并运行计划指定 GREEN 验证。 +- Task 1、2、3 各自形成独立功能提交;提交前用 `git diff --cached --check` 和 `git diff-tree` 核对文件集合。 +- LS 只能通过既有的 solver-neutral `IQpSolver`/`QuadraticProgram` 边界使用 OSQP,不能向 LS 引入 P/Invoke、当前工作目录依赖、UI 或硬件对象。 +- 不修改无关的 Map、CoarsePath、PathSmoothing、旧 `auto_avoidance` 或 Stage 4 已完成的 OSQP 后端,除非该 LS 计划明确列出且变更为完成 Task 1–3 所必需。 -Before completion, run the plan verification and git diff --check. Update and separately commit this progress file only after Stage 4 is genuinely complete. +阶段结束条件: +- 仅在 Task 1–3 均有独立提交、各自 RED/GREEN 证据和该计划全部出口验证通过后,运行 `optimization`、`osqp`、`all-foundation`、LS 验收命令及 `git diff --check`。 +- 检查暂存区为空、用户的起始 `git status --short` 修改仍被保留;然后只更新并单独提交 `docs/superpowers/progress/em-planner-progress.md`。 +- 最终报告必须给出实际提交、命令/退出码、未处理基线问题,并提供阶段 6(仅 LS Task 4–5)的精确下一窗口提示词。 ```