Skip to content

s57_layer: invalidate cached tide_offset when chart_datum disappears (datum_source=none) #26

Description

@rolker

Context

Follow-up surfaced during the pre-push review of rolker/mru_transform#25
(datum resolution chain off-VDatum).

s57_layer caches tide_offset_ and only updates it when a fresh
chart_datum → sea_surface lookup succeeds and differs by
tide_invalidate_threshold_. When the lookup throws (the chart_datum frame is
no longer broadcast / has expired from the TF buffer), it logs a throttled WARN
and keeps the last tide_offset_:

try {
  auto transform = tf_->lookupTransform(chart_datum_frame_, sea_surface_frame_, ...);
  ...
} catch (const tf2::TransformException& e) {
  // throttled WARN, tide_offset_ unchanged
}

Before #25, off-coverage simply meant chart_datum was never published, so
tide_offset_ would never have been set. After #25, chart_datum is published
in more places (VDatum, polygon config, lake_datum param) and can legitimately
disappear while underway when the boat moves into an area where nothing
matches (the node intentionally stops broadcasting chart_datum and publishes
datum_source == "none"). So the costmap can silently keep correcting against a
stale offset from a different region — a newly-reachable "stale data" path.

Proposal

Treat datum disappearance as a first-class transition:

  • Subscribe to the datum_source topic (std_msgs/String, latched) published by
    chart_datum_node. When it reports "none", clear/invalidate tide_offset_
    (and ideally invalidate the tide-corrected layer) rather than holding the last
    value.
  • Alternatively, treat a sustained lookup failure (frame absent beyond a timeout)
    as invalidation.

Acceptance

  • tide_offset_ is cleared/invalidated when the datum becomes unavailable
    (datum_source == "none" or sustained lookup failure)
  • No regression when the datum is continuously available

Related: rolker/mru_transform#25, rolker/mru_transform#27.


Authored-By: Claude Code Agent
Model: Claude Opus 4.8 (1M context)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions