diff --git a/docs/superpowers/plans/2026-08-05-movementtest-st-time-controls.md b/docs/superpowers/plans/2026-08-05-movementtest-st-time-controls.md new file mode 100644 index 0000000..5f04763 --- /dev/null +++ b/docs/superpowers/plans/2026-08-05-movementtest-st-time-controls.md @@ -0,0 +1,116 @@ +# MovementTest ST Time Controls Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox syntax for tracking. + +**Goal:** Expose configurable ST horizon and trajectory timestamp spacing for observation-only MovementTest sessions. + +**Architecture:** TrajectoryObservationSettings owns TimeHorizonSeconds and OutputTimeStepSeconds, preserves them in a validated snapshot, and enforces a time step no larger than the horizon. Public MovementTest fields feed those settings, then TrajectoryObservationController copies both values into its session-local EM schedule. + +**Tech Stack:** C# 10, .NET, EMPlannerVerificationHost. + +## Global Constraints + +- TimeHorizonSeconds defaults to 6d. +- OutputTimeStepSeconds defaults to 0.10d. +- OutputTimeStepSeconds must be positive and no greater than TimeHorizonSeconds. +- ObserverPeriodSeconds stays 0.05d. +- SolverTimeoutSeconds stays 0.50d, MaximumOsqpIterations stays 12000, and all solver tolerances stay 1e-5d. +- Do not change production EM defaults, vehicle/map constraints, or observe-only command behavior. + +--- + +### Task 1: Propagate ST time controls into an EM request + +**Files:** + +- Modify: ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs + +**Interfaces:** + +- Consumes: TrajectoryObservationSettings.CreateValidatedSnapshot() and TrajectoryObservationController.StartCycle(...). +- Produces: TimeHorizonSeconds and OutputTimeStepSeconds in EmPlanningRequest.Configuration.Scheduling. + +- [ ] **Step 1: Write the failing test** + +Add assertions for the visible defaults and request propagation: + +~~~csharp +Verification.True(source.Contains("public double TimeHorizonSeconds = 6d;"), + "observer MovementTest exposes the ST time-horizon default"); +Verification.True(source.Contains("public double OutputTimeStepSeconds = 0.10d;"), + "observer MovementTest exposes the ST timestamp-spacing default"); + +var settings = new TrajectoryObservationSettings +{ + TimeHorizonSeconds = 4d, + OutputTimeStepSeconds = 0.20d, +}; +// Start one controller cycle. +Verification.NearlyEqual(4d, request.Configuration.Scheduling.TimeHorizonSeconds, + "observer configured ST time horizon"); +Verification.NearlyEqual(0.20d, request.Configuration.Scheduling.OutputTimeStepSeconds, + "observer configured ST timestamp spacing"); +~~~ + +Assert zero horizon, zero step, and a step larger than the horizon are rejected. + +- [ ] **Step 2: Run focused verification to verify it fails** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +~~~ + +Expected: FAIL because the ST time-control properties are absent. + +- [ ] **Step 3: Write the minimal implementation** + +Add public settings and comments: + +~~~csharp +/// 单次 ST 轨迹覆盖的未来时长,单位 s;不等于观察循环周期。 +public double TimeHorizonSeconds { get; set; } = 6d; + +/// 发布 Trajectory 相邻 TimeFromStart 时间戳的间隔,单位 s;不等于观察循环周期。 +public double OutputTimeStepSeconds { get; set; } = 0.10d; +~~~ + +Validate both values and require OutputTimeStepSeconds to be no larger than TimeHorizonSeconds. Copy them through the MovementTest and use: + +~~~csharp +configuration.Scheduling.TimeHorizonSeconds = settings.TimeHorizonSeconds; +configuration.Scheduling.OutputTimeStepSeconds = settings.OutputTimeStepSeconds; +~~~ + +- [ ] **Step 4: Run focused verification to verify it passes** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +~~~ + +Expected: PASS trajectory-observation. + +- [ ] **Step 5: Run full regression and build** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-all +dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore +~~~ + +Expected: all suites pass and the build reports zero errors. + +- [ ] **Step 6: Commit implementation** + +~~~powershell +git add ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs +git commit -m "feat: configure MovementTest ST time controls" +~~~ +