Turtlebot3仿真环境搭建
一、安装TurtleBot3机器人
cd ~/catkin_ws/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_ws
rosdep install --from-paths src -i -y
catkin_make
二、设置环境
1.设置环境变量
echo "source ~/catkin_ws/devel/setup.bash " >> ~/.bashrc
source ~/.bashrc
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
source ~/.bashrc
(根据所选用的TurtleBot3机器人是Burger还是Waffle,将其作为环境变量加入~/.bashrc文件,以方便后续使用。否则每次运行程序都需要先输入export TURTLEBOT3_MODEL=burger或者export
TURTLEBOT3_MODEL=waffle)
2.检查环境变量是否设置成功
env | grep TURTLEBOT3
(如显示TURTLEBOT3_MODEL=burger则表示成功)
三、简单仿真测试
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
六、导航
打开刚才保存的地图进行导航
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.ya
参考资料
https://www.jianshu.com/p/014552bcc04c
https://blog.csdn.net/u010853356/article/details/79226764
https://blog.csdn.net/qq_15052199/article/details/100765781
来源:CSDN
作者:田田田ty
链接:https://blog.csdn.net/qq_44725448/article/details/103482881