Skip to content

refactor(ndt_scan_matcher): make scan matching diagnostics ROS-free - #1552

Merged
Motsu-san merged 18 commits into
autowarefoundation:mainfrom
sasakisasaki:ndt-core/1-diagnostics-as-plain-data
Nov 20, 2026
Merged

Motsu-san merged 18 commits into
autowarefoundation:mainfrom
sasakisasaki:ndt-core/1-diagnostics-as-plain-data

Conversation

@sasakisasaki

@sasakisasaki sasakisasaki commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

⚠️ As this PR's contents are mostly generated by Claude Code, I'll review the changes carefully to ensure this PR aligns with the intended refactoring goals and do not introduce unintended side effects. I'll mark this PR as "Ready for Review" after my review. ⚠️

=> Yes, now self-review is done!!! 👍 Ready for review!!! 💪

Builds the scan matching diagnostics as plain data, without ROS, so that the core logic extracted in later PRs can return them.

  • DiagnosticsReport moves out of map_update_module.hpp into its own header, diagnostics_report.hpp.

Detail is here

Click to open
  • ScanMatchDiagnostics (new, ROS-free) turns the values observed while matching one scan (ScanMatchDiagnosticValues) into the scan matching part of scan_matching_status. The convergence verdicts (is_ok_*) are decided by the scan matching and only reported here, never recomputed.
  • The node fills ScanMatchDiagnosticValues and applies the returned report, instead of writing each key and message itself.
  • best_particle_score of the align service is added to the diagnostics where the align result is received, instead of inside align_pose(), so that the search itself writes no diagnostics.

Related links

Stack (each PR is based on the one before it):

I'll update the list of stack PRs status below, as I like to ensure the step, I'm going to create the PR after merging currently ongoing one.

  1. feat(localization_util): allow SmartPoseBuffer without a logger #1549
  2. This PR: diagnostics as plain data
  3. #TBD: ROS-free hyper parameters and node rename
  4. #TBD: fetch-only MapUpdateModule
  5. #TBD: NdtScanMatcher core
  6. #TBD: scan matching returns its outputs (5a)
  7. #TBD: scan matching in the core (5b)

How was this PR tested?

Ran the following command, I verified all the tests passed 👍

$ PACKAGE_NAME=autoware_ndt_scan_matcher \
    && colcon build --packages-up-to $PACKAGE_NAME --cmake-args -DCMAKE_BUILD_TYPE=Release \
    && colcon test --packages-select $PACKAGE_NAME --event-handlers console_cohesion+

What I want to emphasize

  • the new test_scan_match_diagnostics covers each check of ScanMatchDiagnostics (levels, messages, keys and their order);
  • the characterization tests passed.

Notes for reviewers

Diagnostics can trigger an MRM, so every key, value type, level and message is kept unchanged, including the order the keys are added in. The characterization tests check this.

Interface changes

None.

Effects on system behavior

Should be none: as the "Description" section says, this PR makes diagnostics output to be ROS-free. The output observed by user itself should be same as before.

(EDITED/ADDED) execution_time (in /diagnostics and the exe_time_ms topic) no longer includes formatting the scan matching diagnostics. That work now runs after the measurement ends, so the reported time is slightly shorter, most likely by a few microseconds (not measured), which is negligible against critical_upper_bound_exe_time_ms (100 ms). Diagnostics keys, levels and messages are unchanged.

sasakisasaki and others added 6 commits November 17, 2026 18:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…t into AAA tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…ching status

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…ScanMatchDiagnostics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…n result is received

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@github-actions

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@sasakisasaki sasakisasaki added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 18, 2026
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.39%. Comparing base (2c943e0) to head (da5beeb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1552      +/-   ##
==========================================
+ Coverage   71.71%   72.39%   +0.68%     
==========================================
  Files         515      501      -14     
  Lines       28700    27961     -739     
  Branches    13373    13166     -207     
==========================================
- Hits        20581    20243     -338     
- Misses       6929     7613     +684     
+ Partials     1190      105    -1085     
Flag Coverage Δ *Carryforward flag
daily-humble 82.14% <ø> (+<0.01%) ⬆️ Carriedforward from d820cd3
daily-jazzy 82.28% <ø> (+<0.01%) ⬆️ Carriedforward from d820cd3
differential-humble 76.50% <100.00%> (+20.80%) ⬆️
differential-jazzy 62.35% <100.00%> (+6.69%) ⬆️
total 50.34% <ø> (+<0.01%) ⬆️ Carriedforward from d820cd3
total-humble 82.21% <ø> (+<0.01%) ⬆️ Carriedforward from d820cd3
total-humble-agnocast 70.70% <ø> (+0.12%) ⬆️ Carriedforward from d820cd3
total-jazzy 82.28% <ø> (+<0.01%) ⬆️ Carriedforward from d820cd3
total-jazzy-agnocast 70.61% <ø> (+0.12%) ⬆️ Carriedforward from d820cd3

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…t_scan_match_diagnostics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>

@sasakisasaki sasakisasaki left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Self-review comment, ...

@@ -0,0 +1,67 @@
// Copyright 2026 Autoware Foundation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[For PR Reviewers] This application code moved from here

return false;
}

