This package contains a companion code for the article Occupancy Grid Mapping with The Binary Bayes Filter in ROS 2 which introduces the basic occupancy grid mapping algorithm introduced in section 9.2 of the Probabilistic Robotics book.
Occupancy Grid Mapping with The Binary Bayes Filter in ROS 2
To install the necessary dependencies and clone/build the package, follow these steps:
# Install some dependency
sudo apt install python3-pykdl
# Clone and build the package
# Change the ROS 2 workspace accordingly
cd ros2_ws/src
git clone https://github.com/carlos-argueta/rse_prob_robotics.git
cd ..
colcon build --symlink-install
You have two options to run the mapping node. Option one is to use the pre-recorded data, option two is to run a simulation of the Turtlebot 3 yourself. Depending of your choice, follow one of the set of instructions below.
wget -O occupancy_grid_mapping_tb3.zip "https://www.dropbox.com/scl/fi/anc0jq4vwhpe78q0ajg4v/occupancy_grid_mapping_tb3.zip?rlkey=bdzpd5uowonfruutk8u4iyzkt&st=9xjq6dr9&dl=1"
unzip occupancy_grid_mapping_tb3.zip
sudo apt install ros-humble-gazebo-ros-pkgs
sudo apt install ros-humble-turtlebot3-msgs
sudo apt install ros-humble-turtlebot3
mkdir -p ~/turtlebot3_ws/src
cd ~/turtlebot3_ws/src/
git clone -b humble-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/turtlebot3_ws && colcon build --symlink-install
To run the project, you'll need to open two terminals. Follow the steps below:
# Launch mapping
source ~/ros2_ws/install/setup.bash
ros2 run rse_occupancy_grid_mapping occupancy_grid_mapping
# Navigate to where you extracted the ROS 2 bag and then run it with:
ros2 bag play rosbag2_2025_01_13-13_30_54 --clock
To run the project, you'll need to open three terminals. Follow the steps below:
# Launch mapping
source ~/ros2_ws/install/setup.bash
ros2 run rse_occupancy_grid_mapping occupancy_grid_mapping
# Launch simulation
export TURTLEBOT3_MODEL=waffle
source ~/turtlebot3_ws/install/setup.bash
ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
It may take a while to load the simulation the first time you run this. Rerun the launch command if it gets stuck for too long or fails.
# Launch teleop
export TURTLEBOT3_MODEL=waffle
source ~/turtlebot3_ws/install/setup.bash
ros2 run turtlebot3_teleop teleop_keyboard
Use the teleop tool to remote control the Turtlebot 3 and build the map.