Skip to content

refactor: support generated occupancy values in existing grid algorithms - #4670

Closed
TomCC7 wants to merge 2 commits into
cc/feat/cdr-occupancy-corefrom
cc/feat/cdr-occupancy-operations
Closed

TomCC7 wants to merge 2 commits into
cc/feat/cdr-occupancy-corefrom
cc/feat/cdr-occupancy-operations

Conversation

@TomCC7

@TomCC7 TomCC7 commented Oct 20, 2026

Copy link
Copy Markdown
Member

Existing gradient, Voronoi, inflation, smoothing, overlay and offline rectangle/XML algorithms now accept generated OccupancyGrid values. Each returns the same kind of value it receives, so current legacy callers keep their behavior while generated consumers can migrate independently. Generated results copy the complete Header and MapMetaData, including a map-load timestamp distinct from the source timestamp.

Parent: #4669. Part of the message encoding refactor.

Files Change
Existing operations module Shared internal access/result construction, retaining the input's value type and independent generated metadata
Gradient, inflation, extrusion Use the shared accessors; existing numeric algorithms and XML conventions retained
One adjacent contract test Zero/negative/epoch source times, CDR round trips, metadata ownership, exact costs and existing/generated numerical equivalence
Workflow Installed-production provenance checks, focused generated cases and four strict production files

Run this against the proposal's installed main package:

import numpy as np
from dimos.messages.builtin_interfaces.msg import Time
from dimos.messages.std_msgs.msg import Header
from dimos.msgs.occupancy import occupancy_from_array, occupancy_view
from dimos.mapping.occupancy.gradient import gradient

grid = occupancy_from_array(
    np.array([[-1, 0, 0], [0, 100, 0], [0, 0, 0]], dtype=np.int8),
    resolution=0.25, header=Header(frame_id="map", stamp=Time(sec=0, nanosec=1)),
)
cost = gradient(grid, max_distance=0.5)
assert occupancy_view(cost)[0, 0] == -1
assert occupancy_view(cost)[0, 1] == 50
assert cost.header.stamp.nanosec == 1

From a prepared checkout, python -m pytest --noconftest -o addopts='' -q dimos/mapping/occupancy/test_generated_operations.py runs 21 cases without assets or hardware.

Validation: 68 source checks pass, including the unchanged pixel/XML golden regressions and retained historical pointcloud case; 61 installed-main-wheel checks pass with actual production modules asserted to come from site-packages (one source-data lookup case deselected). Seven existing project golden archives were fetched from LFS, each OID/hash/size verified and safely extracted. Four production files pass strict typing, applicable hooks pass, normal main wheel and default 198-package pip check pass. Wheel SHA256 7364348a02ce3a2455662f88ba55520e28d6bdba5e1c8084e3ed1249fb43b8ef.

Default mapping/navigation producers and runtime encoding are not switched in this layer; legacy class retirement follows verified consumer migration. XML scene generation was tested as text only; no simulator/hardware run, benchmark investigation or CI polling.

@TomCC7 TomCC7 closed this Oct 20, 2026
@TomCC7
TomCC7 deleted the cc/feat/cdr-occupancy-operations branch October 20, 2026 18:11
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.

1 participant