Estimate
The EKF tracks position, heading, speed and two current components. Heading innovations wrap around ±π; covariance uses the Joseph update.
State estimation · Motion planning · Feedback control
Build the stack.
Test its assumptions.
A configurable marine navigation laboratory. The latest work tackles the details that change closed-loop behavior: estimating current, repairing routes correctly, recovering from obstacle margins, and reusing optimization problems.
01 / An integrated learning laboratory
A route is only one part of navigation. The estimator has error, the environment changes, and a vessel takes time to turn.
I implemented the complete stack—estimation, global planning, guidance, local planning, and control—behind explicit interfaces. YAML profiles exchange components while preserving the surrounding experiment. The companion Navigation Lab makes the scenario editable and every recorded decision inspectable.
The October update works inside those interfaces. It corrects incremental planning, estimates water current, handles drift into planning margins, and reduces repeated computation in RRT* and MPC. Regression checks and current sweeps show how those changes affect the whole loop.
02 / Stable boundaries
The default composition is EKF → A* → line-of-sight guidance → artificial potential field → PID. A geometric Path2D becomes a timed Trajectory2D; the controller returns acceleration and yaw-rate commands. This keeps a route’s geometry separate from its execution.
Six internal states; position, heading and speed remain the public vessel-state interface
A route through a shared obstacle environment
Target → path / trajectory → command
Local trajectory + first command
Current, actuator limits and yaw lag shape the next state
The EKF tracks position, heading, speed and two current components. Heading innovations wrap around ±π; covariance uses the Joseph update.
A* and Dijkstra share an eight-connected grid. D* Lite repairs routes after occupancy changes. Geometric RRT* samples continuous space and rewires its tree.
Line-of-sight guidance advances a lookahead target. Local choices include artificial potential fields, short-horizon RRT*, and trajectory-generation MPC.
Bounded heading/speed PID and tracking MPC follow timed references. Combined MPC selects a local trajectory and its first command together. All three MPC roles share one solver core.
03 / What changed
Two current states let GPS residuals correct the motion prediction. The downstream vessel-state contract stays the same, so the estimator can improve without rewriting every planner and controller.
A conservative adjustment to the D* Lite heuristic resolves floating-point queue ties after the start moves. Map updates now use the shared inflated environment and preserve overlapping static obstacles.
Current can carry the estimate inside a planning margin. Shared geometry checks allow outward or tangential escape, and APF removes inward motion components. RRT* uses the same escape rule; telemetry labels these steps explicitly.
MPC caches a parameterized CasADi problem per obstacle count and shifts its control guesses. Soft clearance penalties handle an initially violated margin. Route references begin at the vessel’s projection onto the path.
RRT* also reduces repeated work through vectorized neighbor searches and explicit descendant-cost updates. Its local planner advances cached trajectories to the current simulation time, so a reused plan keeps the right timing.
04 / Evidence at several scales
The update is supported by regression tests, seven recorded profiles, and a current sweep repeated on the old and updated revisions.
Tests passed in a fresh Docker check
Updated sampled runs; previously 12/108
Updated mismatches against Dijkstra
The sweep uses east/north currents from −0.3, 0 and +0.3 m/s, with seeds 1, 2, 3 and 7. It checks sampled point-vessel overlap with the original static circles. Dynamic cells, swept hull collisions and guaranteed planning-margin clearance are outside that metric.
D* Lite’s updated repairs match Dijkstra in all 668 checked cases. The old run has 265 reachability mismatches and 55 longer routes across 638 checks. Edits depend on the route produced, so the two revisions encounter different repair cases.
The supplied workstation benchmark reports 2.7–15.6 ms per solve across horizons of 10–80 steps, compared with 16.0–117.5 ms before. It averages ten calls after a warm-up on the same input. The update also changes hard obstacle constraints to soft penalties, so the timing reflects both formulation and implementation changes.
A fixed 2,000-iteration plan takes 0.28 s versus 2.91 s before, with the same reported route cost. These are single-machine timings without uncertainty intervals; they are not real-time guarantees.
All seven pass their estimated-position goal check. Fresh runs reproduced the supplied rounded results. None records a fallback or emergency-braking step; three profiles explicitly report margin escape.
| Profile | Sim. time | Min. clearance | Recorded behavior |
|---|---|---|---|
| A* + APF + PID | 32.1 s | 2.045 m | 0 escape steps |
| Global RRT* | 30.8 s | 2.274 m | 0 escape steps |
| Local RRT* | 32.3 s | 2.183 m | 7 escape steps |
| D* Lite | 32.1 s | 2.183 m | 2 route repairs · 10 escape steps |
| Tracking MPC | 32.4 s | 2.108 m | 0 escape steps |
| Trajectory MPC* | 57.5 s | 2.225 m | 0 escape steps |
| Combined MPC | 37.4 s | 2.080 m | 19 escape steps |
Time uses the final replay frame, 0.1 s later than the repository’s summary CSV. Clearance is sampled from the point vessel to active obstacle boundaries; the 2.2 m planning margin is a separate quantity. *Trajectory MPC uses zero current, a lower requested speed and shorter yaw lag. D* Lite adds scheduled map changes. These profiles are not an equal-condition ranking.
Four of seven final truth positions remain outside the 1.5 m goal radius. For the baseline, estimated goal distance is 1.433 m and actual distance is 1.577 m. Improved localization reduces error; the stopping rule still needs to be read correctly.
05 / Follow the decisions
Five grid cells close at 8 seconds and reopen at 20 seconds. D* Lite repairs the route twice. Later, APF reports ten margin-escape steps. The updated run reaches its estimated-goal criterion at 32.1 seconds with no recorded emergency braking.
The blue vessel and its recorded track move northeast around circular obstacles. The orange estimate, dashed global route and green local plan remain visible. Pink occupied cells appear at 8 simulation seconds and disappear at 20 seconds, triggering route revisions. The local planner later displays “Escaping margin.” The terminal frame is at 32.1 seconds. Chrome captured every third 0.1-second step, encoded at 12 frames per second; playback is 3.6× simulation time with a final hold.
These standalone HTML viewers replay recorded decisions. Playback controls change the view of the recording.
06 / What the improvement leaves open
The EKF now learns current, but MPC still predicts direct yaw-rate actuation without current or yaw lag. The supplied combined-MPC run commands near the ±40°/s yaw limit in 66% of steps. Reusing the solver improves computation; it does not remove this model mismatch.
MPC uses finite soft penalties. APF can still encounter local minima, and geometric RRT* does not model vessel dynamics during tree search. In the supplied local-RRT* rate check, reducing replanning from 5 Hz to 1 Hz lowers closest approach from 2.18 m to 0.98 m.
The new sweep varies current and seed on one obstacle layout. New layouts, sensor outages, continuous collision checking and an actual-position completion criterion remain useful next tests. MPC still has CPU-time limits, so reproduction on this machine does not imply universal determinism.
The vessel’s track oscillates around the route while the short predicted trajectory and yaw command change at each step. The run finishes at 37.4 simulation seconds. Inspect individual commands in the replay.
The plant is a planar point vessel with simplified current and yaw response. It omits sway, waves, wind, sensor delays and actuator allocation. Marine collision regulations, an independently validated safety layer and physical-vessel deployment are outside the evaluated scope.
07 / Evidence & reproducibility
The October 22 materials reran the old and updated algorithm revisions in the same Docker image. The October 25 review checked the source, reran all seven current profiles and the EKF comparison, and passed all 64 Python tests. Timing and the full current/repair sweeps are supplied measurements, audited from their collectors and data.
Algorithm revision: 3d493e4. Reviewed repository: 01cfadceebcf; later commits add documentation and materials tooling. The October 4 collection remains available as historical evidence.
Independent project, algorithm implementation, tooling and experiments: Jerry Chang. Numerical computation uses NumPy; nonlinear optimization uses CasADi and IPOPT. Figures are generated from the supplied measurements and native telemetry. All displayed footage comes from the implemented project’s simulation and viewer.
Classical Navigation / Independent engineering