How molaorg/mola_lidar_odometry works
Project Type and Purpose
• This is a C++ robotics package providing a core LIDAR odometry library (mola_lidar_odometry), a command-line tool (mola-lidar-odometry-cli), and a ROS 2 node, all based on the MOLA/MRPT frameworks. It ingests either live ROS 2 LIDAR topics or offline datasets, computes odometry (pose + map), and publishes results (files or ROS 2 topics) for downstream use/visualization.
File-Structure Analysis
Top-level directories and their roles:
• module/ ← Core C++ library (include/ + src/ implementing LidarOdometry classes)
• apps/ ← mola-lidar-odometry-cli.cpp (offline CLI entry point)
• ros2-launchs/ ← ROS 2 launch scripts (.launch.py) for live runs
• pipelines/ ← YAML pipeline definitions (scan filter, mapping, registration strategies)
• state-estimator-params/ ← EKF/ smoother config for pose estimation
• rviz2/ ← RViz2 visualization configs
• scripts/ ← small shell launchers for common datasets
• eval/ ← benchmarking scripts against datasets
• docs/, CHANGELOG, package.xml, CMakeLists.txt, .github/… ← CI, build, docs
Key Architectural Insights from README
• Separates sensor ingestion (MOLA components) from odometry core.
• Supports two front-ends: CLI for batch runs on recorded data and a ROS 2 node for live systems.
• Configurable pipelines allow swapping mapping / scan-matching strategies at runtime via YAML.
Components
a. Main Components
1. Data Source
• Live LIDAR sensor → ROS 2 topic or
• Offline dataset (KITTI, rawlog, ROS2 bag2)
2. Front-Ends
• CLI (mola-lidar-odometry-cli)
• ROS 2 Node (mola_lidar_odometry package, launched via ros2-launchs/*.launch.py)
3. Core Library (module/)
• LidarOdometry class hierarchy (Initialize, ProcessScan, MapServer, Publish, etc.)
• Adaptive variables, sensor callbacks, relocalization modules
4. Pipeline Manager
• Loads YAML from pipelines/ + state-estimator-params/
• Configures the sequence: voxel grid, normal estimation, matcher (ICP, NDT…), EKF optional
5. Dependencies / Frameworks
• MOLA sensor handling
• MRPT for maps & math
• ROS 2 (rclcpp, message types, TF2)
6. Outputs
• CLI → TUM-format trajectory files
• ROS 2 Node → Odometry topics, TF2 frames, point-cloud map topics
• RViz2 configs for visualization (rviz2/*.rviz)
b. Relationships & Data Flow
• Data Source feeds Front-End (CLI or ROS 2 Node).
• Front-End invokes Core Library APIs.
• Core Library calls Pipeline Manager to set up filters & matchers.
• Core Library uses MOLA → MRPT internally; publishes back to Front-End.
• Front-End writes files or publishes ROS 2 topics.
• RViz2 subscribes to these topics for visualization.
• Evaluation scripts wrap around CLI or ROS 2 Node to benchmark performance.
c. Architectural Patterns & Design Principles
• Modular core library: clear separation between odometry logic and I/O (CLI vs ROS 2).
• Plugin-like pipeline loader via YAML for flexibility (open/closed principle).
• Use of CMake + package.xml for ROS 2 composable nodes and dependency management.
• CI pipeline (.github) for formatting, style, and multi-distro builds.
d. Key Technologies
• CMake, ROS 2 (rclcpp, launch_py), YAML configuration
• MOLA (sensor abstraction), MRPT (mapping/math)
• Eigen, PCL (implicitly via MRPT), Boost
1. Sketch the two entry points (CLI & ROS 2) on left, core library in center, outputs on right.
2. Pipeline loader/config between front-end and core.
3. Surround core with external dependencies (MOLA, MRPT, ROS 2 runtime).
7. Validate against the file tree: ensure each major directory’s role is reflected.