依赖
- 安装环境依赖
sudo apt-get install -y ros-${ROS_DISTRO}-slam-gmapping \
ros-${ROS_DISTRO}-amcl \
ros-${ROS_DISTRO}-map-server \
ros-${ROS_DISTRO}-move-base \
ros-${ROS_DISTRO}-navigation \
ros-${ROS_DISTRO}-moveit* \
ros-${ROS_DISTRO}-turtlebot3* \
ros-${ROS_DISTRO}-multirobot-map-merge \
ros-${ROS_DISTRO}-octomap* \
ros-${ROS_DISTRO}-dynamic-edt-3d \
ros-${ROS_DISTRO}-teleop-twist-keyboard \
ros-${ROS_DISTRO}-costmap-* \
ros-${ROS_DISTRO}-behaviortree-cpp* \
cppad
- 配置环境
在.bashrc添加下面代码
export TURTLEBOT3_MODEL=${TB3_MODEL}
export TURTLEBOT3_MODEL=waffle_pi
使环境生效:
source .bashrc
- 下载
multi_robot
功能包及编译
cd ~ && mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/GJXS1980/multi_robot.git
cd .. && catkin_make
多机器人建图功能
1.在TurtleBot3 House中启动三个TurtleBot3
roslaunch turtlebot3_gazebo multi_turtlebot3.launch
2.执行SLAM,终端1:
roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_0
终端2:
roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_1
终端3:
roslaunch turtlebot3_gazebo multi_turtlebot3_slam.launch ns:=tb3_2
3.合并来自每个TurtleBot3的地图数据:
roslaunch turtlebot3_gazebo multi_map_merge.launch
4.启动rviz:
rosrun rviz rviz -d `rospack find turtlebot3_gazebo`/rviz/multi_turtlebot3_slam.rviz
5.键盘控制:
控制第一个机器人建图
rosrun turtlebot3_teleop turtlebot3_teleop_key cmd_vel:=tb3_0/cmd_vel
控制第二个机器人建图
rosrun turtlebot3_teleop turtlebot3_teleop_key cmd_vel:=tb3_1/cmd_vel
控制第三个机器人建图
rosrun turtlebot3_teleop turtlebot3_teleop_key cmd_vel:=tb3_2/cmd_vel
6.保存地图
rosrun map_server map_saver -f ~/map
7.修改 map.yaml 中的 origin 为:
origin: [0.000000, 0.000000, 0.000000]
多机器人建图测试Demo
多机器人导航功能
1.启动多机器人模型:
roslaunch turtlebot3_gazebo multi_turtlebot3.launch
2.启动多机器人导航
cd ~/catkin_ws
source devel/setup.bash
roslaunch turtlebot3_navigation multi_nav_bringup.launch
3.导航点设置
在rviz上面点击2D Nav
给定机器人目标点,完成导航。
多机器人导航测试Demo
评论区