Ubuntu18.04配置 ROS2 dashing+ gazebo9 + Turtlebot3
Ubuntu18.04配置 ROS2 dashing+ gazebo9 + Turtlebot3
- 预备工作
- 1.换源
- 2.配置Hosts
- 一、安装ros2 dashing
- 1. 设置语言环境
- 2.添加密钥
- 3.将存储库添加到源列表
- 4.安装ROS2包
- 5.安装argcomplete
- 6.Sourcing the setup script in .bashrc
- 7.安装额外的中间件
- 8.测试
- 二、安装Gazebo9
- 1.安装ROS2依赖包
- 2.update
- 3.安装gazebo
- 4.在虚拟机中,需要关闭硬件加速
- 5.测试
- 6.继续安装ROS2依赖包
- 三、安装turtlebot3
- 1.创建工作空间
- 2.下载
- 3.编译
- 4.添加环境变量
- 四、启动gazebo不同环境
- 1. 下载gazebo的模型,加速运行gazebo
- 2.需要删除.git目录,要不运行会出错
- 3.设置GAZEBO_MODEL_PATH变量, 指定机器人类型为burger
- 4.启动环境
预备工作
1.换源
# 首先备份源列表
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup# 打开sources.list文件
$ sudo gedit /etc/apt/sources.list# 在文件最前面添加阿里云镜像源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse# 刷新列表
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
2.配置Hosts
输入 sudo vim /etc/hosts
,在最后添加
$ 199.232.69.194 github.global.ssl.fastly.net
$ 185.199.111.133 raw.githubusercontent.com
注意:不要添加 140.82.112.3 github.com
,会影响后续安装
一、安装ros2 dashing
1. 设置语言环境
(1)设置环境[检查UTF-8]
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8
2.添加密钥
$ sudo apt update && sudo apt install curl gnupg2 lsb-release
$ curl http://repo.ros2.org/repos.key | sudo apt-key add -
3.将存储库添加到源列表
$ sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
4.安装ROS2包
$ sudo apt update && sudo apt install ros-dashing-desktop
5.安装argcomplete
$ sudo apt install python3-argcomplete
6.Sourcing the setup script in .bashrc
$ echo "source /opt/ros/dashing/setup.bash" >> ~/.bashrc
7.安装额外的中间件
如果我的记忆没有错乱,这个时间会挺久
$ sudo apt update
$ sudo apt install ros-dashing-rmw-opensplice-cpp # for OpenSplice
$ sudo apt install ros-dashing-rmw-connext-cpp # for RTI Connext (requires license agreement)
8.测试
# 新终端,运行talker例子(注意:新终端)
$ ros2 run demo_nodes_cpp talker
# 新终端,运行listener例子
$ ros2 run demo_nodes_py listener
出现以下内容,则说明ROS2安装成功
二、安装Gazebo9
1.安装ROS2依赖包
# Install Colcon
$ sudo apt install python3-colcon-common-extensions
# Install Cartographer dependencies
$ sudo apt install -y \google-mock \libceres-dev \liblua5.3-dev \libboost-dev \libboost-iostreams-dev \libprotobuf-dev \protobuf-compiler \libcairo2-dev \libpcl-dev \python3-sphinx
2.update
$ sudo apt-get update
3.安装gazebo
$ sudo apt install ros-dashing-gazebo-ros-pkgs
4.在虚拟机中,需要关闭硬件加速
$ echo " export SVGA_VGPU10=0" >> ~/.bashrc
$ source ~/.bashrc
5.测试
$ gazebo --verbose /opt/ros/dashing/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world
6.继续安装ROS2依赖包
# Install Cartographer
$ sudo apt install ros-dashing-cartographer
$ sudo apt install ros-dashing-cartographer-ros
# Install Navigation2
$ sudo apt install ros-dashing-navigation2
$ sudo apt install ros-dashing-nav2-bringup
# Install vcstool
$ sudo apt install python3-vcstool
对了,检查一下home
文件夹下,这个时候应该有了一个.gazebo
文件
三、安装turtlebot3
1.创建工作空间
$ mkdir -p ~/turtlebot3_ws/src
$ cd ~/turtlebot3_ws
2.下载
(注意:一定要选择dashing-devel的分支!!!乖乖听话,否则,会变得不幸)
下载以下三个项目,放在~/turtlebot3_ws/src
下边
$ https://github.com/ROBOTIS-GIT/turtlebot3/tree/dashing-devel$ https://github.com/ROBOTIS-GIT/turtlebot3_msgs/tree/dashing-devel$ https://github.com/ROBOTIS-GIT/turtlebot3_simulations/tree/dashing-devel$ (如需dqn,下载)git clone -b ros2 https://github.com/ROBOTIS-GIT/turtlebot3_machine_learning.git
3.编译
这个时候,你应该站在~/tb3_ws
$ colcon build --symlink-install
又是泪了,如果出现类似以下错误
缺啥install啥,比如我这缺dynamixel-sdk
,就执行以下命令,然后重新colcon build --symlink-install
$ sudo apt-get install ros-dashing-dynamixel-sdk
4.添加环境变量
$ echo 'source ~/tb3_ws/install/setup.bash' >> ~/.bashrc
$ echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
$ source ~/.bashrc
$ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
四、启动gazebo不同环境
1. 下载gazebo的模型,加速运行gazebo
$ cd ~/.gazebo/
# 下边两句建议用第二句,会更快
$ git clone https://github.com/osrf/gazebo_models models
$ git clone https://hub.fastgit.org/osrf/gazebo_models models
2.需要删除.git目录,要不运行会出错
$ rm -rf models/.git
3.设置GAZEBO_MODEL_PATH变量, 指定机器人类型为burger
$ echo 'export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/tb3_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models' >> ~/.bashrc
$ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
$ source ~/.bashrc
4.启动环境
(1)启动Fake Node
$ ros2 launch turtlebot3_fake_node turtlebot3_fake_node.launch.py
启动后弹出rviz,并显示小车模型
打开一个新的终端,启动键盘控制(下边示例,启动键盘同理)
$ ros2 run turtlebot3_teleop teleop_keyboard
(2)启动empty地图
新开终端,启动gezebo,并带有empty地图
$ ros2 launch turtlebot3_gazebo empty_world.launch.py
(3)启动world地图
新开终端,启动gezebo,并带有world地图
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
(4)启动house地图
新开终端,启动gezebo,并带有house地图
$ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
参考 linux下apt安装ROS2 Dashing
参考 Turtlebot3-ROS2入门教程
参考 ros2 dashing 安装gazebo
参考 ROS2初体验之SLAM与导航仿真
参考 ros2与turtlebot3仿真教程-启动gazebo不同环境
Ubuntu18.04配置 ROS2 dashing+ gazebo9 + Turtlebot3相关推荐
- Ubuntu18.04配置搭建基于Gazebo的虚拟仿真平台(Px4):无人机(UAV)、无人车等模拟实验平台
这篇我觉得是写得比较详细完整的 摘自:https://dgzc.ganahe.top/ganahe/2021/uavgazebomoni.html Ubuntu18.04配置搭建基于Gazebo的虚拟 ...
- Ubuntu18.04 配置nvidia 460驱动、cuda10.1和cudnn7.6.5
Ubuntu18.04 配置nvidia 460驱动.cuda10.1和cudnn7.6.5,并在同一系统中配置不同的CUDA版本以满足tensorflow版本的需求.以下源自各位大佬的博客,并进行整 ...
- Ubuntu18.04配置YCM
Ubuntu18.04和windows子系统Ubuntu18.04配置vim插件YoucompleteMe YouCompleteMe的安装麻烦程度也算是首屈一指了 目前安装配置方法一堆,坑太多,这里 ...
- Ubuntu18.04配置静态ip后发现ping不通百度
在用ubuntu18.04配置静态ip时发现重启虚拟机后发现虚拟机ping 不同百度.原因是因为重启虚拟机后/etc/resolv.conf文件被清空.导致没有域名服务,在ping百度时域名解析失败. ...
- Ubuntu18.04配置robotiq-2F-85
一.配置环境 操作系统:Ubuntu 18.04 夹爪型号:Robotiq 2F-85 转换线:RS485转USB 二.配置步骤 2.1创建robotiq工作空间,克隆代码包到新创建的src文件夹: ...
- Ubuntu18.04配置无人驾驶赛车游戏TORCS(解决找不到GL/glut.h、AL/alut.h和libXmu,以及编译中出现‘isnan’was not declared等)
Ubuntu18.04配置无人驾驶赛车游戏平台TORCS 一.资源下载TORCS<The Open Racing Car Simulator> 二.环境搭建 三.运行游戏与测试 菜菜的博主 ...
- 【Ubuntu】——ubuntu18.04配置静态ip
ubuntu18.04配置静态ip 要点: 1.root权限: 2.打开 /etc/netplan/01-network-manager-all.yaml 3.修改内容如下: 1.查找netplan目 ...
- Ubuntu18.04配置carla0.9.11踩坑与解决方法总结,同时解决安装carla-ros-bridge遇到的问题,并复现OpenCDA成功与ros关联
Ubuntu18.04配置carla0.9.11踩坑与解决方法总结,同时解决安装carla-ros-bridge遇到的问题,并复现OpenCDA成功与ros关联 背景: 主要是为了复现叶小飞的Open ...
- Centos7或ubuntu18.04配置公共邮箱或个人邮箱发报警邮件
系统:Ubuntu18.04配置方法 使用的软件:heirloom-mailx 亲测可用,这篇文章说的是配置邮箱,并发送邮件,具体报警邮件及脚本后续有空写 1.配置软件源 ubuntu18.04上无法 ...
最新文章
- xshell使用xftp传输文件、使用pure-ftpd搭建ftp服务
- python两个类共用一个变量_python – 如何从一个类到另一个类访问变量?
- 第二次冲刺每日站立会议03
- C语言仅在函数中可见,如何学习C语言、入门C语言,看这篇就够了
- 人的手臂的自由度的数目以及六自由度机械臂的限制
- 找出出现次数最多的字母
- ios UICollectionViewLayout 横向瀑布流
- 计算机通信技术的应用发展研究,计算机通信技术的发展与应用总结
- 学习笔记(4):《微电子器件》陈星弼(第四版)第2章 PN结
- XCVU9P收发卡设计资料原理图第612篇:基于XCVU9P的32路光纤PCIeX16收发卡
- 2022年QQ微信内置浏览器 UA 标识, Header 获取
- 直播知识点实录|百度大脑EasyDL产业应用系列 安全生产专场
- torch.backends.cudnn.benchmark的用法
- 理解类8583报文协议
- 【spark】RDD数据源
- 什么是多态,多态的实现
- *restrict 功能
- 删掉微信好友服务器还有吗,微信被删除的好友怎么找回来 在对方不知情的情况下找回已删除的微信好友教程...
- 2021-最新Web前端经典面试试题及答案-史上最全前端面试题(含答案)---手写代码篇
- 泛微ecology 修改在线预览附件 大小限制