Adopt shared marine_colormap library in camp render path (#141)#144
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts the shared
marine_colormaplibrary in camp's render path, replacing camp's internalColorMap. This is the migration deferred from #134, and the foundation for camp#142 (the colorbarwidget + range override).
Closes #141.
What changed
marine_colormapadded (package.xml+find_package), linked PRIVATE tocamp_map(colormap is now astd::stringname in headers — no marine_colormap type leaks).ColorMapconsumers migrated together (no mixed path):RasterGlRenderer, used byGggsTileLayer/SonarLiveCacheLayer/RasterLayer):ensureLut()now bakes the palette viamarine_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 ispreserved (NaN + finite-NoData discard, Nearest, per-band range) — marine_colormap's own GPU
shader /
responseis deliberately not used (identity TransferParams at bake; ADR-0008).GridMap):find_palette(name)->sample(t)→QColor(now carries alpha).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→qualitydefault is camp#142).
(legacy "Viridis"/"Turbo" still resolve); unknown → grayscale. Persistence still keyed via
settingsKey().src/camp_map/map/color_map.{h,cpp}.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 camp→ 141 tests, 0 failures, 1 skipped (host-built; container can't build camp— missing underlays).
test_color_map.cpprewritten to cover all 6 palettes (opaque in-range, NaNtransparent via the render path, endpoints,
palette_names()round-trip, case-insensitive settingsfallback).
Review
/run-issue; 2 rounds of Deep pre-pushreview-code. Final: approved, 0 must-fix. (One earlierdispatch died on a transient before writing anything; re-ran cleanly.)
Follow-on
marine_colormap_widgetscolorbar widget + wire the range override;uncertainty band default =
quality+[0, threshold].Authored-By:
Claude Code AgentModel:
Claude Opus 4.8 (1M context)