Files
ParkingRobot/docs/superpowers/prompts/2026-08-05-em-longitudinal-rolling-phase-3.md
T

6.4 KiB

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:

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:

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:

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:

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:

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.