Skip to content

Generator: creates CGenericPointsMap by default; add sanity checks in most filters#53

Merged
jlblancoc merged 11 commits intodevelopfrom
generator-generic-cloud
Apr 9, 2026
Merged

Generator: creates CGenericPointsMap by default; add sanity checks in most filters#53
jlblancoc merged 11 commits intodevelopfrom
generator-generic-cloud

Conversation

@jlblancoc
Copy link
Copy Markdown
Member

@jlblancoc jlblancoc commented Apr 9, 2026

Summary by CodeRabbit

  • New Features

    • Generator gains options to choose the output point‑cloud class and to discard invalid zero-valued points; demo pipelines enable this filtering.
  • Documentation

    • Clarified required input point‑cloud type for timestamps and updated the documented minimum MRPT version.
  • Chores

    • Removed legacy version-dependent branches, added runtime field-padding warnings and point-cloud sanity checks, and simplified insertion workflows.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removed MRPT-version conditional branches and standardized point-field access/insertion across filters; added pointcloud field utilities and sanity checks; introduced Generator parameters default_pointcloud_class and filterOutPointsAtZero; updated demo configs and bumped MRPT minimum to 2.15.4. Documentation comments refined for deskew input type.

Changes

Cohort / File(s) Summary
Generator API & behavior
mp2p_icp_filters/include/mp2p_icp_filters/Generator.h, mp2p_icp_filters/src/Generator.cpp
Added Generator::Parameters::default_pointcloud_class (string) and filterOutPointsAtZero (bool); YAML loader reads them; output-layer creation may instantiate default_pointcloud_class or fall back to input runtime class; insertion honors filterOutPointsAtZero.
Point-field utils & sanity checks (new API)
mp2p_icp_map/include/.../pointcloud_field_utils.h, mp2p_icp_map/src/pointcloud_field_utils.cpp, mp2p_icp_map/CMakeLists.txt
Added mp2p_icp::warn_on_field_padding_mismatch(...) and built/installed public header; CMake updated to add new source and public header.
Unified insertion & padding/sanity checks across filters
mp2p_icp_filters/src/.../FilterDecimate.cpp, FilterDecimateVoxels.cpp, FilterDecimateAdaptive.cpp, FilterByRange.cpp, FilterByIntensity.cpp, FilterBoundingBox.cpp, FilterByRing.cpp, FilterCurvature.cpp, FilterFartherPointSampling.cpp, FilterPoleDetector.cpp, FilterRemoveByVoxelOccupancy.cpp, FilterSOR.cpp, FilterVoxelSOR.cpp, FilterMLS.cpp, FilterVoxelSOR.cpp, FilterAdjustTimestamps.cpp
Removed MRPT-version preprocessor branches; standardized on mrpt::maps::CPointsMap::InsertCtx-based workflow and modern getPointsBufferRef_*_field accessors; added warn_on_field_padding_mismatch calls after prepareForInsertPointsFrom and pointcloud_sanity_check assertions where applicable.
Deskew docs & implementation cleanup
mp2p_icp_filters/include/mp2p_icp_filters/FilterDeskew.h, mp2p_icp_filters/src/FilterDeskew.cpp
Documentation updated to require mrpt::maps::CGenericPointsMap for timestamps; removed legacy MRPT map includes and version guard; added padding-warn usage.
Demos / pipeline configs
multiple demos/*sm2mm*/*.yaml files
Enabled filterOutPointsAtZero: true (mp2p_icp_filters::Generator) across several demo pipelines to drop zero-valued points from organized LiDAR scans.
Apps & tooling
apps/txt2mm/main.cpp
Removed MRPT-version conditional includes and branches; unified on mrpt::maps::CGenericPointsMap and float RGB fields for xyzrgb formats.
Sanity-check core
mp2p_icp_map/src/pointcloud_sanity_check.cpp
Removed legacy MRPT-version branches and simplified field-length consistency checks to use unified field accessors across MRPT versions.
Build & docs bump
CMakeLists.txt, agents.md
Bumped required MRPT version from 2.15.0 → 2.15.4 in build and documentation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇
I hop through clouds both near and far,
Toss zero points out of my jar.
Generic maps keep fields in line,
Warnings whisper when paddings misalign.
Hooray — the pipeline hops just fine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main changes: introducing CGenericPointsMap as the default point cloud type in Generator and adding sanity checks across multiple filters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch generator-generic-cloud

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
mp2p_icp_map/src/pointcloud_sanity_check.cpp (1)

