Linux从源代码安装ROS,ROS2入门教程-linux下源码安装

ROS2入门教程-linux下安装ROS2(源码安装)

说明:

介绍如何Linux系统上源码安装ROS2

系统要求

建议使用Ubuntu 16.04 LTS (64位)

确保有一个支持UTF-8的locale设置。locale设置例子如下:

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

创建开发环境

添加仓库:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116

安装相关的工具包

sudo apt update && sudo apt install -y

build-essential

git

python3-colcon-common-extensions

python3-pip

python-rosdep

python3-vcstool

wget

# install some pip packages needed for testing

sudo -H python3 -m pip install -U

argcomplete

flake8

flake8-blind-except

flake8-builtins

flake8-class-newline

flake8-comprehensions

flake8-deprecated

flake8-docstrings

flake8-import-order

flake8-quotes

pytest-repeat

pytest-rerunfailures

# [Ubuntu 16.04] install extra packages not available or recent enough on Xenial

python3 -m pip install -U

pytest

pytest-cov

pytest-runner

setuptools

# install Fast-RTPS dependencies

sudo apt install --no-install-recommends -y

libasio-dev

libtinyxml2-dev

下载源码

创建工作空间并进行下载

mkdir -p ~/ros2_ws/src

cd ~/ros2_ws

wget https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos

vcs-import src < ros2.repos

Note: if you want to get all of the latest bug fixes then you can try the "tip" of development by replacing release-latest in the URL above with master. The release-latest is preferred by default because it goes through more rigorous testing on release than changes to master do. See also Maintaining a Source Checkout.

用rosdep安装依赖项

sudo rosdep init

rosdep update

rosdep install --from-paths src --ignore-src --rosdistro bouncy -y --skip-keys "console_bridge fastcdr fastrtps libopensplice67 rti-connext-dds-5.3.1 urdfdom_headers"

使用ament工具进行编译

编译所有包

src/ament/ament_tools/scripts/ament.py build --build-tests --symlink-install

测试

运行talker-listener例子测试是否成功安装

打开.bashrc文件在末尾添加ROS2的环境变量

source ~//setup.bash

新终端,执行以下命令:

ros2 run demo_nodes_cpp talker

新终端,执行以下命令:

ros2 run demo_nodes_cpp listener

测试成功截图

ros2-talkerdemo.png

参考资料

https://github.com/ros2/ros2/wiki/Linux-Install-Debians#setup-sources

https://github.com/ros2/ros2/wiki/Ament-Tutorial

https://github.com/ros2/ros2/wiki/Linux-Development-Setup

http://blog.csdn.net/xmy306538517/article/details/78770646

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值