This repository contains a Gazebo and Isaac Sim simulation for a differential drive robot, equipped with an IMU, a depth camera, stereo camera and a 2D LiDAR. ROS2 versions also include Nav2 and SLAM Tool Box support. Currently, the project supports the following combinations -
- ROS Noetic + Gazebo Classic 11 (branch ros1)
- ROS2 Humble + Gazebo Classic 11 (branch ros2)
- ROS2 Humble + Gazebo Fortress (branch ros2)
- ROS2 Humble + Gazebo Harmonic (branch ros2)
- ROS2 Humble + Isaac Sim (branch ros2)
- ROS2 Jazzy + Gazebo Harmonic (branch ros2-jazzy)
- ROS2 Jazzy + Isaac Sim (branch ros2-jazzy)
Each of the following sections describes depedencies, build and run instructions for the combinations supported by the ros2-jazzy branch.
Install Gazebo harmonic using ROS2 binaries:
sudo apt install ros-jazzy-ros-gz-sim ros-jazzy-ros-gz-bridge ros-jazzy-ros-gz-interfacesInstall other dependencies with rosdep.
# From the root directory of the workspace. This will install everything mentioned in package.xml
rosdep install --from-paths src --ignore-src -r -ycolcon build --packages-select bcr_botTo launch the robot in Gazebo,
ros2 launch bcr_bot gz.launch.pyTo view in rviz,
ros2 launch bcr_bot rviz.launch.pyThe launch file accepts multiple launch arguments,
ros2 launch bcr_bot gz.launch.py \
camera_enabled:=True \
stereo_camera_enabled:=False \
two_d_lidar_enabled:=True \
position_x:=0.0 \
position_y:=0.0 \
orientation_yaw:=0.0 \
odometry_source:=world \
world_file:=small_warehouse.sdfIn addition to ROS2 Humble Isaac Sim installation with ROS2 extension is required. Remainder of bcr_bot specific dependencies can be installed with rosdep
# From the root directory of the workspace. This will install everything mentioned in package.xml
rosdep install --from-paths src --ignore-src -r -ycolcon build --packages-select bcr_botTo launch the robot in Isaac Sim:
- Open Isaac Sim and load the
warehouse_scene.usdorscene.usdfrom here. - Add in extra viewports for different camera views.
- Start the Simulation: Run the simulation directly within Isaac Sim.
- The following USDs are included in the package:
warehouse_scene.usd- Warehouse scene with a robot.scene.usd- Scene with a robot in a empty world.bcr_bot.usd- Robot model that can be imported into any scene.ActionGraphFull.usd- Action graph for the robot to publish all the required topics.
To view in rviz:
ros2 launch bcr_bot rviz.launch.pyNOTE: The command to run mapping and navigation is common between all versions of gazebo and Isaac sim see here.
SLAM Toolbox is an open-source package designed to map the environment using laser scans and odometry, generating a map for autonomous navigation.
NOTE: The command to run mapping is common between all versions of gazebo.
To start mapping:
ros2 launch bcr_bot mapping.launch.pyUse the teleop twist keyboard to control the robot and map the area:
ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=/bcr_bot/cmd_velTo save the map:
cd src/bcr_bot/config
ros2 run nav2_map_server map_saver_cli -f bcr_mapNav2 is an open-source navigation package that enables a robot to navigate through an environment easily. It takes laser scan and odometry data, along with the map of the environment, as inputs.
NOTE: The command to run navigation is common between all versions of gazebo and Isaac sim.
To run Nav2 on bcr_bot:
ros2 launch bcr_bot nav2.launch.pypush from inside bcr_bot folder and push to a new branch (git checkout -b amr-simulation-bcr)
nano ~/.bashrc
Add these two lines at the bottom of the file: source /opt/ros/jazzy/setup.bash source ~/ros2_ws/install/setup.bash
Save: Ctrl+O → Enter → Ctrl+X
Apply immediately: source ~/.bashrc
Verify (open new terminal and run): echo $ROS_DISTRO Expected output: jazzy
rm -f ~/.ros/*.posegraph ~/.ros/*.data
mkdir -p ~/maps
ros2 launch bcr_bot gz.launch.py \
two_d_lidar_enabled:=true \
world_file:=/home/dilshad/ros2_ws/install/bcr_bot/share/bcr_bot/worlds/small_warehouse.sdf
WAIT until Gazebo window fully opens and robot is visible.
ros2 launch slam_toolbox online_async_launch.py \
use_sim_time:=true \
slam_params_file:=$HOME/my_slam_toolbox_params.yaml
WAIT until no errors appear in terminal.
Verify SLAM is receiving laser (new terminal):
ros2 topic info /scan
Subscription count should be: 1
TERMINAL 3 - RViz (just running rviz2 also works but then u have to manually add the TF, RobotModel,LaserScan,Map,Odometry etc..
rviz2 -d ~/bcr_bot_slam.rviz /
Confirm before driving:
- Fixed Frame = map
- Map starts GREY (not fully drawn)
- LaserScan dots visible around robot
- Robot model visible
WARNING: If map appears fully drawn instantly,
a pose graph was reloaded. Stop and run:
rm -f ~/.ros/*.posegraph ~/.ros/*.data
Then restart SLAM and RViz.
ros2 run teleop_twist_keyboard teleop_twist_keyboard \
--ros-args --remap cmd_vel:=/bcr_bot/cmd_vel
Running NAV 2_____
ros2 launch bcr_bot nav2.launch.py use_sim_time:=true
Edit NAV2 Parameters
nano ~/ros2_ws/src/bcr_bot/config/nav2_params.yaml
Save for Nav2:
ros2 run nav2_map_server map_saver_cli \
-f ~/maps/warehouse_map \
--ros-args -p use_sim_time:=true
Save SLAM pose graph:
ros2 service call /slam_toolbox/save_map slam_toolbox/srv/SaveMap \
"name: {data: '/home/dilshad/maps/warehouse_map'}"
View map in WSL:
eog ~/maps/warehouse_map.pgm
Verify files saved:
ls -lh ~/maps/
Expected files:
warehouse_map.pgm
warehouse_map.yaml
warehouse_map.posegraph
warehouse_map.data
Export to Windows Desktop (optional):
cp ~/maps/warehouse_map.pgm /mnt/c/Users/Dilshad/Desktop/
cp ~/maps/warehouse_map.yaml /mnt/c/Users/Dilshad/Desktop/
________After Making changes build the project cd ~/ros2_ws colcon build --packages-select bcr_bot --symlink-install source install/setup.bash
6. If Gazebo window does not open, check:
echo $DISPLAY
echo $WAYLAND_DISPLAY
Gazebo:
ros2 launch bcr_bot gz.launch.py two_d_lidar_enabled:=true world_file:=/home/dilshad/ros2_ws/install/bcr_bot/share/bcr_bot/worlds/small_warehouse.sdf
SLAM:
ros2 launch slam_toolbox online_async_launch.py use_sim_time:=true slam_params_file:=$HOME/my_slam_toolbox_params.yaml
RViz:
rviz2 -d ~/bcr_bot_slam.rviz
Teleop:
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap cmd_vel:=/bcr_bot/cmd_vel
Save Map:
ros2 run nav2_map_server map_saver_cli -f ~/maps/warehouse_map --ros-args -p use_sim_time:=true
================================================================