46-48: ⚠️ Potential issue | 🟠 Major

Either keep the compatibility branch or raise the minimum MRPT version to 2.15.4.

The API getPointsBufferRef_uint16_field() was introduced in MRPT 2.15.4. Your repository declares minimum MRPT 2.15.0 in CMakeLists.txt, which means lines 46–48 will fail to compile on MRPT 2.15.0–2.15.3. Since FilterByRing.cpp still maintains the compatibility branch, remove the hard-coded call and restore the version check, or explicitly raise the minimum required MRPT version to 2.15.4.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mp2p_icp_map/src/pointcloud_sanity_check.cpp` around lines 46 - 48, The loop
currently calls getPointsBufferRef_uint16_field() which only exists in MRPT >=
2.15.4 while the project still declares MRPT 2.15.0; either restore the
compatibility branch used in FilterByRing.cpp around
getPointsBufferRef_uint16_field() so you call the older API when MRPT < 2.15.4
(guard by the same MRPT_VERSION check used in FilterByRing.cpp and iterate
getPointFieldNames_uint16()/the older buffer accessor), or update the minimum
MRPT version in CMakeLists.txt to 2.15.4 so getPointsBufferRef_uint16_field()
can be used unconditionally (adjust any related
target_compile_definitions/version checks accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@mp2p_icp_filters/include/mp2p_icp_filters/FilterDeskew.h`:
- Around line 64-65: The header comment in FilterDeskew.h incorrectly mandates
mrpt::maps::CGenericPointsMap; change the doc to state the input layer must
provide a mrpt::maps::CPointsMap (or any points-map type) that exposes a float
timestamp field named "t" instead of naming a concrete class; update the
relevant sentence(s) near the class/struct comment for FilterDeskew so it
matches the actual requirement enforced in FilterDeskew.cpp and mentions the
required 't' field and its float type.

In `@mp2p_icp_filters/src/Generator.cpp`:
- Around line 354-359: The current assertion checks obj instead of the dynamic
cast result, so if the factory returns an object not derived from
mrpt::maps::CPointsMap the code silently leaves outPc null; change the assertion
to validate outPc (the result of std::dynamic_pointer_cast) and emit the failure
message using params.default_pointcloud_class so it clearly reports that the
created object is not derived from CPointsMap (i.e., replace the ASSERTMSG_
check on obj with one on outPc and keep the same formatted message referencing
params.default_pointcloud_class and CPointsMap).

---

Outside diff comments:
In `@mp2p_icp_map/src/pointcloud_sanity_check.cpp`:
- Around line 46-48: The loop currently calls getPointsBufferRef_uint16_field()
which only exists in MRPT >= 2.15.4 while the project still declares MRPT
2.15.0; either restore the compatibility branch used in FilterByRing.cpp around
getPointsBufferRef_uint16_field() so you call the older API when MRPT < 2.15.4
(guard by the same MRPT_VERSION check used in FilterByRing.cpp and iterate
getPointFieldNames_uint16()/the older buffer accessor), or update the minimum
MRPT version in CMakeLists.txt to 2.15.4 so getPointsBufferRef_uint16_field()
can be used unconditionally (adjust any related
target_compile_definitions/version checks accordingly).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7c266aa-7000-49c8-8972-4f44494952aa

📥 Commits

