一、环境配置
1.、依赖安装
前提是已经在ubuntu20.04上完成了ROS Noetic的安装
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_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ..
catkin_make
若git超时,可以尝试复制地址在浏览器打开下载,或下载我上传的资源
turtlebot3-master.zip-Ubuntu文档类资源-CSDN下载
turtlebot3_msgs-master.zip-Ubuntu文档类资源-CSDN下载
turtlebot3_simulations-master.zip-Ubuntu文档类资源-CSDN下载
为工作环境添加环境声明:
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
echo "source ~/catkin_turtlebot3/devel/setup.bash" >> ~/.bashrc
测试环境配置是否成功
echo $ROS_PACKAGE_PATH
env | grep TURTLEBOT3
?若两个命令出现对应的结果,则环境配置基本成功。
三、简单的仿真测试
1.启动RViz
roslaunch turtlebot3_fake turtlebot3_fake.launch
2.在rviz里通过teleop节点进行控制TurtleBot3机器人运动
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
?四、Gazebo仿真测试
roslaunch turtlebot3_gazebo turtlebot3_world.launch
?五、利用Gazebo和RViz进行建图
1.启用Gazebo
roslaunch turtlebot3_gazebo turtlebot3_world.launch
2.gmapping建图
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
3.打开键盘,控制turtlebot3四处移动,直到建图形成闭环
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
4.保存地图
rosrun map_server map_saver -f ~/map
六、仿真环境下的自主导航
1.启用Gazebo仿真地图
roslaunch turtlebot3_gazebo turtlebot3_world.launch
2.打开刚才保存的地图进行导航
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml
map_file:后面接上你存放地图的位置。
3.布置小车的位置和小车的目的地
?1.2D Pose Estimate
这个按键是控制放置小车初始位置的
2.2D Nav Goal
这个按键是控制小车的目的位置的
配置好起点与终点,小车会自动规划路径到达目标点。
?就此,简单的使用官方的仿真环境进行激光建图自主导航,完成!!!
下期将自己制作仿真环境,并且用于激光建图导航。
|