m-explore ROS2

repository·main·Indexed 18 days ago

https://github.com/robo-friends/m-explore-ros2

A port of the m-explore library for multi-robot autonomous exploration and map merging in ROS 2 Humble and newer. It includes the explore_lite package for autonomous exploration and multirobot_map_merge for merging maps from multiple robots, with support for TurtleBot3 simulations and integration with slam_gmapping and slam_toolbox.

Tokens
1.3K
Snippets
6
Records
7
Agent score
14%

What's inside m-explore-ros2

  1. Control exploration: Stop, Resume, and Return to Init

    main

    Stop/Resume exploration

    By default, the exploration node starts immediately. You can control the state by publishing to the explore/resume topic:

    • Stop: Publish False to explore/resume. The robot will stop moving.
    • Resume: Publish True to explore/resume.

    Returning to initial pose

    To make the robot return to its starting position after the exploration is complete, set the parameter return_to_init to True during launch.

  2. Install and build m-explore ROS2

    main

    The package is a standard ROS 2 colcon package targeting ROS 2 Humble and newer. There are no pre-built binaries available. Use rosdep to resolve dependencies within your ROS environment before building.

    # Build as a standard colcon package
    colcon build
  3. Run the autonomous exploration demo with TB3

    main

    To run the simulation demo with a TurtleBot3 (TB3), you must first install nav2 and the tb3_simulation.

    1. Set up the environment and launch the Nav2 stack with SLAM:
    export TURTLEBOT3_MODEL=waffle
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_gazebo/models
    ros2 launch nav2_bringup tb3_simulation_launch.py slam:=True
    1. Launch the exploration package:
    ros2 launch explore_lite explore.launch.py

    In RViz2, you can monitor the algorithm by adding the exploration frontiers marker on the explore/frontiers topic.

    export TURTLEBOT3_MODEL=waffle
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_gazebo/models
    ros2 launch nav2_bringup tb3_simulation_launch.py slam:=True
    
    ros2 launch explore_lite explore.launch.py
  4. Run the Multirobot Map Merge demo

    main

    1. Launch Simulation and SLAM

    Launch the simulation stack, Nav2, and SLAM for each robot:

    export TURTLEBOT3_MODEL=waffle
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_gazebo/models
    ros2 launch multirobot_map_merge multi_tb3_simulation_launch.py slam_gmapping:=True

    To use slam_toolbox instead, use slam_toolbox:=True (requires the experimental branch). To use unknown initial poses, add known_init_poses:=False to the launch command.

    2. Launch the Merging Node

    ros2 launch multirobot_map_merge map_merge.launch.py

    To use unknown initial poses, add known_init_poses:=False to the launch command.

    3. Visualize the Merged Map

    Open RViz2 using the provided configuration file:

    rviz2 -d <your/ros2_ws>/src/m-explore-ros2/map_merge/launch/map_merge.rviz
    # Step 1: Launch simulation
    export TURTLEBOT3_MODEL=waffle
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_gazebo/models
    ros2 launch multirobot_map_merge multi_tb3_simulation_launch.py slam_gmapping:=True
    
    # Step 2: Launch merging node
    ros2 launch multirobot_map_merge map_merge.launch.py
    
    # Step 3: Visualize
    rviz2 -d <your/ros2_ws>/src/m-explore-ros2/map_merge/launch/map_merge.rviz
  5. Setup SLAM for Multirobot Map Merge

    main

    The map merging logic currently requires slam_gmapping. Because the official ROS2 port lacks namespace support required for multi-robot setups, you must use a specific fork.

    Note: While slam_toolbox is supported, it requires an experimental branch of this repository (feature/slam_toolbox_compat).

    To install the compatible slam_gmapping:

    cd <your/ros2_ws/src>
    git clone https://github.com/charlielito/slam_gmapping.git --branch feature/namespace_launch
    cd ..
    colcon build --symlink-install --packages-up-to slam_gmapping
  6. Troubleshoot TB3 simulation issues

    main

    If the packaged TurtleBot3 simulations fail, replace them with the upstream repository to ensure compatibility:

    source /opt/ros/${ROS_DISTRO}/setup.bash
    export TURTLEBOT3_MODEL=waffle
    sudo rm -rf /opt/ros/${ROS_DISTRO}/share/turtlebot3_simulations
    sudo git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations /opt/ros/${ROS_DISTRO}/share/turtlebot3_simulations
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_simulations/turtlebot3_gazebo/models