Reviewing files that changed from the base of the PR and between 63cc0fd and bd98aa0.

📒 Files selected for processing (6)
  • mp2p_icp_filters/include/mp2p_icp_filters/FilterDeskew.h
  • mp2p_icp_filters/include/mp2p_icp_filters/Generator.h
  • mp2p_icp_filters/src/FilterDecimateVoxels.cpp
  • mp2p_icp_filters/src/FilterDeskew.cpp
  • mp2p_icp_filters/src/Generator.cpp
  • mp2p_icp_map/src/pointcloud_sanity_check.cpp
💤 Files with no reviewable changes (2)
  • mp2p_icp_filters/src/FilterDeskew.cpp
  • mp2p_icp_filters/src/FilterDecimateVoxels.cpp

Comment thread mp2p_icp_filters/include/mp2p_icp_filters/FilterDeskew.h
Comment thread mp2p_icp_filters/src/Generator.cpp Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
demos/sm2mm_pointcloud_voxelize_no_deskew.yaml (1)

7-8: ⚠️ Potential issue | 🟡 Minor

Update stale pipeline description comments to match the new generator block.

Line 7 and Line 8 still say generators are empty/default, but Lines 16-19 now define an explicit generator with filterOutPointsAtZero. Please align the header comments with current behavior.

✏️ Suggested doc fix
-#  - Generators: empty, so the default generator is used (everything in one
-#                layer named 'raw' with all points).
+#  - Generators: explicit default `mp2p_icp_filters::Generator`, configured to
+#                keep points in 'raw' while discarding (0,0,0) organized-scan points.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@demos/sm2mm_pointcloud_voxelize_no_deskew.yaml` around lines 7 - 8, Update
the stale header comment that says "Generators: empty, so the default generator
is used" to reflect the explicit generator block now present (the generator that
sets filterOutPointsAtZero) — locate the YAML header comment near the top of
demos/sm2mm_pointcloud_voxelize_no_deskew.yaml and reword it to describe that an
explicit generator is defined with filterOutPointsAtZero (and any other
generator settings present) so the comment matches the actual generator
configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@demos/sm2mm_no_decim_imu.yaml`:
- Around line 16-19: Update the outdated intro comments to reflect that this
demo now includes an explicit generator configuration (generators: - class_name:
mp2p_icp_filters::Generator with params.filterOutPointsAtZero: true) instead of
saying “generators are empty/default”; edit the top-of-file description to
mention that a mp2p_icp_filters::Generator is configured and that invalid/zero
points are filtered via filterOutPointsAtZero.

In `@demos/sm2mm_pointcloud_voxelize.yaml`:
- Around line 16-19: Update the top-of-file header comment to reflect that an
explicit generator is now configured (mp2p_icp_filters::Generator with
params.filterOutPointsAtZero=true) instead of saying generators are
empty/default; locate the YAML header comment and change its text to mention the
configured generator and the purpose of filterOutPointsAtZero (removes invalid
points in organized LiDAR scans) so the header and the generator block are
consistent.

---

Outside diff comments:
In `@demos/sm2mm_pointcloud_voxelize_no_deskew.yaml`:
- Around line 7-8: Update the stale header comment that says "Generators: empty,
so the default generator is used" to reflect the explicit generator block now
present (the generator that sets filterOutPointsAtZero) — locate the YAML header
comment near the top of demos/sm2mm_pointcloud_voxelize_no_deskew.yaml and
reword it to describe that an explicit generator is defined with
filterOutPointsAtZero (and any other generator settings present) so the comment
matches the actual generator configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a89db044-6105-427d-a19d-f89ae23432d6

📥 Commits

Reviewing files that changed from the base of the PR and between bd98aa0 and e0dd101.

📒 Files selected for processing (11)
  • demos/sm2mm_bonxai_voxelmap.yaml
  • demos/sm2mm_bonxai_voxelmap_gridmap.yaml
  • demos/sm2mm_bonxai_voxelmap_gridmap_no_deskew.yaml
  • demos/sm2mm_no_decim_imu.yaml
  • demos/sm2mm_no_decim_imu_mls.yaml
  • demos/sm2mm_no_decim_imu_mls_keyframe_map.yaml
  • demos/sm2mm_pointcloud_voxelize.yaml
  • demos/sm2mm_pointcloud_voxelize_no_deskew.yaml
  • demos/sm2mm_voxels_static_dynamic_points.yaml
  • mp2p_icp_filters/include/mp2p_icp_filters/Generator.h
  • mp2p_icp_filters/src/Generator.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • mp2p_icp_filters/include/mp2p_icp_filters/Generator.h
  • mp2p_icp_filters/src/Generator.cpp

Comment thread demos/sm2mm_no_decim_imu.yaml
Comment thread demos/sm2mm_pointcloud_voxelize.yaml
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 82.43243% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.63%. Comparing base (63cc0fd) to head (a6abccb).
⚠️ Report is 12 commits behind head on develop.

Files with missing lines Patch % Lines
mp2p_icp_map/src/pointcloud_field_utils.cpp 81.25% 6 Missing ⚠️
mp2p_icp_filters/src/FilterDeskew.cpp 40.00% 3 Missing ⚠️
...p_icp_filters/src/FilterRemoveByVoxelOccupancy.cpp 0.00% 2 Missing ⚠️
mp2p_icp_filters/src/Generator.cpp 80.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #53      +/-   ##
===========================================
+ Coverage    78.60%   78.63%   +0.02%     
===========================================
  Files          190      191       +1     
  Lines        10572    10632      +60     
  Branches       977      982       +5     
===========================================
+ Hits          8310     8360      +50     
- Misses        2262     2272      +10     
Files with missing lines Coverage Δ
...cp_filters/include/mp2p_icp_filters/FilterDeskew.h 100.00% <ø> (ø)
...p_icp_filters/include/mp2p_icp_filters/Generator.h 0.00% <ø> (ø)
mp2p_icp_filters/src/FilterAdjustTimestamps.cpp 68.85% <ø> (ø)
mp2p_icp_filters/src/FilterBoundingBox.cpp 98.03% <100.00%> (+0.08%) ⬆️
mp2p_icp_filters/src/FilterByIntensity.cpp 100.00% <ø> (ø)
mp2p_icp_filters/src/FilterByRange.cpp 87.67% <100.00%> (+1.51%) ⬆️
mp2p_icp_filters/src/FilterByRing.cpp 98.48% <100.00%> (ø)
mp2p_icp_filters/src/FilterCurvature.cpp 1.78% <ø> (ø)
mp2p_icp_filters/src/FilterDecimate.cpp 96.87% <100.00%> (+0.10%) ⬆️
mp2p_icp_filters/src/FilterDecimateAdaptive.cpp 91.11% <100.00%> (+0.09%) ⬆️
... and 12 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
demos/sm2mm_pointcloud_voxelize.yaml (1)

7-7: ⚠️ Potential issue | 🟡 Minor

Header comment is stale and contradicts the active generator config.

Line 7 says the default generator is used, but Lines 15–18 define an explicit mp2p_icp_filters::Generator with filterOutPointsAtZero: true.

📝 Suggested fix
-#  - Generators: default generator is used (creates an 'raw' layer).
+#  - Generators: explicit Generator for layer 'raw', with
+#                filterOutPointsAtZero=true to drop invalid (0,0,0) points.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@demos/sm2mm_pointcloud_voxelize.yaml` at line 7, The header comment on Line 7
is stale because an explicit generator (mp2p_icp_filters::Generator) is
configured further down with filterOutPointsAtZero: true; update or remove the
header line that claims the "default generator is used" so it accurately
reflects that an explicit mp2p_icp_filters::Generator is active (or change the
YAML to actually rely on the default generator if that was intended).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@demos/sm2mm_pointcloud_voxelize.yaml`:
- Line 7: The header comment on Line 7 is stale because an explicit generator
(mp2p_icp_filters::Generator) is configured further down with
filterOutPointsAtZero: true; update or remove the header line that claims the
"default generator is used" so it accurately reflects that an explicit
mp2p_icp_filters::Generator is active (or change the YAML to actually rely on
the default generator if that was intended).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00aaf682-a2db-49f8-b9fa-9ccb6a752adb

📥 Commits

Reviewing files that changed from the base of the PR and between e0dd101 and 74c5bc0.

📒 Files selected for processing (20)
  • CMakeLists.txt
  • agents.md
  • apps/txt2mm/main.cpp
  • demos/sm2mm_no_decim_imu.yaml
  • demos/sm2mm_no_decim_imu_mls.yaml
  • demos/sm2mm_pointcloud_voxelize.yaml
  • demos/sm2mm_pointcloud_voxelize_no_deskew.yaml
  • mp2p_icp_filters/src/FilterAdjustTimestamps.cpp
  • mp2p_icp_filters/src/FilterBoundingBox.cpp
  • mp2p_icp_filters/src/FilterByIntensity.cpp
  • mp2p_icp_filters/src/FilterByRange.cpp
  • mp2p_icp_filters/src/FilterByRing.cpp
  • mp2p_icp_filters/src/FilterCurvature.cpp
  • mp2p_icp_filters/src/FilterDecimateVoxels.cpp
  • mp2p_icp_filters/src/FilterDeskew.cpp
  • mp2p_icp_filters/src/FilterFartherPointSampling.cpp
  • mp2p_icp_filters/src/FilterPoleDetector.cpp
  • mp2p_icp_filters/src/FilterRemoveByVoxelOccupancy.cpp
  • mp2p_icp_filters/src/FilterSOR.cpp
  • mp2p_icp_filters/src/Generator.cpp
💤 Files with no reviewable changes (6)
  • mp2p_icp_filters/src/FilterAdjustTimestamps.cpp
  • mp2p_icp_filters/src/FilterDeskew.cpp
  • mp2p_icp_filters/src/FilterFartherPointSampling.cpp
  • mp2p_icp_filters/src/FilterCurvature.cpp
  • mp2p_icp_filters/src/FilterSOR.cpp
  • mp2p_icp_filters/src/FilterByIntensity.cpp
✅ Files skipped from review due to trivial changes (3)
  • agents.md
  • CMakeLists.txt
  • demos/sm2mm_no_decim_imu_mls.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • demos/sm2mm_no_decim_imu.yaml
  • demos/sm2mm_pointcloud_voxelize_no_deskew.yaml
  • mp2p_icp_filters/src/FilterDecimateVoxels.cpp

@jlblancoc jlblancoc force-pushed the generator-generic-cloud branch from cb21bdd to 59fd8ed Compare April 9, 2026 10:46
@jlblancoc jlblancoc force-pushed the generator-generic-cloud branch from 59fd8ed to d48ceab Compare April 9, 2026 10:47
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
mp2p_icp_map/src/pointcloud_field_utils.cpp (1)

37-39: Rename loop variable typo for readability.

mame at Line 37 looks accidental; renaming to name improves clarity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mp2p_icp_map/src/pointcloud_field_utils.cpp` around lines 37 - 39, The loop
variable `mame` in the range-for over `dst_names_org` is a typo and hurts
readability; update the loop in pointcloud_field_utils.cpp to use a descriptive
variable name (e.g., `name`) so the loop becomes `for (const auto& name :
dst_names_org)` and adjust the `dst_names.emplace_back` call to use `name`
accordingly.
mp2p_icp_filters/src/FilterDecimateVoxels.cpp (1)

