Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pcd_map_validator): create tool for validating pcd maps #166

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Owen-Liuyuxuan
Copy link
Contributor

Description

Create tools for validation pcd maps.

This script provides comprehensive analysis tools for point cloud data, including:

  • Computing resolution (average point-to-point distance) using k-nearest neighbors
  • Visualizing point clouds with color-coded distances
  • Generating distance distribution histograms
  • Supporting both single PCD files and directories of PCD files

As background, Pilot-Auto has a PCD map requirement documentation. However, there is no standardized way or tools on how to perform quality check of the pcd maps. We relied on human eyes to check the quality of point cloud maps.

This script is the script created for an internal project. It provides key statistics for us to judge the point cloud maps from a bigger picture, and also it produces colorized point clouds for easier identifying point cloud errors with human eyes.

Please feel free to provide feedback on how to improve this tool.

Related links

Pilot-Auto PCD map requirement documentation

TIER IV INTERNAL TICKET LINK

TIER IV INTERNAL DISCUSSION LINK

Tests performed

I visualized multiple pointcloud maps.

My favourite command will be

ros2 run autoware_pointcloud_map_validator autoware_pointcloud_checker \
              ~/autoware_map/<name>/pointcloud_map.pcd/ --histogram [--cache] \

Notes for reviewers

Usage:
    ros2 run autoware_pointcloud_map_validator autoware_pointcloud_checker <input_file> [options]
    # or
    python pointcloud_check.py <input_file> [options]

Arguments:
    input_file          Path to a PCD file or directory containing PCD files

Options:
    --neighbors, -k     Number of nearest neighbors to consider (default: 3)
    --threshold        Distance threshold for visualization (default: 0.2)
    --cache           Enable caching of computed distances to file
    --output, -o      Output path for saving colored point cloud
    --histogram       Show histogram of point-to-point distances

Key Features:

- Automatic merging of multiple point clouds when processing a directory
- Color-coded visualization (blue for distances below threshold, yellow for above)
- Statistical analysis including min, max, median, and standard deviation
- Interactive 3D visualization
- Distance distribution histogram with statistical annotations
- Distance computation result caching support for large point clouds

Example Usage:
    # Analyze a single PCD file with visualization and statistic output
    ros2 run autoware_pointcloud_map_validator autoware_pointcloud_checker input.pcd --histogram

    # Process directory of PCD files with custom threshold
    ros2 run autoware_pointcloud_map_validator autoware_pointcloud_checker path/to/pcds/ --threshold 0.3

    # Save processed point cloud and cache results, re-run the command will directly utilize the cached results
    ros2 run autoware_pointcloud_map_validator autoware_pointcloud_checker input.pcd --output processed.pcd --cache

Interface changes

Effects on system behavior

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Copy link
Contributor

@SakodaShintaro SakodaShintaro left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request!

I will test this tool with approximately 30 PCD files.

First, I left a comment about the maintainer field in the package.xml file. Please check it.

Copy link
Contributor

@KeiNakazato KeiNakazato left a comment

Choose a reason for hiding this comment

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

Thank you for the update! I have added two comments for clarification. Could you please review them?

Tuple[float, np.ndarray]: Tuple containing:
- Average resolution (mean distance between points)
- Array of distances for each point

Copy link
Contributor

@KeiNakazato KeiNakazato Dec 4, 2024

Choose a reason for hiding this comment

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

There might be a disagreement between the commented out description and the actual behavior. The following "Note:" says that the function "compute_resolution" focuses on k-1 nearest neighbors (excluding the point itself), but the actual function looks counting k (= k +1 -1) nearest neighbors to me.

<maintainer email="[email protected]">Anh Nguyen</maintainer>
<maintainer email="[email protected]">Masahiro Sakamoto</maintainer>
<maintainer email="[email protected]">Taiki Yamada</maintainer>
<maintainer email="[email protected]">Yamato Ando</maintainer>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to add:
<maintainer email="[email protected]">Kei Nakazato</maintainer>

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

Successfully merging this pull request may close these issues.

3 participants