← All projectsIndependent project · Simulation

State estimation · Motion planning · Feedback control

Classical
Navigation.

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

Algorithms become
interesting together.

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.

My role
Independent developer · algorithms, tooling & evaluation
Core tools
Python · NumPy · CasADi / IPOPT · Docker
Environment
Own planar vessel model · no ROS or external simulator
Evidence
Collected October 22 · verified October 25, 2026

02 / Stable boundaries

One loop.
Different choices.

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.

Explore the implemented algorithms

Estimate

The EKF tracks position, heading, speed and two current components. Heading innovations wrap around ±π; covariance uses the Joseph update.

Plan globally

A* and Dijkstra share an eight-connected grid. D* Lite repairs routes after occupancy changes. Geometric RRT* samples continuous space and rewires its tree.

Guide and avoid

Line-of-sight guidance advances a lookahead target. Local choices include artificial potential fields, short-horizon RRT*, and trajectory-generation MPC.

Control

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

Fix the assumptions
inside the loop.

01 / Estimation

Let the filter learn drift.

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.

02 / Incremental planning

Check repairs against Dijkstra.

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.

03 / Local recovery

Allow a way out.

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.

04 / Optimization

Build once. Update parameters.

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

Check the algorithm.
Then test the system.

The update is supported by regression tests, seven recorded profiles, and a current sweep repeated on the old and updated revisions.

Core suite64

Tests passed in a fresh Docker check

Static obstacle overlaps0/108

Updated sampled runs; previously 12/108

D* Lite repair checks0/668

Updated mismatches against Dijkstra

02 / Three profiles × nine currents × four seeds
03 / Estimate current from the same sensor types

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.

Computation: what became faster?

Reuse the MPC problem.

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.

Reduce RRT* overhead.

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.

Seven profiles, complete recordings.

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.

Seed 7 · verified October 25 · terminal replay time · minimum active-obstacle clearance
ProfileSim. timeMin. clearanceRecorded behavior
A* + APF + PID32.1 s2.045 m0 escape steps
Global RRT*30.8 s2.274 m0 escape steps
Local RRT*32.3 s2.183 m7 escape steps
D* Lite32.1 s2.183 m2 route repairs · 10 escape steps
Tracking MPC32.4 s2.108 m0 escape steps
Trajectory MPC*57.5 s2.225 m0 escape steps
Combined MPC37.4 s2.080 m19 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.

Completion still depends on the estimate

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

A repaired route.
A visible recovery.

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.

Read a description of the replay

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

A better loop.
Still a simplified model.

01

Estimation and prediction still differ.

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.

02

Recovery is not a clearance guarantee.

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.

03

Broaden the conditions next.

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.

Inspect combined MPC’s remaining oscillation

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.

An educational simulation

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

Keep the result
and its conditions.

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.

Credits

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

Understand the parts.
Inspect the whole.

Explore Navigation Lab Back to all projects