How intelligentsystemslabutv/ros2-examples works
Project Type and Purpose
• This is a tutorial/example full-stack ROS 2 workspace: it provides a collection of C++ and Python packages that demonstrate core ROS 2 concepts (topics, services, actions, parameters, plugins, image processing, lifecycle, etc.).
File-Structure Analysis
• Top-level:
• .github/workflows – GitHub Actions CI for syncing and testing
• bin – DUA template artifacts and install scripts (bash context snippets, Dockerfile templates, dua_setup.sh, ros2_jazzy_install.sh)
• config – helper scripts for sourcing ROS 2
• docker – ready-made container definitions for each target (devcontainer.json, Dockerfile, shell config)
• src – the ROS 2 workspace
– src/cpp – all C++ packages
– src/python – Python examples
– src/ros2_examples_interfaces – message/service/action definitions
– src/ros2_examples_bringup – launch‐file conventions
• README.md, dua-template.md, interfaces.md, launch_files.md – documentation and guidelines
Key README Insights
• The workspace is built and orchestrated via colcon and the DUA template.
• Supports VS Code devcontainers and local Docker
• Contains three container targets (x86-dev, x86-cudev for CUDA-enabled, armv8-dev)
• Examples are grouped by functionality (pub/sub, custom messages, services, parameters, actions, plugins, image pipelines)
a. Main Components
• Developer Environment (Host OS + VS Code IDE)
• DUA Template / bin Scripts
• Docker Container Targets (x86-dev, x86-cudev, armv8-dev)
• colcon Build System
• ROS 2 Middleware (rclcpp, rclpy, DDS/RMW)
• Example Node Groups:
• pub/sub (topic_pubsub_cpp / py)
• services (simple_service_cpp)
• actions (actions_example_cpp / complete_actions_cpp)
• parameters (parameters_example_cpp)
• plugins (polygon_base, polygons, polygons_tester)
• image processing (aruco_detector, ros2_usb_camera, rqt_image_view)
• interfaces-only (ros2_examples_interfaces)
• bringup/launch (ros2_examples_bringup)
• External Services & Tools: GitHub Actions, Docker Engine, colcon, CMake, GCC, Python
b. Relationships & Interactions
• Developer pushes code → GitHub Actions CI → builds/tests examples
• Developer launches VS Code devcontainer (select target) → mounts workspace → runs bin/dua_setup.sh → colcon build
• Built nodes (C++ binaries, Python entry points) register with ROS 2 middleware
• Nodes communicate over topics/services/actions via DDS network; some pipelines use image_transport (camera → detector → GUI)
• Launch files (in bringup) orchestrate multi-node graphs
• Plugins: polygons_tester loads shared-object plugins at runtime via pluginlib
c. Architectural Patterns & Principles
• Modular, multi-package ROS 2 workspace
• DUA template for unified containerized development
• Layered separation: build layer (colcon/CMake), runtime layer (ROS 2 middleware), application layer (example nodes)
• Plugin pattern (pluginlib) for runtime extensibility
• Message-oriented middleware (pub/sub, request/response, action feedback)
• Devcontainers for environment reproducibility
d. Key Technologies & Frameworks
• ROS 2 (rclcpp, rclpy, DDS/RMW implementation)
• Docker, Devcontainer specs (VS Code)
• CMake, colcon build system
• GCC (C++17), Python 3
• image_transport, pluginlib