This workspace is designed for the implementation and testing of GridSLAM (Grid-based Simultaneous Localization and Mapping) and a State Machine for autonomous navigation.
- GridSLAM: Uses a grid-based approach to map the environment while simultaneously tracking the robot's pose. It handles sensor data integration, occupancy grid updates, and pose estimation.
- State Machine: Given an initial pose and a goal pose, it finds a path and follows it automatically using the generated map.
The core of this workspace is the GridSLAM implementation. It allows you to create a map of the environment using a particle filter for localization and an occupancy grid for mapping.
Execute each ros2 launch or ros2 run command in a separate terminal window. Follow the steps below to build the workspace and launch the necessary components.
First, build all packages in the workspace:
colcon buildIn a new terminal, source the workspace and launch the GridSLAM node.
source install/setup.bash
ros2 launch grid_fastslam fastslam.launch.py num_particles:=50In a new terminal, source the workspace and launch the custom simulation environment:
source install/setup.bash
ros2 launch turtlebot3_custom_simulation custom_casa.launch.pyIn a new terminal, run the teleoperation node to control the robot and explore the environment to build the map:
ros2 run turtlebot3_teleop teleop_keyboardOnce you are satisfied with the map, save it. The map saver node will save the map to the src/state_machine/maps directory.
source install/setup.bash
ros2 run tools map_saver --ros-args -p map_name:=my_mapAfter creating and saving a map, you can run the State Machine to navigate autonomously.
Since a new map was added, rebuild the workspace to ensure it is installed correctly:
colcon buildIn a new terminal, source the workspace and launch the State Machine. This will launch the map publisher, localization, and navigator nodes.
source install/setup.bash
ros2 launch state_machine state_machine.launch.pyIf the simulation is not already running, launch it in a new terminal:
source install/setup.bash
ros2 launch turtlebot3_custom_simulation custom_casa.launch.py- Initial Pose: Use the "2D Pose Estimate" tool in Rviz to set the initial pose of the robot to match its position in the simulation.
- Goal Pose: Use the "2D Goal Pose" tool in Rviz to set a destination. The State Machine will calculate a path and navigate the robot to the goal.