2.2 KiB
Hohmann Transfer Rendezvous — Debug Report
Root Cause
The test uses two different time variables that are off by a factor of 10:
sim->time— simulation's internal clock, increments bysim->dt = 0.1eachupdate_simulation()callsim_time— test loop counter, increments byDT = 1.0each iteration
The dump milestones use sim_time:
if (i == int(wait_time / DT)) // wait_time=60062.65, DT=1.0 → i=60062
But the maneuvers trigger on sim->time. At i=60062, sim->time = 6006.2 — 10x too early. The departure maneuver actually fires at i ≈ 600627 (when sim->time ≥ 60062.65).
What This Means
The "AFTER DEPARTURE BURN" dump at i=60064 shows exec=0 — the burn hasn't happened yet. The dumps are capturing state at completely wrong simulation times.
Why the 11,579 km Separation
With TIME_STEP = 0.1, the Hohmann transfer parameters (wait_time = 60062.65, arrival_time = 62804.47) were computed assuming an instantaneous burn at exactly wait_time.
The sub-step interpolation now propagates burn_dt = 0.05 (from sim->time = 60062.6 to trigger = 60062.65), then burns, then propagates remaining = 0.05. This puts the chaser at a different orbital position at burn time than the old code, which propagated the full 0.1 step before burning.
The chaser's true anomaly at t = 60062.65 differs from its true anomaly at t = 60062.7 by ~0.006 rad. The Hohmann phasing was calculated for one starting position but the burn now happens at the other.
The Two Options
-
Update test expectations — The sub-step interpolation is more physically accurate. The test expectations were tuned to the old quantized (step-boundary) behavior. The 11,579 km error is the old test asserting old behavior.
-
Change trigger logic — If you want the burn to fire at the step boundary (old behavior), revert
scheduled_dttosim->dtfor time triggers. But then you lose sub-step accuracy.
Files to Look At in New Session
tests/test_rendezvous.cppline ~571 — the rendezvous assertion (expects <100m separation)src/maneuver.cppcheck_maneuver_trigger()— the TRIGGER_TIME sub-step logictests/test_rendezvous.toml— initial conditions for the rendezvous scenario