176-176: Apply field-padding mismatch warnings in all InsertCtx initialization paths.

Line 176 adds the warning in the bypass branch, but the regular voxel paths (Line 256/257, Line 271/272, Line 308/309) still initialize insertion contexts without the same warning. That leaves common mixed-field insertions silent.

Suggested patch
@@
                     auto& ctx = ctxs[pc];
                     if (!ctx.xs_src)
                     {
                         outPc->registerPointFieldsFrom(*pc);
                         ctx = outPc->prepareForInsertPointsFrom(*pc);
+                        mp2p_icp::warn_on_field_padding_mismatch(*pc, *outPc, *this);
                     }
@@
                     auto& ctx = ctxs[pc];
                     if (!ctx.xs_src)
                     {
                         outPc->registerPointFieldsFrom(*pc);
                         ctx = outPc->prepareForInsertPointsFrom(*pc);
+                        mp2p_icp::warn_on_field_padding_mismatch(*pc, *outPc, *this);
                     }
@@
         outPc->registerPointFieldsFrom(pc);
         auto ctx = outPc->prepareForInsertPointsFrom(pc);
+        mp2p_icp::warn_on_field_padding_mismatch(pc, *outPc, *this);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mp2p_icp_filters/src/FilterDecimateVoxels.cpp` at line 176, The field-padding
mismatch warning call mp2p_icp::warn_on_field_padding_mismatch(*pcPtrs[mapIdx],
*outPc, *this) is only applied in the bypass branch; add the same call
immediately before every other InsertCtx initialization so mixed-field
insertions are warned. Locate every place InsertCtx is constructed in this file
(the regular voxel insertion paths) and insert the
warn_on_field_padding_mismatch(...) invocation with the same arguments
(*pcPtrs[mapIdx], *outPc, *this) just prior to creating the InsertCtx object
(the same relative spot where it’s present in the bypass branch). Ensure the
call precedes the InsertCtx constructor in each path so the warning runs for all
insertion flows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@mp2p_icp_filters/src/FilterMLS.cpp`:
- Around line 619-632: The output layer reuse problem happens because existing
normal_x/normal_y/normal_z fields remain in outPc before calling
outPc->prepareForInsertPointsFrom(), so insertPointFrom() snapshots and
zero-pads them and later push_back() desynchronizes buffers; in FilterMLS,
detect if the destination point layer (from GetOrCreatePointLayer()) already
contains any "normal_x"/"normal_y"/"normal_z" fields and either remove/clear
those fields from outPc before calling prepareForInsertPointsFrom(), or
alternatively create a fresh layer when normals exist; ensure the check
references outPc, prepareForInsertPointsFrom(), registerField_float("normal_x")
and the push_back()/insertPointFrom() code paths and that firstIdx is computed
after clearing or recreating the layer so normals are not present in the
snapshot.

