docs: hand off EM rolling planning phase two
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# EM Longitudinal Rolling Planning — Phase 2 Handoff
|
||||
|
||||
## Scope and commits
|
||||
|
||||
- Phase start baseline: `21b20d0` (`feat: separate rolling horizons from stop boundaries`)
|
||||
- Task 3: `94a9be9` (`feat: keep rolling speed envelopes open`)
|
||||
- Task 4: `efa03c1` (`feat: apply ST stop constraints only at real boundaries`)
|
||||
- Task 3 compatibility fixup: `dbc7b7c`
|
||||
- Task 4 initial-state/envelope fixup: `26bd822`
|
||||
- Task 5 / phase code end: `59d13e5` (`feat: seed rolling and exact-stop ST profiles`)
|
||||
|
||||
Only original-plan Tasks 3, 4, and 5 were implemented. The two fixups could not be autosquashed because the shared worktree has unrelated unstaged user changes and Git refused rebase. They are intentionally retained as separate local commits; their changes belong to Tasks 3 and 4 respectively.
|
||||
|
||||
No trajectory publication code, service-flow work, external hold behavior, chassis command, or Task 6+ production code was started. `OBSERVE_ONLY` remains unchanged.
|
||||
|
||||
## Delivered behavior
|
||||
|
||||
`PathSpeedLimit` now exposes `HasStopBoundary` and `PathUpperBoundS`; `TerminalPathS` remains a warning-free compatibility alias. `PathSpeedLimitBuilder` gives `RollingContinuation` a nonzero open end and no stop boundary. `ApproachStopBoundary` and `ExactStopAtBoundary` use `JerkLimitedStoppingMath.MaximumInitialSpeedForDistance` at every PathS sample against `StopBoundaryPathS`; only the actual stop-boundary sample is exactly zero. The old square-root limit and discrete deceleration tail approximation were removed.
|
||||
|
||||
`LongitudinalConstraintBuilder` applies no terminal S/U/A equality to Rolling or Approach. Exact mode uses `LongitudinalTerminalSchedule.GetStabilizationStartIndex` and pins every internal tail knot to `StopBoundaryPathS`, zero speed, and zero acceleration. Its row count is `8*K-2+3*M`; the other modes remain `8*K-2`.
|
||||
|
||||
`LongitudinalSolutionValidator` always checks knot layout, finite values, PathS monotonicity/bounds, jerk, and exact constant-jerk dynamics. Approach and Exact independently test each knot against its complete jerk-limited stopping distance; Exact also canonicalizes the entire internal static tail. The Task 4 fixup preserves the supplied physical state at knot zero: the conservative maximum-positive-acceleration envelope applies from the following knot, while the actual-state stopping check still applies at knot zero.
|
||||
|
||||
`SequentialLongitudinalOptimizer` dispatches seed construction by `EmLongitudinalMode`. Rolling forward-integrates without forcing the LS path end. Approach uses the stopping-speed envelope while producing only this ST time prefix. Exact uses the stabilization schedule, tries a cruise-plus-jerk-brake profile, and otherwise constructs a terminal-equality seed before filling the QP-internal static tail. Exact-only outer iteration pins tail progress; ordinary knots use `PathUpperBoundS`. The final-knot forward-probe index guard remains, without restoring an unconditional terminal-position pin.
|
||||
|
||||
`LongitudinalObjectiveBuilder` uses `PathUpperBoundS` for normalization and omits the terminal-acceleration soft residual only in Exact mode. Integration fixtures now explicitly distinguish generic Approach OSQP scenarios from the independent Exact-stop tail scenario; this avoids incorrectly demanding an exact stop for a distance that cannot fit inside the ST motion horizon.
|
||||
|
||||
## Interfaces the next phase must preserve
|
||||
|
||||
- `JerkLimitedStoppingMath`, `JerkLimitedStoppingProfile`
|
||||
- `EmLongitudinalMode`: `RollingContinuation`, `ApproachStopBoundary`, `ExactStopAtBoundary`
|
||||
- `LongitudinalTerminalSchedule.GetStabilizationStartIndex`
|
||||
- `PlanningHorizonSelection.WindowEndReferenceS`, `WindowEndBoundaryType`, `LongitudinalMode`, `StopBoundaryReferenceS`, `HasStopBoundary`
|
||||
- Mode-explicit `LongitudinalPlanningInput`, `PathUpperBoundS`, `StopBoundaryPathS`, `HasStopBoundary`
|
||||
- `PathSpeedLimit.HasStopBoundary` and `PathSpeedLimit.PathUpperBoundS`
|
||||
|
||||
`TerminalPathS` is compatibility-only. Use `PathUpperBoundS` for every path/window upper bound and `StopBoundaryPathS` only for a real Goal/GearSwitch stop.
|
||||
|
||||
## Verification evidence
|
||||
|
||||
The following were rerun at phase end and exited `0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- longitudinal-model
|
||||
# PASS longitudinal-model
|
||||
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- longitudinal-integration
|
||||
# PASS longitudinal-integration
|
||||
|
||||
git diff --check
|
||||
# exit 0
|
||||
```
|
||||
|
||||
The .NET runs report two pre-existing obsolete warnings from `MovementTests.TireFollowing.cs` and `TireFollowing.cs`; phase 2 introduced none. `git diff --check` also prints CRLF notices for unrelated pre-existing dirty files but returned success.
|
||||
|
||||
`git log -5 --oneline` ended with `59d13e5`, `26bd822`, `dbc7b7c`, `efa03c1`, and `94a9be9`. The worktree still contains extensive unrelated modified, deleted, and untracked PathSmoothing, CoarsePath, Map, report, and configuration files. Preserve them; never reset, clean, broadly stage, or commit them.
|
||||
|
||||
## Phase 3 boundary
|
||||
|
||||
Phase 3 is only original-plan Tasks 6 and 7: mode-aware trajectory sampling/publication validation, followed by previous-trajectory longitudinal soft references. It must not begin Task 8, 9, or 10. `ZeroSpeedHoldSeconds` remains outside the QP horizon and becomes an external hold only for Exact mode. Rolling and Approach must publish their ST horizon unchanged, with no synthetic terminal stop or boundary marker.
|
||||
@@ -0,0 +1,86 @@
|
||||
# New Window Prompt: EM Longitudinal Rolling Planning — Phase 3
|
||||
|
||||
Work in `D:\Users\Desktop\项目\prakrobot\ParkingRobot`. This is an implementation task, not a design discussion. Read these files completely before editing:
|
||||
|
||||
- `docs/superpowers/specs/2026-08-05-em-longitudinal-rolling-planning-design.md`
|
||||
- `docs/superpowers/plans/2026-08-05-em-longitudinal-rolling-planning.md`
|
||||
- `docs/superpowers/plans/2026-08-05-em-longitudinal-rolling-four-phase-roadmap.md`
|
||||
- `docs/superpowers/handoffs/2026-08-05-em-longitudinal-rolling-phase-2.md`
|
||||
|
||||
Phase 2 code ends at `59d13e5`; Task 3 and Task 4 also have local fixups `dbc7b7c` and `26bd822` because the dirty shared worktree prevented autosquash. Preserve all actual interfaces listed in the handoff, especially `EmLongitudinalMode`, `LongitudinalTerminalSchedule`, mode-explicit `LongitudinalPlanningInput`, `PathUpperBoundS`, `StopBoundaryPathS`, and `PathSpeedLimit.HasStopBoundary`.
|
||||
|
||||
Execute only original-plan Tasks 6 and 7. Do not begin Task 8 or later. Use `executing-plans`, TDD for every behavior change, `systematic-debugging` for any unexpected build/test failure, and `verification-before-completion` before every commit and before phase handoff. No brainstorming is needed.
|
||||
|
||||
Start by recording:
|
||||
|
||||
```powershell
|
||||
git branch --show-current
|
||||
git status --short
|
||||
git log -10 --oneline
|
||||
git show --stat --oneline 59d13e5
|
||||
```
|
||||
|
||||
The branch is `trajplanner` and the worktree has substantial unrelated user changes. Never reset, checkout, clean, broadly stage, stash user files, use `git add .`, or use `git add -A`. Stage only the listed task files and run `git diff --cached --name-only` before every commit.
|
||||
|
||||
## Task 6 — mode-aware trajectory publication and validation
|
||||
|
||||
Files:
|
||||
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Contracts/EmTrajectoryMetadata.cs`
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Trajectory/TrajectorySampleSchedule.cs`
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Trajectory/EmTrajectoryAssembler.cs`
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Validation/EmTrajectoryValidator.cs`
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Facade/EmPlanningService.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryChecks.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/ExecutorChecks.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/CoordinatorChecks.cs`
|
||||
|
||||
Write and observe failing trajectory tests first. Add `EmLongitudinalMode` to trajectory metadata and pass the mode from `EmPlanningService`. For Rolling and Approach, sample exactly the ST candidate knots: no synthetic zero-speed hold, no terminal boundary anchor, and a nonzero terminal state remains valid when ordinary limits are met.
|
||||
|
||||
For Exact mode, verify the complete internal static tail from `LongitudinalTerminalSchedule.GetStabilizationStartIndex`: every tail knot must hold the same PathS with `U=0`, `A=0`, and zero tail jerk. Mark only the first tail knot as the real Goal/GearSwitch boundary anchor; then append `ZeroSpeedHoldSeconds` only after the QP horizon, without duplicate timestamps. Add `TerminalAccelerationNotZero` to publication failures and make `EmTrajectoryValidator` always retain ordinary finite, kinematic, jerk, and collision checks while applying terminal-anchor/tail checks only to Exact mode. Do not weaken any threshold or add chassis behavior.
|
||||
|
||||
Required checks before the Task 6 commit:
|
||||
|
||||
```powershell
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- coordinator
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- executor
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation
|
||||
```
|
||||
|
||||
Commit only the Task 6 files with:
|
||||
|
||||
```powershell
|
||||
git commit -m "feat: publish rolling trajectories without stop tails"
|
||||
```
|
||||
|
||||
## Task 7 — previous-trajectory longitudinal soft reference
|
||||
|
||||
Files:
|
||||
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Longitudinal/LongitudinalPreviousTrajectorySeedBuilder.cs` (new)
|
||||
- `ClumsyPilot/ParkrobTrajplanner/EMPlanner/Facade/EmPlanningService.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/LongitudinalModelChecks.cs`
|
||||
- `ClumsyPilot/tests/EMPlannerVerificationHost/EmPlanningServiceChecks.cs`
|
||||
|
||||
Write and observe failing tests first. Create `LongitudinalPreviousTrajectorySeed` with `PathS`, `ProgressSpeedMetersPerSecond`, and `Empty`. Its builder must resample the previous `EmTrajectory` at `newEffectiveAtUtc + knotTime`, linearly interpolate world position and signed speed, project monotonically onto the current `LateralPath`, and publish absolute progress speed. Any incompatible direction, segment, missing trajectory, or out-of-range sample must return `Empty` without throwing into planning.
|
||||
|
||||
In `EmPlanningService`, construct current ST knot times after lateral planning, build this seed from the previous trajectory/current path/effective time/segment/direction, and pass the two reference arrays into the existing mode-explicit `LongitudinalPlanningInput`. Confirm the objective receives nonzero previous-S and previous-U soft-reference terms only for a valid seed; these remain soft terms, never terminal constraints. Keep LS slicing on `WindowEndReferenceS`.
|
||||
|
||||
Required checks before the Task 7 commit:
|
||||
|
||||
```powershell
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- longitudinal-model
|
||||
dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-planning-service
|
||||
```
|
||||
|
||||
Commit only the Task 7 files with:
|
||||
|
||||
```powershell
|
||||
git commit -m "feat: reuse prior trajectory in longitudinal planning"
|
||||
```
|
||||
|
||||
Global semantics are non-negotiable: `DistanceHorizonMeters` is LS look-ahead only; `TimeHorizonSeconds` is one ST horizon only; only Goal/GearSwitchApproach may require Exact zero speed; `ZeroSpeedHoldSeconds` is outside the QP horizon; do not loosen jerk, acceleration, solver, or validation thresholds; and retain `OBSERVE_ONLY` with no chassis command.
|
||||
|
||||
At phase end, rerun `trajectory`, `em-planning-service`, `coordinator`, and `executor`; run `git diff --check`, `git log -5 --oneline`, and `git status --short`. Use `writing-plans` to create the phase-3 handoff and phase-4 prompt, commit only those two documents, and stop without implementing Task 8.
|
||||
Reference in New Issue
Block a user