How nordstream3/godot-4-ros2-integration works
Project type and purpose
• This is a robotics-simulation integration project that fuses:
• Blender (for 3D asset and scene creation)
• Godot 4.x engine (for real-time simulation and physics)
• ROS2 middleware (for robot control and sensor data exchange)
• It provides a full pipeline: author assets in Blender → run a Godot-based simulation of a 4WS4WD mobile robot → expose sensor data and control interfaces via ROS2 nodes.
File structure
• Top-level:
• LICENSE, README.md
• src/
• Under src/:
• Godot_4WS4WD_simulation_game/
– Godot project files (.tscn, .tres, .blend.zip)
– GDScript control and sensor scripts (ros_steering.gd, depth_camera_3d.gd, etc.)
• godot_custom_modules/godot_ros/
– C++ module sources, headers, SCsub build script, plus GDScript demos (cmd_listener.gd, talker.gd, viewport_publisher.gd)
• ros_control/
– inputter.py (a ROS2 publisher for keyboard controls)
• Key patterns:
• Modular extension of Godot via a custom C++ “godot_ros” module
• A separate Godot project containing assets, scenes, and GDScript logic
• ROS2 pub/sub integration embedded in both C++ and GDScript layers
• A helper Python node in ros_control for user input
README for additional insights
• Confirms use of Jolt Physics Engine as a Godot addon for accurate physics
• Describes the ROS2 topics in play: robot control subscription and sensor publications (depth camera, downward camera)
• Details build and run steps for:
• Building Godot with the custom module
• Packaging Jolt into the Godot project
• Running the simulation and auxiliary ROS2 tools (inputter.py, rqt_image_view)
• Blender Asset Pipeline
• Godot Engine Core
• Jolt Physics Extension (addon inside Godot)
• Godot-ROS2 Custom Module (C++ + GDScript)
• Godot Simulation Project (4WS4WD game scene + scripts)
• ROS2 Middleware (DDS network, topics/services)
• ROS2 Control Node (inputter.py)
• ROS2 Visualization (rqt_image_view)
1. Blender → Godot Simulation Project (“.blend/.tscn assets imported”)
2. Godot Engine Core + Jolt Physics → Godot Simulation Project (“physics simulation of robot”)
3. Godot Simulation Project → Godot-ROS2 Module (“calls into C++ module for ROS2”)
4. Godot-ROS2 Module ↔ ROS2 Middleware (“publishes / subscribes to topics”)
5. ROS2 Control Node → ROS2 Middleware (“keyboard → /cmd_vel”)
6. ROS2 Middleware → Godot-ROS2 Module → Godot Simulation (“control commands drive robot”)
7. Godot Simulation (Depth Camera) → Godot-ROS2 Module → ROS2 Middleware (“publishes /depth_image”)
c. Architectural patterns & principles:
• Modular plugin architecture (Godot custom module)
• Publisher/subscriber messaging pattern (ROS2 topics)
• Separation of concerns: asset creation, simulation engine, middleware, control & visualization
• Extensibility: additional sensors or control schemes can be added as GDScript or C++ modules
d. Relevant technologies:
• Godot 4.4 engine
• Jolt physics for high-precision simulation
• ROS2 (Humble or later) for middleware
• Blender for asset authoring
• Python ROS2 node for input (inputter.py)
• rqt_image_view for sensor visualization
Elements
• Middleware (ROS2, rqt_image_view) in another