In `@mp2p_icp_map/include/mp2p_icp/pointcloud_field_utils.h`:
- Around line 32-52: warn_on_field_padding_mismatch currently treats an empty
source as missing fields and emits WARNs; update the function implementation in
pointcloud_field_utils.cpp to early-return false when the source cloud is empty
(e.g., check src.empty() or equivalent) before performing any field comparison
or logging so callers that skip insertion on empty input don't get spurious
warnings.

---

Nitpick comments:
In `@mp2p_icp_filters/src/FilterDecimateVoxels.cpp`:
- Line 176: The field-padding mismatch warning call
mp2p_icp::warn_on_field_padding_mismatch(*pcPtrs[mapIdx], *outPc, *this) is only
applied in the bypass branch; add the same call immediately before every other
InsertCtx initialization so mixed-field insertions are warned. Locate every
place InsertCtx is constructed in this file (the regular voxel insertion paths)
and insert the warn_on_field_padding_mismatch(...) invocation with the same
arguments (*pcPtrs[mapIdx], *outPc, *this) just prior to creating the InsertCtx
object (the same relative spot where it’s present in the bypass branch). Ensure
the call precedes the InsertCtx constructor in each path so the warning runs for
all insertion flows.

In `@mp2p_icp_map/src/pointcloud_field_utils.cpp`:
- Around line 37-39: The loop variable `mame` in the range-for over
`dst_names_org` is a typo and hurts readability; update the loop in
pointcloud_field_utils.cpp to use a descriptive variable name (e.g., `name`) so
the loop becomes `for (const auto& name : dst_names_org)` and adjust the
`dst_names.emplace_back` call to use `name` accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3562cd18-6943-4e5b-ad9a-f052a4716483

