Skip to content

Adopt shared marine_colormap library in camp render path (#141)#144

Merged
rolker merged 13 commits into
jazzyfrom
feature/issue-141
Jun 29, 2026
Merged

Adopt shared marine_colormap library in camp render path (#141)#144
rolker merged 13 commits into
jazzyfrom
feature/issue-141

Conversation

@rolker

@rolker rolker commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Adopts the shared marine_colormap library in camp's render path, replacing camp's internal
ColorMap. This is the migration deferred from #134, and the foundation for camp#142 (the colorbar
widget + range override).

Closes #141.

What changed

  • Dependencymarine_colormap added (package.xml + find_package), linked PRIVATE to
    camp_map (colormap is now a std::string name in headers — no marine_colormap type leaks).
  • All ~7 ColorMap consumers migrated together (no mixed path):
    • GPU path (RasterGlRenderer, used by GggsTileLayer/SonarLiveCacheLayer/RasterLayer):
      ensureLut() now bakes the palette via marine_colormap::bake_lut(find_palette(name), TransferParams{}, 256) into the existing 256×1 LUT texture. The Unified source-agnostic RasterFieldSource render abstraction (Part A of #121) #134 shader contract is
      preserved
      (NaN + finite-NoData discard, Nearest, per-band range) — marine_colormap's own GPU
      shader / response is deliberately not used (identity TransferParams at bake; ADR-0008).
    • CPU path (GridMap): find_palette(name)->sample(t)QColor (now carries alpha).
  • Full registry exposed — colormap context menus are built from marine_colormap::palette_names()
    (grayscale / bronze / thermal / viridis / turbo / quality); operators gain the warning
    (quality) + thermal/bronze ramps immediately. Per-band defaults remain as-is (uncertainty→quality
    default is camp#142).
  • Settings migration — colormap stored as a name string; read with a case-insensitive fallback
    (legacy "Viridis"/"Turbo" still resolve); unknown → grayscale. Persistence still keyed via
    settingsKey().
  • Deleted camp's src/camp_map/map/color_map.{h,cpp}.
  • ADR-0008 (camp) records the bake-into-existing-LUT decision + the identity-TransferParams contract.

Visible consequence (intended)

camp's viridis/turbo shift to the canonical marine_colormap tables — camp's old ramps were sparse
7–8-stop approximations (e.g. viridis midpoint green differs by ~23/255). This is the point of adopting
the shared lib: one canonical colormap across rviz / rqt / camp. Grayscale is unchanged. The test
reflects this — grayscale near-exact; viridis/turbo characterized against the new canonical values
(not asserted equal to the old ramp).

Tests

./ui_ws/test.sh camp141 tests, 0 failures, 1 skipped (host-built; container can't build camp
— missing underlays). test_color_map.cpp rewritten to cover all 6 palettes (opaque in-range, NaN
transparent via the render path, endpoints, palette_names() round-trip, case-insensitive settings
fallback).

Review

/run-issue; 2 rounds of Deep pre-push review-code. Final: approved, 0 must-fix. (One earlier
dispatch died on a transient before writing anything; re-ran cleanly.)

Follow-on

  • camp#142 — embed the marine_colormap_widgets colorbar widget + wire the range override;
    uncertainty band default = quality + [0, threshold].

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

Claude Code Agent and others added 13 commits June 29, 2026 09:35
Replace camp-internal ColorMap with marine_colormap bake_lut() across all 7 consumers; expose full 6-palette registry; bake into existing LUT-texture path (ADR-0008).
Add <depend>marine_colormap</depend>, find_package, and link the target
PRIVATE to camp_map (no marine_colormap type is in camp_map's installed
headers — colormap becomes a std::string name) plus to camp_map_ros via
ament_target_dependencies for the GridMap/SonarLiveCacheLayer consumers.

Record camp ADR-0008: bake marine_colormap palettes into the existing
camp#134 256x1 GL LUT (identity TransferParams) rather than swapping in
marine_colormap's GPU shader; the canonical viridis/turbo colour shift is
accepted and intended.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the internal camp::map::ColorMap with marine_colormap across the
shared GPU render path. RasterGlRenderer::ensureLut() now bakes the selected
palette via bake_lut(find_palette(name), TransferParams{}, 256) into the
existing 256x1 RGBA LUT; the camp#134 shader contract (NaN + finite-NoData
discard, Nearest, per-band range) is preserved (identity TransferParams).

setColormap takes a std::string palette name; layers store and persist the
name. GggsTileLayer, SonarLiveCacheLayer and RasterLayer expose the FULL
marine_colormap registry (grayscale/bronze/thermal/viridis/turbo/quality)
in their Colormap menus via palette_names(), and read persisted names
case-insensitively (unknown -> grayscale). RasterLayer keeps viridis as its
scalar default. Test call sites updated to the name-based API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace camp::map::ColorMap in the GridMap CPU render path with a
marine_colormap palette resolved by name: colorNormalized(t) becomes
find_palette(name)->sample(t) quantized to a QColor (unknown name ->
grayscale). The layer stores/persists a std::string colormap_name_ (default
grayscale), exposes the full registry in its Colormap menu via
palette_names(), and reads persisted names case-insensitively. The worker
snapshot now carries the name by value under the same mutex as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ormap (#141)

Remove src/camp_map/map/color_map.{h,cpp} (now unused) from CAMP_MAP_SOURCES
and delete them. Replace test_color_map.cpp with a marine_colormap
characterization suite: grayscale asserted exact; viridis/turbo snapshot the
NEW canonical 256-entry tables (an intended colour change, not a comparison
to the retired sparse ramp); all six palettes opaque in-range; palette_names()
registry + name<->index round-trip; and the case-insensitive, grayscale-
fallback settings rule the layers apply. Link the test against
marine_colormap directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 29, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rolker
rolker merged commit 5e53389 into jazzy Jun 29, 2026
1 check failed
@rolker
rolker deleted the feature/issue-141 branch June 29, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt shared marine_colormap library in camp render path (deferred from #134)

2 participants