zoukankan      html  css  js  c++  java
  • 20.04搭建ROS2


    1)修改源文件source.list为阿里云

    deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

    2)卸载全部ros:

    sudo apt-get autoremove --purge ros-*

    3)设置编码

    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

    4)添加key

    sudo apt update && sudo apt install curl gnupg2 lsb-release

    WINDOWS下打开并下载https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc
    把文件另存为ros.asc文件,然后用U盘传到ubuntu系统,然后在文件录下运行命令行:

    sudo apt-key add ros.asc

    5)添加ros源

    sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://mirror.tuna.tsinghua.edu.cn/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'

     6)删除sources.list.d其他的源

    7)安装ros

    sudo apt update
    sudo apt install ros-foxy-desktop

    8)加载ros2

    source /opt/ros/foxy/setup.bash

    9) 自动补全

    sudo apt install python3-argcomplete

     10)安装开发工具和ros工具

    sudo apt update && sudo apt install -y \
      build-essential \
      cmake \
      git \
      python3-colcon-common-extensions \
      python3-pip \
      python3-rosdep \
      python3-vcstool \
      wget
    python3 -m pip install -U \
    argcomplete \
    flake8-blind-except \
    flake8-builtins \
    flake8-class-newline \
    flake8-comprehensions \
    flake8-deprecated \
    flake8-docstrings \
    flake8-import-order \
    flake8-quotes \
    pytest-repeat \
    pytest-rerunfailures \
    pytest
    sudo apt install --no-install-recommends -y \
    libasio-dev \
    libtinyxml2-dev
    sudo apt install --no-install-recommends -y \
    libcunit1-dev

    11)加入到bashrc: 

    echo “source /opt/ros/foxy/setup.bash” >> ~/.bashrc

    12)测试验证

    新开终端,发布话题

    source /opt/ros/foxy/setup.bash
    ros2 run demo_nodes_cpp talker

    新开终端,订阅话题

    source /opt/ros/foxy/setup.bash
    ros2 run demo_nodes_py listener

    坑1RMW问题需要添加环境变量

    export RMW_IMPLEMENTATION=rmw_connext_cpp

     坑2注意用户下的.bash文件

  • 相关阅读:
    arcgis使用python,做arctoolbox,渔网裁剪gdb里的要素,四等分
    arcgis计算中心点的质心XY,并根据属性Label进行标注。
    arcpy对要素类每个图斑批量出图。
    python安装模块wheel步骤
    arcgis中shp文件的字符串string型字段转换为日期型Date格式。如“20190426”转为“2019/4/26”
    .tar.gz海量遥感影像解压
    python压缩解压文件(天地图切片批量解压缩)
    python读取多层嵌套文件夹中的文件(zip文件嵌套在不同层级的文件夹中)
    使用Binding时关于数据更新的注意事项
    滑动列表底部自动加载下一页。修改旧代码ing
  • 原文地址:https://www.cnblogs.com/baolixin/p/15697621.html
Copyright © 2011-2022 走看看