ROS2 package port for multi-robot autonomous exploration of m-explore. Currently tested on Eloquent, Dashing, Foxy, and Galactic distros.
m-explore-ros2-tb3_.mp4
jetbot-m-explore-ros2.mp4
No binaries yet.
Build as a standard colcon package. There are no special dependencies needed (use rosdep to resolve dependencies in ROS).
To run with a params file just run it with
ros2 run explore_lite explore --ros-args --params-file <path_to_ros_ws>/m-explore-ros2/explore/config/params.yaml
Install nav2 and tb3 simulation. You can follow the tutorial.
Then just run 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
And run this package with
ros2 launch explore_lite explore.launch.py
You can open rviz2 and add the exploration frontiers marker (topic is explore/frontiers
) to see the algorithm working and the frontier chosen to explore.
By default the exploration node will start right away the frontier-based exploration algorithm. Alternatively, you can stop the exploration by publishing to a False
to explore/resume
topic. This will stop the exploration and the robot will stop moving. You can resume the exploration by publishing to True
to explore/resume
.
The robot will return to its initial pose after exploration if you want by defining the parameter return_to_init
to True
when launching the node.
If you have trouble with TB3 in simulation, as we did, add these extra steps for configuring it.
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
Then you'll be able to run it.
This package works with known and unknown initial poses of the robots. It merges the maps of the robots and publishes the merged map. Some results in simulation are shown below.
This modality gives normally the best results. The original ROS1 code only supports slam_gmapping type of maps for the merge. The following shows the result with that.
map_merge_known.mp4
We also support using slam_toolbox in a yet experimental branch. The following demo shows the map merging using the currently supported and most used ROS2-SLAM library.
m-explore-slam-toolbox.mp4
It works better if the robots start very close (< 3 meters) to each other so their relative positions can be calculated properly.
map_merge_unknown.mp4
Because of the logic that merges the maps, currently as a straightforward port to ROS2 from the ROS1 version, the SLAM needs to be done using the ROS1 defacto slam option which is slam_gmapping, which hasn't been ported officially to ROS2 yet. There is an unofficial port but it lacks to pass a namespace to its launch file. For that, this repo was tested with one of the authors of this package's fork. You'll need to git clone to your workspace and build it with colcon.
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
Note: You could use slam_toolbox instead but you need to use this experimental branch which is still under development.
To spawn multiple robots, you need the nav2_gazebo_spawner
which does not come up with the nav2-bringup
installation. For that, install it with sudo apt install ros-${ROS_DISTRO}-nav2-gazebo-spawner
.
Note that was the case for release previous to humble
but since humble
release, this package is deprecated and a gazebo node is used for this. So, if you are using humble
or newer, you don't need to install it.
This repo has some config examples and launch files for running this package with 2 TB3 robots and a world with nav2. Nonetheless, they are only compatible with the galactic/humble distros and since some breaking changes were introduced in this distro, if you want to try it with another ros2 distro you'll need to tweak those param files for that nav2's distro version (which shouldn't be hard).
First, you'll need to launch the whole simulation stack, nav2 stacks and slam stacks per robot. For that just launch::
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
Now run the merging node:
ros2 launch multirobot_map_merge map_merge.launch.py
By default, the demo runs with known initial poses. You can change that by launching again both launch commands with the flag known_init_poses:=False
Then you can start moving each robot with its corresponding rviz2 interface by sending nav2 goals. To see the map merged just launch rviz2:
rviz2 -d <your/ros2_ws>/src/m-explore-ros2/map_merge/launch/map_merge.rviz
Note: If you want to use slam_toolbox, launch multirobot_map_merge
with the following flag instead: slam_toolbox:=True
. Remember to use the experimental branch mentioned above.
No wiki yet.
Packages are licensed under BSD license. See respective files for details.