// check score diff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[For PR Reviewers] These codes moved to this header

@sasakisasaki sasakisasaki self-assigned this Nov 18, 2026
@sasakisasaki sasakisasaki added the component:localization Vehicle's position determination in its environment. (auto-assigned) label Nov 18, 2026
…m type is unknown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@sasakisasaki
sasakisasaki marked this pull request as ready for review November 18, 2026 12:36
@Motsu-san

Copy link
Copy Markdown
Contributor

I'm reviewing. Please give me a while.

@Motsu-san Motsu-san left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for your pull-request! The refactoring is scoped well. I also checked that it keeps the output the same: the key order, the value formatting, and the way levels and messages are combined.

I have 2 requests. Would you please consider the following suggestions for improvement?

… iteration injection

  * Apply the following review comment:
      - autowarefoundation#1552 (comment)

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
  * Apply the following review comment:
      - autowarefoundation#1552 (comment)

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
@sasakisasaki

Copy link
Copy Markdown
Contributor Author

@Motsu-san Thank you very much for your review!! Now I applied the corresponding fix, could you please review again? 🙏

pre-commit-ci Bot and others added 3 commits November 19, 2026 09:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
…akisasaki/autoware.core into ndt-core/1-diagnostics-as-plain-data

Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>

@Motsu-san Motsu-san left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTMeow

@Motsu-san
Motsu-san merged commit 15408eb into autowarefoundation:main Nov 20, 2026
44 of 46 checks passed
@xmfcx

xmfcx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@sasakisasaki @Motsu-san

I am very unhappy with how this PR was handled.

I opened my NDT backend stack on 9 November and shared it with you both. It does not change the behavior of the node, and it still waits for review. This PR opened on 18 November, changed the same files, and merged two days later. Neither this PR nor its review mentions my stack or the merge order.

As a result, these PRs of my stack now conflict with main:

I will rebase my stack on top of this PR and resolve the conflicts.

The next PRs of your stack will not merge before my stack:

Step PR What it does
2 #1558 (draft) Makes HyperParameters a plain struct without ROS. Renames the node class NDTScanMatcher to NdtScanMatcherNode and ndt_scan_matcher_core.cpp to ndt_scan_matcher_node.cpp.
3 Not open yet Makes MapUpdateModule fetch-only.
4 Not open yet Adds the NdtScanMatcher core class.
5a Not open yet Makes the scan matching return its outputs.
5b Not open yet Moves the scan matching into the core.

Step 2 already conflicts with my stack. Please rebase it on my stack after my stack merges:

@Motsu-san

Motsu-san commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

@xmfcx Thank you for explaining the situation, and I'm sorry this created extra work for you. I had no intention of making things harder for you.

To be honest about what happened on my side: I didn't realize that your NDT backend stack (#1524 / #1526 / #1534 / #1527) touched the same files, so I didn't consider the merge order when I reviewed and merged #1552. I see that I was requested as a code owner on #1527, but I didn't connect it with #1552 at the time.

For context, I do AWF reviews in whatever spare time I can find, one PR at a time. Refactoring PRs are usually quick to review, so I sometimes pick them up first. That is why #1552 moved quickly; it was not meant to jump ahead of your stack.

You mentioned that you shared the stack with us. Could you let me know where that was? I checked #1524 and #1527 but couldn't find it, and I'd like to make sure I don't miss it next time.

As requested, #1558 will wait until your stack is merged, and I will make sure it is rebased on top of it. Could you please ping us on #1558 when #1527 is merged, so we don't miss it? I just found out that it was merged a moment ago.

Thanks again for taking care of the rebase on your side.

@xmfcx

xmfcx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@motsu -san Thanks for caring 💖. Next time I will contact more directly. No worries. Thanks for the reviews and swift actions on your side!

Thanks again for taking time for maintaining efforts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:localization Vehicle's position determination in its environment. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants