A ROS2 workspace for controlling differential drive robots in Gazebo simulation.
This workspace contains a ROS2 package (gazebo_controller) that provides:
- Differential drive robot simulation in Gazebo
- ROS2-Gazebo bridge for topic communication
- Custom robot models with differential drive capabilities
- Launch files for easy simulation startup
gazebo_controller_ws/
├── src/
│ └── gazebo_controller/
│ ├── gazebo_controller/ # Python package
│ ├── launch/ # Launch files
│ │ ├── ros_gz_bridge.launch.py
│ │ └── gazebo_with_bridge.launch.py
│ ├── config/ # Configuration files
│ │ └── gazebo_bridge.yaml
│ ├── sdf/ # Robot model files
│ │ └── building_robot.sdf
│ ├── package.xml # Package dependencies
│ └── setup.py # Package setup
└── README.md
cd gazebo_controller_ws
colcon build
source install/setup.bashOption A: Complete System (Gazebo + Bridge)
ros2 launch gazebo_controller gazebo_with_bridge.launch.pyOption B: Bridge Only (if Gazebo already running)
ros2 launch gazebo_controller ros_gz_bridge.launch.pyOption C: Manual Control
# Terminal 1: Start Gazebo
gz sim $(ros2 pkg prefix gazebo_controller)/share/gazebo_controller/sdf/building_robot.sdf
# Terminal 2: Start Bridge
ros2 launch gazebo_controller ros_gz_bridge.launch.py# Move forward
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "linear: {x: 0.5, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}"
# Turn left
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.5}"
# Stop
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}"The building_robot.sdf contains a unique Pizza Delivery Bot design featuring:
- Red chassis with yellow delivery compartment
- Differential drive with realistic tire/rim wheels
- Dual front support wheels for stability
- Communication antenna for autonomous operation
| Topic | Type | Direction | Description |
|---|---|---|---|
/cmd_vel |
geometry_msgs/msg/Twist |
ROS → Gazebo | Velocity commands |
/odom |
nav_msgs/msg/Odometry |
Gazebo → ROS | Robot odometry |
/tf |
tf2_msgs/msg/TFMessage |
Gazebo → ROS | Transform data |
/clock |
rosgraph_msgs/msg/Clock |
Gazebo → ROS | Simulation time |
- ROS2 (Jazzy/Humble)
- Gazebo (Garden/Harmonic)
- ros_gz_bridge
- geometry_msgs
- nav_msgs
- tf2_ros
- Ensure you run
colcon buildfrom the workspace root, not from insidesrc/gazebo_controller - Source the workspace with
source install/setup.bashafter building - The robot uses differential drive kinematics for realistic movement
Issue: Launch file not found
- Solution: Rebuild from workspace root and source properly
Issue: Topics not bridging
- Solution: Check if Gazebo and ROS2 are using compatible DDS settings
Issue: Robot not moving
- Solution: Verify
/cmd_veltopic is being published correctly
Course: EN613
Author: [Your Name]
Date: October 2025