Skip to content

test: fix the tests on ROS 2 Lyrical - #552

Merged
wep21 merged 4 commits into
ANYbotics:rollingfrom
autowarefoundation:test/lyrical-tests
Nov 14, 2026
Merged

wep21 merged 4 commits into
ANYbotics:rollingfrom
autowarefoundation:test/lyrical-tests

Conversation

@xmfcx

@xmfcx xmfcx commented Nov 13, 2026 •

Copy link
Copy Markdown

What

This PR fixes the tests of grid_map_costmap_2d and grid_map_pcl on ROS 2 Lyrical. Four commits:

  1. Use the .hpp headers of tf2 and tf2_ros, and ament_index_cpp::get_package_share_path, in the tests.
  2. Update two grid_map_costmap_2d tests for Nav2 changes:
    • The expected costmap size is now the full map size.
    • Costmap2DROS gets its parameters as parameter overrides, not through set_parameter().
  3. Keep each test costmap in its own namespace, /<name>, as before.
  4. Remove a stale comment and an unused include.

The packages also need the build fixes, and the two PRs must merge together:

Why

  1. Lyrical removes tf2/transform_datatypes.h and deprecates the tf2_ros .h headers and ament_index_cpp::get_package_share_directory. The tests build with -Werror, so they do not compile.
  2. Nav2 changed two behaviors:
    • Costmap2D::getSizeInMetersX and getSizeInMetersY now return the full map size. The test expected half a cell less.
    • Costmap2DROS now declares most parameters in on_configure(), so set_parameter() before configure() throws: parameter 'plugins' cannot be set because it was not declared.
  3. Only the NodeOptions constructor of Costmap2DROS keeps the parameter overrides, and it uses the root namespace. Without the remap, all test costmaps share the topics /costmap and /footprint and the clear services.

The two Nav2 changes:

The converter code uses the cell count and the resolution, not getSizeInMeters, so the Nav2 change does not affect it. Jazzy and Kilted still use the old Nav2 size, so a backport of commit 2 to their branches needs the old expectation.

How it was tested

  • Lyrical on amd64, in a container, with the build fixes: colcon test gave 841 tests, 0 errors, 0 failures, 195 skipped. All skipped tests are cppcheck.
  • With only the header changes of commit 1, colcon test-result reported 12 failures in grid_map_costmap_2d.
  • CI in our fork, with the build fixes: https://github.com/autowarefoundation/grid_map/actions/runs/43460615289 passes on Lyrical and Rolling.
  • Not tested: arm64.

Lyrical removes tf2/transform_datatypes.h and deprecates tf2_ros/transform_broadcaster.h, tf2_ros/transform_listener.h and ament_index_cpp::get_package_share_directory. The tests build with -Werror, so the tests of grid_map_costmap_2d and grid_map_pcl no longer compile. Use the .hpp headers and get_package_share_path.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
Nav2 now returns the full map size from Costmap2D::getSizeInMetersX and getSizeInMetersY (ros-navigation/navigation2 PR 6028). The test expected half a cell less.

Costmap2DROS now declares most parameters in on_configure(), so set_parameter() before configure() throws. Pass the values as parameter overrides, through the constructor that keeps the NodeOptions.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
The NodeOptions constructor of Costmap2DROS uses the root namespace, so all test costmaps shared the topics /costmap and /footprint and the clear services. Remap the namespace to /<name>, as the name constructor did.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
The comment described the old set_parameter() setup. test_helpers.hpp does not use ament_index_cpp, and test_helpers.cpp includes it itself.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
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