How mwlock/webots_ros2_conveyor works
Project Type & Purpose
• This is a ROS2 simulation package that provides a Webots interface for a conveyor belt and camera–equipped robot.
• Its primary purpose is to control a conveyor’s motor via ROS2 topics and stream camera/depth data into ROS2.
File Structure
• Top-level:
• launch/robot_launch.py – ROS2 launch script bringing up all nodes & loading the Webots world.
• protos/ConveyorBelt.proto – protobuf definitions (used to generate message types or gRPC services).
• resource/*.urdf – URDF robot and conveyor definitions for Webots.
• worlds/*.wbt – Webots world files embedding those URDFs.
• webots_ros2_conveyor/ – Python ROS2 nodes:
– camera_driver.py
– conveyor_belt_driver.py
– object_recognition_controller.py
Extract Key Architectural Elements from README
• Topics:
– <robot_name>/cmd_vel (geometry_msgs/Twist) → conveyor motor commands
– /<cambot>/camera & camera_info (sensor_msgs/Image, CameraInfo) → vision stream
– /<cambot>/depth (sensor_msgs/Image) → depth stream
Main Components & Boundaries
A. Webots Simulation (World)
• Loads URDF models (resource/*.urdf) inside worlds/ure.wbt.
• Contains two simulated entities:
– Conveyor belt (motor)
– Cambot (camera + depth sensor)
B. ROS2 Middleware
• Topic bus for message exchange.
• Launch manager to start all nodes.
C. ROS2 Nodes (in webots_ros2_conveyor/)
1. ConveyorBeltDriver
– Subscribes to <robot_name>/cmd_vel
– Translates Twist → Webots motor API via ROS2-Webots bridge
2. CameraDriver
– Interfaces with Webots camera device
– Publishes /<cambot>/camera & camera_info
– Publishes /<cambot>/depth
3. ObjectRecognitionController
– Subscribes to camera & depth topics
– Runs vision algorithms, can publish recognition results (if extended)
D. Protobuf Definitions
• ConveyorBelt.proto may define custom messages or gRPC services for a more formalized API.
Relationships & Data Flows
• User (or higher-level planner) → publishes on <robot_name>/cmd_vel → ConveyorBeltDriver → Webots motor.
• Webots camera device → CameraDriver → publishes on camera and depth topics → ROS2 bus.
• ObjectRecognitionController → subscribes to those topics → processes frames → (optional) publishes results.
Architectural Patterns & Principles
• Publisher/Subcriber (ROS2 topics) decoupling.
• Single-responsibility nodes: each driver handles one device.
• Resource directory separates URDFs, keeping code vs. model assets distinct.
• Launch file orchestrates node lifecycles.