How carlosmccosta/dynamic_robot_localization works
1. System boundary
- This repository is a ROS C++ package for point-cloud-based localization and mapping.
- Its core responsibility is to estimate and maintain robot/object pose from 3D sensor data, with optional dynamic map updates through OctoMap.
- The package is designed as a reusable point-cloud registration library as much as a ROS runtime node.
2. Primary runtime node
- The central executable is src/localization/localization_node.cpp, backed by the localization module.
- It consumes sensor clouds and an initial/reference map, runs the localization pipeline, and publishes pose estimates plus diagnostics.
- A separate pose_to_tf_publisher node converts the pose outputs into TF, keeping transform publication decoupled from localization compute time.
3. Input sources and map provisioning
- The system can take raw point clouds from RGB-D/ToF sensors or converted laser scans.
- The reference map can come from CAD/mesh/PCD files or from ROS topics such as sensor_msgs/PointCloud2 and nav_msgs/OccupancyGrid.
- This makes the boundary between “environment model” and “online sensor stream” explicit: one side is the reference cloud, the other is the current observation cloud.
4. Processing pipeline
- The architecture is a staged cloud-processing pipeline built from modular components:
- filters preprocess clouds,
- analyzers compute geometric/structural properties,
- matchers estimate alignment,
- validators decide whether the result is plausible,
- covariance estimators quantify uncertainty.
- The pipeline is configurable through YAML rather than hard-coded behavior, so the graph of stages is assembled by configuration.
5. Cloud filters subsystem
- cloud_filters contains the preprocessing and segmentation steps used before matching.
- It includes downsampling, cropping, outlier removal, plane segmentation, clustering, region growing, pass-through, HSV segmentation, and similar operations.
- These are likely the first major stage in the data flow, reducing noise and extracting the relevant subset of points before registration.
6. Cloud analysis and feature extraction
- cloud_analyzers, normal_estimators, curvature_estimators, and outlier_detectors provide intermediate geometric descriptors.
- These modules support later feature matching by computing normals, curvature, angular distributions, and outlier/quality metrics.
- They form a shared “feature preparation” layer used by both initial alignment and tracking.
7. Matching subsystem: initial alignment vs tracking
- cloud_matchers is split into two major families:
- feature matchers for initial pose estimation and recovery,
- point matchers for continuous tracking.
- Feature matching includes keypoint detectors and descriptors such as SIFT 3D, ISS3D, PFH, FPFH, SHOT, Spin Image, USC, and ESF, plus sample-consensus alignment variants.
- Point matching includes ICP variants and NDT variants, including 2D, 3D, generalized, non-linear, and normals-based forms.
8. Pose acceptance and robustness controls
- transformation_validators are a distinct gate before pose publication.
- They reject transformations that violate thresholds such as outlier percentage, inlier RMSE, angular distribution, or translation/rotation correction magnitude.
- convergence_estimators add stopping/quality logic, including time-aware convergence criteria.
9. Uncertainty and registration quality
- registration_covariance_estimators compute covariance for point-to-point and point-to-plane alignment, including variants with probabilistic models.
- This is the boundary where a best-effort pose estimate becomes a pose with quantified confidence.
- The covariance output is part of the published localization result and can influence downstream decision-making.
10. Dynamic map update and OctoMap integration
- The reference cloud is not fixed; it can be updated with full/inlier/outlier integration modes.
- OctoMap can be placed in the loop to perform probabilistic occupancy integration on dynamic scenes.
- This creates a feedback path: localization updates the map, and the updated map becomes the next localization reference.
11. ROS interfaces and control plane
- The package exposes ROS messages in msg/ for detailed localization state, diagnostics, and timing.
- ROS services in srv/ provide control operations such as starting/stopping sensor processing and reloading configuration.
- This separates the real-time estimation path from operational control and introspection.
12. Configuration and deployment model
- yaml/configs/ contains scenario-specific presets for 2D/3D, tracking, recovery, pose estimation, filtering, and covariance estimation.
- yaml/schema/drl_configs.yaml defines the configuration contract, which is important for understanding the runtime assembly of modules.
- Launch files wire together the main node, TF publisher, optional laser-cloud assembler, and optional OctoMap process.
13. Utility and offline tooling
- src/tools/mesh_to_pcd.cpp and scripts under tools/ support offline conversion of meshes/CAD models into point clouds.
- The docs emphasize uniform surface density, so the offline conversion pipeline is part of the architecture, not just a convenience.
- This preprocessing stage feeds the reference-map boundary and directly affects registration quality.
14. Implementation style and dependencies
- The code is organized as headers in include/ with implementation in src/, suggesting a reusable library plus ROS nodes.
- The primary external technologies that materially shape the architecture are ROS, PCL, TF, and OctoMap.
- Overall, the repository is a modular perception stack for cloud registration and localization, with configurable pipelines and a clear separation between preprocessing, matching, validation, and map maintenance.
Main entry points: localization.h Localization core · localization_node.cpp Localization node · cloud_matchers Cloud matchers · octo_map.launch OctoMap update
Components 20
Runtime
ROS nodes and the localization execution path
- Localization node · Main executable that runs localization from sensor clouds and a reference map.
src/localization/localization_node.cpp - Localization core · Reusable localization module that orchestrates the estimation pipeline.
include/dynamic_robot_localization/localization/localization.h - TF publisher · Converts estimated poses into TF transforms.
Pipeline
Cloud preprocessing, analysis, matching, and validation
- Cloud filters · Downsampling, cropping, segmentation, and outlier removal before registration.
include/dynamic_robot_localization/cloud_filters - Cloud analyzers · Computes structural descriptors used by downstream matching.
include/dynamic_robot_localization/cloud_analyzers - Normal estimators · Normal estimation backends used by feature preparation and point-to-plane methods.
include/dynamic_robot_localization/normal_estimators - Curvature estimators · Principal curvature extraction for geometric characterization.
include/dynamic_robot_localization/curvature_estimators - Outlier detectors · Detects noisy or inconsistent points for filtering and scoring.
include/dynamic_robot_localization/outlier_detectors - Cloud matchers · Registration layer split into feature-based initial alignment and point-based tracking.
include/dynamic_robot_localization/cloud_matchers - Feature matchers · Keypoint/descriptor registration and sample-consensus alignment for pose recovery.
include/dynamic_robot_localization/cloud_matchers/feature_matchers - Point matchers · ICP and NDT variants for continuous pose tracking.
include/dynamic_robot_localization/cloud_matchers/point_matchers - Pose validators · Rejects implausible transformations before publication.
include/dynamic_robot_localization/transformation_validators - Convergence · Convergence and timing-aware quality criteria for registration loops.
include/dynamic_robot_localization/convergence_estimators - Covariance estimators · Computes registration covariance and pose confidence.
include/dynamic_robot_localization/registration_covariance_estimators
Map & Update
Reference map provisioning and dynamic map maintenance
- Map inputs · Reference clouds from CAD, mesh, PCD, PointCloud2, or OccupancyGrid sources.
- OctoMap update · Probabilistic occupancy integration and dynamic reference map maintenance.
launch/octo_map.launch
Support
Configuration, ROS interfaces, and offline tooling
- ROS messages · Localization state, diagnostics, timings, and configuration messages.
msg - ROS services · Start/stop sensor processing and reload configuration.
srv - YAML configs · Scenario presets and schema that assemble the runtime pipeline.
yaml/schema/drl_configs.yaml - Mesh tools · Mesh-to-PCD conversion and surface preparation for reference maps.
src/tools/mesh_to_pcd.cpp
Connections 22
- Localization node → Localization core: runs · The main node delegates estimation to the reusable localization library.
- Localization node → ROS messages: publishes · Emits detailed localization state, diagnostics, and timing output.
- Localization node → ROS services: controlled by · Runtime processing can be started, stopped, or reconfigured via services.
- Localization core → Cloud filters: preprocesses · Incoming sensor and reference clouds are filtered before registration.
- Localization core → Cloud analyzers: analyzes · Extracts geometric descriptors and quality signals from clouds.
- Localization core → Normal estimators: estimates normals · Normal computation feeds feature extraction and point-to-plane matching.
- Localization core → Curvature estimators: extracts curvature · Curvature features support structural description and matching.
- Localization core → Outlier detectors: scores noise · Outlier detection supports cloud cleanup and registration quality.
- Localization core → Cloud matchers: registers · Performs pose estimation through registration matchers.
- Cloud matchers → Feature matchers: initial pose · Feature-based alignment is used for initialization and recovery.
- Cloud matchers → Point matchers: tracking pose · Point-based methods are used for continuous pose tracking.
- Localization core → Pose validators: checks pose · Candidate transforms are validated before acceptance.
- Pose validators → Convergence: uses · Convergence logic contributes to acceptance and stopping decisions.
- Localization core → Covariance estimators: estimates uncertainty · Registration covariance is computed alongside the pose estimate.
- Localization core → Map inputs: consumes · Localization operates against a reference map or environment model.
- Localization core → OctoMap update: updates · Dynamic scenes can feed back into probabilistic map maintenance.
- OctoMap update → Map inputs: refreshes · Updated occupancy information becomes the next reference context.
- Mesh tools → Map inputs: creates · Offline mesh conversion produces point-cloud maps for localization.
- YAML configs → Localization core: configures · YAML presets assemble filters, matchers, validators, and covariance modules.
- YAML configs → OctoMap update: configures · Launch and config files control optional map integration.
- ROS messages → TF publisher: feeds · Pose outputs are converted into TF by a separate node.
- Localization node → TF publisher: publishes pose · Pose estimates are the input to TF publication.