ROS 自主构图 使用turtlebot3仿真gmapping 学习记录

写在前面

Ros版本是ubuntu20.04上完成了ROS Noetic
参考
http://wiki.ros.org/explore_lite
https://blog.csdn.net/hanshuning/article/details/58143248

这个软件包提供了贪婪的前沿探索。当节点运行时,机器人将贪婪地探索其环境,直到找不到边界。移动命令将被发送到move_base。
与类似的软件包不同,explore_lite不创建自己的costmap,这使得配置更容易,效率更高(资源更轻)。Node只需订阅nav_msgs/OccupencyGrid消息。机器人移动命令被发送到移动基础节点。
可以在未遍历的地图上操作
先看效果 觉得不好就没必要看下面了

ROS 自主构图 使用turtlebot3仿真gmapping 学习记录

========================================================================================================================================================================================================================================================================================================================================================================================================================================++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

一、虚拟环境配置

1.相关功能包的配置

sudo apt install ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control
sudo apt-get install ros-noetic-turtlebot-*
sudo apt install ros-noetic-gmapping
sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc ros-noetic-rgbd-launch ros-noetic-depthimage-to-laserscan ros-noetic-rosserial-arduino ros-noetic-rosserial-python ros-noetic-rosserial-server ros-noetic-rosserial-client ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro  ros-noetic-compressed-image-transport ros-noetic-rqt-image-view ros-noetic-gmapping ros-noetic-navigation  ros-noetic-interactive-markers rviz

2.工作环境的建立

mkdir catkin_turtlebot3
cd catkin_turtlebot3
mkdir src
cd src 
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
cd ..
catkin_make

为工作环境添加变量

echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
echo "source ~/catkin_turtlebot3/devel/setup.bash" >> ~/.bashrc

然后检查是否配置好了

echo $ROS_PACKAGE_PATH
env | grep TURTLEBOT3

这样就差不多了
请添加图片描述

二、利用Gazebo和RViz进行自主建图

开启SLAM仿真

roslaunch turtlebot3_slam tur3_gmapping.launch 

里面launch文件是根据自己的工作环境来修改的

<launch>
  <!-- Arguments -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="configuration_basename" default="turtlebot3_lds_2d.lua"/>
  <arg name="set_base_frame" default="base_footprint"/>
  <arg name="set_odom_frame" default="odom"/>
  <arg name="set_map_frame"  default="map"/>
  <!-- gazebo -->
  <include file="$(find turtlebot3_gazebo)/launch/turtlebot3_world.launch" />
  <!-- Gmapping -->
  <node pkg="gmapping" type="slam_gmapping" name="turtlebot3_slam_gmapping" output="screen">
    <param name="base_frame" value="$(arg set_base_frame)"/>
    <param name="odom_frame" value="$(arg set_odom_frame)"/>
    <param name="map_frame"  value="$(arg set_map_frame)"/>
    <rosparam command="load" file="$(find turtlebot3_slam)/config/gmapping_params.yaml" />
  </node>
  <!-- Start move_base  -->
  <include file="$(find turtlebot3_navigation)/launch/move_base.launch" />
  <!--  rviz  -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find turtlebot3_gazebo)/rviz/turtlebot3_gazebo_model.rviz" required="true" />
  
</launch>

然后其动自主探索的lanch就行了

roslaunch explore_lite explore.launch

这个软件包提供了贪婪的前沿探索。当节点运行时,机器人将贪婪地探索其环境,直到找不到边界,要是没有边界的地图如何探索,比如一定开阔的地面?
**

为之奈何?

**

posted @ 2022-03-25 17:35  Yang-blackSun  阅读(105)  评论(0编辑  收藏  举报  来源
1 3