How raulmur/orb_slam works
Project type and purpose
• ORB-SLAM Monocular is a robotics/perception system implemented in C++ and ROS. It computes in real time the camera trajectory and a sparse 3D reconstruction from a single camera.
• It tightly integrates with ROS for image I/O and visualization, uses OpenCV for feature extraction, Boost for threading, g2o for graph optimization, and DBoW2 for place recognition.
Main components
a. ROS Interface
• Subscriber: listens on /camera/image_raw
• Publishers:
– /ORB_SLAM/Frame (processed image)
– /ORB_SLAM/Map (3D point cloud)
– /tf transforms for camera and world
• Launch files (ExampleFuerte.launch, ExampleGroovyOrNewer.launch)
b. Tracking Module
• Receives raw images → ORBextractor → ORBmatcher against local map
• Chooses between initialization (Initializer) and normal tracking
• Outputs camera pose and decides when to insert a KeyFrame
c. Initialization Module
• Bootstraps map from initial frames (planar or general scenes) using the Initializer class
d. Local Mapping Thread
• Takes new KeyFrames → triangulates new MapPoints → culls redundant keyframes/points
e. Loop Closing Thread
• Queries KeyFrameDatabase (DBoW2) to detect loops
• When loop found, computes Sim3 transformation via Sim3Solver → runs global pose‐graph optimization in g2o
f. Data Structures
• MapPoint, KeyFrame, KeyFrameDatabase, ORBVocabulary
g. Optimizer
• Uses g2o to optimize pose graphs and bundle adjustment
h. Converter / PnP / Sim3 Solvers
• Geometry utilities (Converter) and solvers for pose estimation
Relationships and data flow
• Raw images (ROS) → Tracking →
├─ if not initialized → Initializer → Tracking
├─ if new KeyFrame → push to Local Mapping
└─ always publishes pose/frame/map via ROS topics
• Local Mapping and Loop Closing run in parallel, both updating the central Map
• Loop Closing uses KeyFrameDatabase (DBoW2) and g2o to correct drift and update all KeyFrame poses
• Optimizer invoked by Local Mapping (local BA) and Loop Closing (global BA)
Architectural patterns and design principles
• Multi-threaded pipeline: Tracking / LocalMapping / LoopClosing run concurrently
• Publisher/Subscriber: ROS topics for decoupled communication
• Graph-based SLAM: poses and landmarks form a sparse graph optimized by g2o
• Separation of concerns: clear modules for feature extraction, mapping, loop detection, optimization
Important technologies/frameworks
• ROS (message passing, rviz visualization)
• OpenCV (image processing, ORB features)
• Boost (thread management)
• Eigen3 (linear algebra)
• g2o (nonlinear optimization)
• DBoW2 (Bag-of-Words place recognition)
Final recommendations
• Related components visually (e.g., put all optimization in one region) to improve readability