Skip to content

Conversation

@Idate96
Copy link
Contributor

@Idate96 Idate96 commented Dec 1, 2025

Summary

  • Adds gridmap_utils module with centralized encode/decode functions for proper column-major (Fortran) layout handling
  • Refactors elevation_mapping_node.py to use the centralized utilities
  • Fixes masked_replace_tool.py to use Fortran order when flattening arrays
  • Removes flaky test_06 marker injection test (axis-swap regression already covered by 11 unit tests + 4 integration tests)

Test plan

  • test_gridmap_layout.py - 3 tests pass (roundtrip encode/decode)
  • test_map_shifting.py - 11 tests pass (axis-swap regression)
  • test_map_services.py - 2 tests pass
  • Integration tests 01-05 pass

Centralizes the logic for converting between numpy arrays and
Float32MultiArray messages with proper column-major (Fortran) order
handling as required by the GridMap specification.

- encode_layer_to_multiarray(): Converts (rows, cols) array to message
- decode_multiarray_to_rows_cols(): Converts message back to array
- Supports both gridmap_column and row_major layouts
- Includes unit tests for roundtrip conversion
Replace inline GridMap encoding/decoding logic with calls to the
centralized gridmap_utils module. This ensures consistent column-major
layout handling across the codebase.

- _numpy_to_multiarray() now delegates to encode_layer_to_multiarray()
- _decode_gridmap_msg() now uses decode_multiarray_to_rows_cols()
- Removes duplicated layout dimension construction code
The GridMap specification requires column-major (Fortran) order when
flattening arrays. Changed flatten() to flatten(order="F") to match
the layout dimension labels (column_index, row_index).
The marker injection test was unreliable because it published
pointclouds without maintaining TF updates, causing the node to
drop messages due to stale transforms.

The axis-swap regression is already thoroughly covered by:
- 11 unit tests in test_map_shifting.py
- Integration tests 01-05 for TF → GridMap pipeline
@Idate96 Idate96 merged commit 8fcc574 into ros2 Dec 1, 2025
2 of 4 checks passed
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.

2 participants