How cra-ros-pkg/robot_localization works
Project Type and Purpose
• Type: A ROS (Robot Operating System) C++ package providing nonlinear state‐estimation nodes (EKF, UKF, NavSat transform).
• Purpose: Fuse multiple sensor inputs (IMU, odometry, GPS, etc.) into a consistent robot state estimate, expose that estimate via ROS topics, tf, and services.
File Structure
• /robot_localization: Core filter libraries (FilterBase, EKF, UKF, utilities).
• src: Node entry points (ekf_node.cpp, ukf_node.cpp, navsat_transform_node.cpp, listener nodes).
• launch: ROS 2 Python‐based launch files for each node and examples.
• params: YAML parameter files per node.
• srv: Service definitions (e.g., FromLL, ToLL, GetState).
• test: Unit and integration tests (bag playback, node launch tests).
• doc: Sphinx documentation and examples.
README for Insights
• Core functionality: nonlinear state estimation nodes.
• External dependencies: ROS, geometry_msgs, sensor_msgs, tf2, etc.
• Integration points: nodes subscribe to sensor topics, publish state, broadcast tf, provide services for coordinate conversions.
Main Components and Their Interactions
1) Sensor interfaces (external ROS topics: /imu/data, /odom, /gps/fix, etc.)
2) Filter library (FilterBase, EKF, UKF, NavSatTransform)
3) ROS Node wrappers (ekf_node, ukf_node, navsat_transform_node, listener node)
4) Parameter server (YAML files loaded at node startup)
5) ROS infrastructure (roscore, tf2, topics, services)
6) Output interfaces (PoseStamped topic, nav_msgs/Odometry, tf2 frames)
7) Services for datum and coordinate conversion (FromLL, ToLL, SetDatum, GetState)
• Sensors → ROS Topics → Filter Node (subscriber callbacks)
• Parameter Server → Node (on startup)
• Filter Node → Filter Library (calls into EKF/UKF classes)
• Filter Library → State Estimate → Node publishes to:
– /odometry topic
– tf2 (broadcast frames)
• Node offers ROS Services → Clients can call coordinate‐conversion or reset datum
• NavSatTransform Node → communicates with filter nodes or external nodes via topics/services
Architectural Patterns & Design Principles
• Modularity: clear separation between filtering algorithms (library code) and ROS interface (nodes).
• Extensibility: new filters or measurement models can be added under include/robot_localization.
• Configuration‐driven: use of YAML params in params/ directory to configure measurement frequency, covariances, frames.
• Testability: comprehensive unit tests (gtests) and integration tests (ROS bag playback).
Technologies/Frameworks to Annotate
• CMakeLists.txt / ament/Catkin build
• ROS (roscpp, roscpp nodelets if used)
• tf2 for transforms
• geometry_msgs, nav_msgs, sensor_msgs
• YAML parameters, launch.py for ROS 2