Generating a Map ================ This guide explains how to generate a map using the TurtleBot4. Prerequisites ------------- Make sure your PC and TurtleBot are connected to the same network. Step 1: Check ROS_DOMAIN_ID --------------------------- Before starting, ensure that the ROS_DOMAIN_ID is the same on both the TurtleBot and your PC. On the TurtleBot ~~~~~~~~~~~~~~~~ Open a terminal and connect via SSH: .. code-block:: bash ssh ubuntu@ Enter the password: .. code-block:: bash turtlebot4 Check the ROS_DOMAIN_ID: .. code-block:: bash echo $ROS_DOMAIN_ID On your PC ~~~~~~~~~~ Open another terminal and check your configuration: .. code-block:: bash nano ~/.bashrc Scroll to the bottom and look for: .. code-block:: bash export ROS_DOMAIN_ID= Make sure this value matches the one on the TurtleBot. You can also check it quickly: .. code-block:: bash echo $ROS_DOMAIN_ID If the values are different, update them so they match. Step 2: Launch SLAM (Mapping) ---------------------------- Start the mapping process using SLAM. Terminal 1 – Start SLAM ~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash ros2 launch turtlebot4_navigation slam.launch.py namespace:=raphael Note: The namespace may be different depending on your TurtleBot name. Terminal 2 – Start Visualization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash ros2 launch turtlebot4_viz view_navigation.launch.py namespace:=raphael Result ------ A visualization window will appear where the robot builds a map of the environment in real-time.