How open-rmf/rmf_traffic works
Project type and purpose
• This is a C++ library (ROS2 package) named rmf_traffic. Its purpose is to provide core algorithms and data structures for scheduling, routing, and negotiating mobile-robot traffic among multiple agents in an RMF (Robotics Middleware Framework) system.
File structure
• Top-level directories:
• src/rmf_traffic – Implementation mirroring the public API structure.
• thirdparty/fcl – A third-party collision‐detection library (used by geometry & blockade modules).
• docs – Sphinx/Doxygen build for API docs.
• test – Unit and regression tests organized per sub‐module.
• rmf_traffic_examples – Example ROS2 nodes illustrating use.
• CMakeLists.txt / package.xml / colcon.pkg – Build and packaging scripts (ROS2 + CMake).
Key insights from README
• The package exposes an API (ROS2 compliant) for:
• Scheduling robot itineraries
• Negotiating traffic conflicts (both path‐based & area‐based)
• Spatial queries & trajectory generation
• External dependency: FCL for collision geometry.
1. Public API Layer
– Entry point for clients (ROS2 nodes, examples)
– Headers in include/rmf_traffic
2. Core Modules
– Scheduler (schedule::Database, Participant, Query, Viewer)
– Negotiation
• agv::Negotiator, Schedule::Negotiator, blockade::Moderator
– Planner (agv::Planner, Rollout, Graph)
– Blockade Manager (blockade::Participant, Rectifier)
– Geometry Engine (ConvexShape, Circle, Space)
3. Utility & Debug
– detail namespaces, debug plumbing
4. Third-Party Collision Library
– FCL (broadphase & narrowphase collision detection)
5. Example Clients & Tests
– rmf_traffic_examples
– test harness
• Client code → Public API Layer → Core Modules
• Planner ↔ Geometry Engine (for spatial queries & path interpolation)
• Core Modules → FCL (calls into collision detection for blockade & negotiation)
• Scheduler & Negotiator ↔ Schedule Database (read/write itineraries)
• Blockade Manager ←→ Schedule Database (to track area bookmarks & conflicts)
c. Architectural patterns & design principles
• Layered architecture: API → core domain modules → low-level utilities → external libs
• Separation of concerns:
• Scheduling vs. negotiation vs. geometry vs. planning vs. blockade
• Public API vs. internal detail namespace
• Plugin-like extensibility: algorithms in agv/planning can be swapped (A*, heuristics)
d. Technologies & frameworks
– C++17, CMake, ROS2 (colcon build), FCL (collision library), Doxygen/Sphinx