📥 Commits

Reviewing files that changed from the base of the PR and between 8acbc10 and bf7ac18.

📒 Files selected for processing (12)
  • mp2p_icp_filters/src/FilterBoundingBox.cpp
  • mp2p_icp_filters/src/FilterByRange.cpp
  • mp2p_icp_filters/src/FilterDecimate.cpp
  • mp2p_icp_filters/src/FilterDecimateAdaptive.cpp
  • mp2p_icp_filters/src/FilterDecimateVoxels.cpp
  • mp2p_icp_filters/src/FilterDeskew.cpp
  • mp2p_icp_filters/src/FilterMLS.cpp
  • mp2p_icp_filters/src/FilterSOR.cpp
  • mp2p_icp_filters/src/FilterVoxelSOR.cpp
  • mp2p_icp_map/CMakeLists.txt
  • mp2p_icp_map/include/mp2p_icp/pointcloud_field_utils.h
  • mp2p_icp_map/src/pointcloud_field_utils.cpp
✅ Files skipped from review due to trivial changes (2)
  • mp2p_icp_map/CMakeLists.txt
  • mp2p_icp_filters/src/FilterByRange.cpp

Comment thread mp2p_icp_filters/src/FilterMLS.cpp
Comment on lines +32 to +52
/** Checks whether copying points from \a src into \a dst via
* CPointsMap::prepareForInsertPointsFrom() + insertPointFrom() would result
* in any destination field being zero-padded (i.e. the field exists in \a dst
* but is absent in \a src).
*
* This situation is benign on MRPT < 2.15.13 (those fields were simply
* skipped, which caused sanity-check crashes), and is
* handled correctly from MRPT 2.15.13 onwards by writing explicit zeros.
* However, silent zero-padding may still indicate a configuration problem,
* or sensor drops.
*
* One WARN-level message is emitted per mismatched field name.
*
* \param src Source point cloud (the one being inserted FROM).
* \param dst Destination point cloud (the one being inserted INTO).
* \param logger Logger used for WARN messages.
* \return True if at least one mismatch was found.
*/
bool warn_on_field_padding_mismatch(
const mrpt::maps::CPointsMap& src, const mrpt::maps::CPointsMap& dst,
const mrpt::system::COutputLogger& logger);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Skip warnings when the source cloud is empty.

The implementation currently treats an empty source buffer as “field absent”, so callers that return early on empty input can emit WARNs even though no insertPointFrom() will run. A fast if (src.empty()) return false; in pointcloud_field_utils.cpp would avoid noisy false positives here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mp2p_icp_map/include/mp2p_icp/pointcloud_field_utils.h` around lines 32 - 52,
warn_on_field_padding_mismatch currently treats an empty source as missing
fields and emits WARNs; update the function implementation in
pointcloud_field_utils.cpp to early-return false when the source cloud is empty
(e.g., check src.empty() or equivalent) before performing any field comparison
or logging so callers that skip insertion on empty input don't get spurious
warnings.

@jlblancoc jlblancoc changed the title Generator generic cloud Generator: creates CGenericPointsMap by default; add sanity checks in most filters Apr 9, 2026
@jlblancoc jlblancoc merged commit c34c869 into develop Apr 9, 2026
15 checks passed
@jlblancoc jlblancoc deleted the generator-generic-cloud branch April 9, 2026 14:13
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