MyBot is a ROS 2 package that provides a complete simulation environment for a mobile differential-drive robot equipped with sensors. The package includes robot description files, Gazebo world configurations, and launch scripts for simulation and visualization.
- Differential Drive Robot: Two-wheel drive system with caster wheel
- Sensors:
- LiDAR/Laser Scanner (RPLiDAR simulation)
- Depth Camera with 3D point cloud
- RGB Camera
- Odometry from wheel encoders
- Joints: Fully articulated with visual and collision meshes
- Gazebo Integration: Uses Gazebo Ignition (ros_gz_sim) for physics simulation
- Multiple World Scenarios:
tugbot_warehouse.sdf- Warehouse environment (default)tugbot.world- Open environmentobstacles.world- Obstacle course
- ROS 2 Bridging: ros_gz_bridge for topic communication
- RViz2 Integration: Real-time visualization of robot state and sensor data
- Custom Configuration: Pre-configured RViz setup for robot control and mapping
mybot/
├── CMakeLists.txt # Build configuration
├── package.xml # ROS 2 package metadata
├── LICENSE.md # Apache 2.0 License
│
├── description/ # URDF/Xacro robot description
│ ├── robot.urdf.xacro # Main robot description (includes all components)
│ ├── robot_core.xacro # Base chassis, wheels, caster wheel
│ ├── lidar.xacro # LiDAR/laser scanner configuration
│ ├── camera.xacro # RGB camera definition
│ ├── depth_camera.xacro # Depth camera with point cloud
│ ├── gazebo_control.xacro # Gazebo plugins and differential drive controller
│ └── inertial_macros.xacro # Helper macros for inertia calculations
│
├── launch/ # Launch files for different scenarios
│ ├── rsp.launch.py # Robot State Publisher (processes xacro files)
│ ├── launch_sim.launch.py # Complete simulation with Gazebo and RViz
│ ├── slam.launch.py # SLAM Toolbox integration for mapping
│ └── rplidar.launch.py # RPLiDAR-specific configuration
│
├── config/ # Configuration files
│ ├── mapper_params_online_async.yaml # SLAM Toolbox configuration
│ ├── drive_robot.rviz # RViz visualization settings
│ └── empty.yaml # Empty world configuration
│
├── models/ # Gazebo model files
│ └── tugbot/ # Robot model directory
│
├── worlds/ # Gazebo world/environment files
│ ├── tugbot_warehouse.sdf # Warehouse environment (default)
│ ├── tugbot.world # Simple open environment
│ ├── obstacles.world # Obstacle course environment
│ └── myworld.sdf # Alternative environment
│
└── maps/ # Pre-built maps for navigation
├── map.yaml # Map metadata and configuration
└── map.pgm # Map image (occupancy grid)
ament_cmake- ROS 2 build systemxacro- URDF macro processor
ros_gz_sim- Gazebo Ignition simulatorros_gz_bridge- ROS-Gazebo message bridgerobot_state_publisher- Publishes robot transform treejoint_state_publisher- Publishes joint statesrviz2- ROS 2 visualization toolslam_toolbox- SLAM implementation for mapping
# Source ROS 2 environment
source /opt/ros/humble/setup.bash
# Install dependencies
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -ycd ~/ros2_ws
colcon build --packages-select mybot
source install/setup.bashLaunch the map and localization components (useful when you want only mapping/localization without the full simulator):
ros2 launch mybot map.launch.pyStarts Gazebo, spawns robot, bridges topics, and opens RViz:
ros2 launch mybot launch_sim.launch.pyOptional arguments:
ros2 launch mybot launch_sim.launch.py world:=/path/to/custom.sdfStarts SLAM Toolbox for autonomous mapping and localization:
ros2 launch mybot slam.launch.pyThis requires launch_sim.launch.py running in another terminal.
Processes robot description and publishes transforms (no simulation):
ros2 launch mybot rsp.launch.py use_sim_time:=falseLaunches simulation with RPLiDAR configuration:
ros2 launch mybot rplidar.launch.py| Topic | Type | Description |
|---|---|---|
/clock |
rosgraph_msgs/Clock |
Simulation clock |
/scan |
sensor_msgs/LaserScan |
LiDAR point data |
/odom |
nav_msgs/Odometry |
Odometry from wheel encoders |
/tf |
tf2_msgs/TFMessage |
Transform tree |
/camera/image |
sensor_msgs/Image |
RGB camera image |
/camera/depth_image |
sensor_msgs/Image |
Depth camera image |
/camera/points |
sensor_msgs/PointCloud2 |
3D point cloud |
/camera_info |
sensor_msgs/CameraInfo |
Camera calibration info |
/joint_states |
sensor_msgs/JointState |
Joint positions/velocities |
| Topic | Type | Description |
|---|---|---|
/cmd_vel |
geometry_msgs/Twist |
Robot velocity commands |
- base_link - Reference frame
- chassis - Robot body (0.3 x 0.3 x 0.15 m)
- left_wheel - Left drive wheel
- right_wheel - Right drive wheel
- caster_wheel - Front caster wheel
- lidar_link - LiDAR sensor
- camera_link - RGB/depth camera
- chassis_joint - Fixed joint (base_link to chassis)
- left_wheel_joint - Continuous joint (drive)
- right_wheel_joint - Continuous joint (drive)
- caster_wheel_joint - Continuous joint (free rotation)
- lidar_joint - Fixed joint (on chassis)
- camera_joint - Fixed joint (on chassis)
Send velocity commands using:
ros2 topic pub /cmd_vel geometry_msgs/Twist "{linear: {x: 0.5, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0.2}}"Where:
linear.x- Forward velocity (m/s)angular.z- Rotational velocity (rad/s)
Configures SLAM Toolbox parameters:
- Async online SLAM mode
- Loop closure detection
- Map update frequency
- Sensor timeout settings
Pre-configured visualization including:
- Robot model display
- LaserScan visualization
- Camera image display
- Map and odometry visualization
- Coordinate frame display
- Warehouse-style environment with walls and obstacles
- Suitable for mapping and navigation tasks
- Open environment
- Minimal obstacles for basic testing
- Obstacle course for navigation testing
- Alternative environment configuration
- Customizable scenario for testing
The maps/ directory contains pre-computed maps for navigation tasks:
-
map.yaml - Map metadata file containing:
- Reference to the map image file
- Map resolution (meters per pixel)
- Map origin coordinates
-
map.pgm - Occupancy grid image used by nav2 and other navigation packages
- Can be loaded directly in SLAM Toolbox
- Used for localization and path planning
Load a map in your navigation stack:
ros2 launch nav2_bringup bringup_launch.py map:=install/mybot/share/mybot/maps/map.yaml# Terminal 1: Launch the map and localization
ros2 launch mybot map.launch.py
# Terminal 2: Start the Dijkstra planner
ros2 run dijkstra_planning dijkstra_planner --ros-args -p use_sim_time:=true- Create a new
.xacrofile indescription/ - Include it in
robot.urdf.xacro - Configure Gazebo plugin in
gazebo_control.xacro
- Create
.sdfor.worldfile inworlds/ - Reference in launch file:
ros2 launch mybot launch_sim.launch.py world:=worlds/my_world.sdf
- Size/Weight: Edit
robot_core.xacro - Wheel Properties: Adjust radius and width in
robot_core.xacro - Sensor Position: Modify xyz/rpy in respective
.xacrofiles
- Ensure
robot_descriptiontopic is published - Check RViz
Fixed Frameis set toodomorbase_link - Verify Gazebo is running:
gz topic -l
- Check bridges in launch file match Gazebo topic names
- Verify sensor plugins are enabled in Gazebo config
- Use
ros2 topic listto confirm topics exist
- Ensure
/scantopic is being published - Check SLAM Toolbox parameters in config file
- Verify map is being created:
ros2 topic echo /map
- Reset RViz:
rm ~/.rviz2/default.rviz - Check Display configuration file exists
- Verify transforms are published:
ros2 run tf2_tools view_frames
Apache License 2.0 - See LICENSE.md for details
See package.xml for current maintainer details
- fsm_bumpgo_cpp - Bump-and-go finite state machine implementation
- slam_toolbox - Autonomous mapping and localization
- ros_gz_sim - Gazebo Ignition simulator bridge
- Repository (Dijkstra): https://github.com/paul-pritam/dijkstra_path_planner.git