Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真

1. 下载安装包

官网地址:
http://wiki.ros.org/action/show/Robots/TurtleBot?action=show&redirect=TurtleBot
所有相关的包都在这里, 按需下载(注意选择melodic-devel分支):
Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第1张图片

我全部下载了, 所有的下载链接如下:

  • turtlebot3: https://github.com/ROBOTIS-GIT/turtlebot3/tree/melodic-devel
  • turtlebot3_msgs: https://github.com/ROBOTIS-GIT/turtlebot3_msgs/tree/melodic-devel
  • turtlebot3_simulations: https://github.com/ROBOTIS-GIT/turtlebot3_simulations/tree/melodic-devel
  • turtlebot3_applications: https://github.com/ROBOTIS-GIT/turtlebot3_applications/tree/melodic-devel
  • turtlebot3_autorace: https://github.com/ROBOTIS-GIT/turtlebot3_autorace/tree/melodic-devel
  • hls_lfcd_lds_driver: https://github.com/ROBOTIS-GIT/hls_lfcd_lds_driver/tree/melodic-devel
  • open_manipulator: https://github.com/ROBOTIS-GIT/open_manipulator/tree/melodic-devel
  • dynamixel_sdk: https://github.com/ROBOTIS-GIT/DynamixelSDK/tree/melodic-devel

Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第2张图片

下载完成后解压, 并重命名把后面的"-melodic-devel"删掉(不重命名也不影响, 只是我有强迫症), 然后把这些文件夹放到一个文件夹下, 方便后面的操作:

Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第3张图片

2. 安装

Ctrl+Alt+T 打开终端, 输入:

echo $ROS_PACKAGE_PATH

/opt/ros/melodic/share为ROS包的路径, 现在我们把这些解压后的文件夹复制到这个路径下:
先cd到你放那些包的文件夹下,

sudo chmod 755 -R *
sudo cp -r * /opt/ros/melodic/share/

看看复制成功没有

ls /opt/ros/melodic/share/

3. 验证和仿真

运行rospack list, 有我们安装的那些包就行了

rospack list

部分截图如下:
Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第4张图片

我们来运行仿真:

roslaunch turtlebot3_gazebo turtlebot3_world.launch

Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第5张图片

报了错误:

RLException: Invalid tag: environment variable 'TURTLEBOT3_MODEL' is not set.

Arg xml is
The traceback for the exception was written to the log file

TURTLEBOT3_MODEL没有设置, 需要给它指定[burger, waffle, waffle_pi]中的一个, 我们随便指定一个:
在终端输入:

export TURTLEBOT3_MODEL=burger

再次运行上面的命令:

roslaunch turtlebot3_gazebo turtlebot3_world.launch

等待一会儿, 看, 我们的TurtleBot3 Burger和一些障碍物出现了:
Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第6张图片

Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真_第7张图片

最后我们把"export TURTLEBOT3_MODEL=burger"添加到.bashrc文件, 免得每次重新设置这个变量:

echo "export TURTLEBOT3_MODEL=burger" >>  ~/.bashrc

此文原创禁止转载,转载文章请联系博主并注明来源和出处,谢谢!
作者: Raina_RLN https://www.cnblogs.com/raina/

你可能感兴趣的:(Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真)