抛弃ros1 转战ros2

本文共有17807个字,关键词:ros

2019-12-06T09:37:29.png

Ubuntu18 安装 ros2

# 您将需要在系统中添加ROS 2 apt存储库。为此,请首先使用如下所示的apt授权我们的GPG密钥:
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

# 然后将存储库添加到您的源列表中:
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'

# 设置存储库后,更新您的apt存储库缓存。
sudo apt update

# 桌面安装(推荐):ROS,RViz,演示,教程。
sudo apt install ros-eloquent-desktop #eloquent
sudo apt install ros-dashing-desktop #dashing

# ROS-Base安装(裸露的骨头):通信库,消息包,命令行工具。没有GUI工具。
sudo apt install ros-eloquent-ros-base #eloquent
sudo apt install ros-dashing-ros-base #dashing

# 加入环境变量
source /opt/ros/eloquent/setup.bash #eloquent
source /opt/ros/dashing/setup.bash #dashing

# ROS 2命令行工具使用argcomplete自动完成。因此,如果要自动补全,则必须安装argcomplete。
sudo apt install python3-argcomplete

# 安装自动编译工具colcon
sudo apt install python3-colcon-common-extensions

尝试一些例子

在一个终端中,获取安装文件的源,然后运行talker:

ros2 run demo_nodes_cpp talker

在另一个终端源中,安装文件,然后运行listener:

ros2 run demo_nodes_py listener

与ros1共存

同一个termial不能同时导入ros1和ros2的source需要的文件,所以写了个小app通过点击不同图标,加载不同环境
ros_terminator_app.zip


windows10 上 安装ros2 (劝退)

安装依赖

安装Chocolatey及其他依赖

关闭杀毒软件,使用管理员身份运行 powershell

# Chocolatey是Windows的软件包管理器,先安装它
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# 安装python
choco install -y python --version 3.7.5


# 安装 Visual C++
choco install -y vcredist2013 vcredist140

安装OpenSSL

打开 https://slproweb.com/products/Win32OpenSSL.html 下载安装 Win64 OpenSSL v1.1.1d
注意不要下载 win32 或者 Light 版本
默认配置安装

  • 运行setx -m OPENSSL_CONF "C:\Program Files\OpenSSL-Win64\bin\openssl.cfg"
  • 环境变量PATH追加 C:\Program Files\OpenSSL-Win64\bin

安装 Visual Studio 2019

https://visualstudio.microsoft.com/downloads/

安装 ADLINK OpenSplice (OSPL)

https://github.com/ADLINK-IST/opensplice/releases
安装 *.win-vs2019-installer.zip 或者以后版本,和上面vs2019对应
解压到 C:\OSPL
运行 setx -m OSPL_HOME "C:\OSPL"

安装 RTI Connext

注册得到并下载许可证 https://www.rti.com/free-trial-5.3.1
下载最新版本并安装 https://www.rti.com/free-trial/dds-files#6.0.0
运行 setx -m NDDSHOME "C:\Program Files\rti_connext_dds-6.0.0"

安装 opencv

https://github.com/ros2/ros2/releases/download/opencv-archives/opencv-3.4.6-vc16.VS2019.zip
解压到 c:\opencv
运行 setx -m OpenCV_DIR "C:\opencv"
环境变量PATH追加 C:\opencv\x64\vc16\bin

安装依赖

choco install -y cmake
环境变量PATH追加 C:\Program Files\CMake\bin

下载里面所有nupkg包 https://github.com/ros2/choco-packages/releases/latest
安装,需要把改成实际下载后文件夹路径
choco install -y -s <DOWNLOADS> asio cunit eigen tinyxml-usestl tinyxml2 log4cxx

还要安装一些 python 依赖
python -m pip install -U catkin_pkg cryptography empy ifcfg lark-parser lxml netifaces numpy opencv-python pyparsing pyyaml setuptools

安装 pyqt
python -m pip install -U pydot PyQt5

安装 ROS2

https://github.com/ros2/ros2/releases
下载 *windows-release-amd64.zip 并 解压到 D:\ros2

运行

使用cmd运行 powershell 貌似不行

# 调用加载终端环境
call D:\ros2\local_setup.bat
ros2 run demo_nodes_cpp talker

结果

失败,全部按照官网的教程操作,
起初运行call D:\ros2\local_setup.bat提示warnningADLINK OpenSpliceRTI Connext 没安装,
ros2 run demo_nodes_cpp talker 执行报错

安装 ADLINK OpenSplice 后还提示RTI Connext没安装
ros2 run demo_nodes_cpp talker 任然报错

全部安装后call D:\ros2\local_setup.bat 没有任何输出
ros2 run demo_nodes_cpp talker 任然报错

报错内容大概是

Failed to load entry point 'test': No module named 'lark'
Failed to load entry point 'launch': No module named 'lark'
Failed to load entry point 'info': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'send_goal': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'show': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'play': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'record': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'load': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'standalone': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'types': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'unload': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'start': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'status': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'stop': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': No module named 'numpy'
Failed to load entry point 'package': No module named 'numpy'
Failed to load entry point 'packages': No module named 'numpy'
Failed to load entry point 'proto': No module named 'numpy'
Failed to load entry point 'show': No module named 'numpy'
Failed to load entry point 'get': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'nodes': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'set': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'info': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'delete': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'describe': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'dump': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'get': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'set': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'create': No module named 'catkin_pkg'
Failed to load entry point 'create_key': No module named 'cryptography'
Failed to load entry point 'create_keystore': No module named 'cryptography'
Failed to load entry point 'create_permission': No module named 'cryptography'
Failed to load entry point 'distribute_key': No module named 'cryptography'
Failed to load entry point 'generate_artifacts': No module named 'cryptography'
Failed to load entry point 'generate_policy': No module named 'lxml'
Failed to load entry point 'list_keys': No module named 'cryptography'
Failed to load entry point 'call': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'find': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'type': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'bw': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'delay': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'echo': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'find': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'hz': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'info': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'list': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'pub': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions
Failed to load entry point 'type': DLL load failed: 找不到指定的模块。
The C extension 'D:\ros2\Lib\site-packages\rclpy\_rclpy.pyd' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions

系统提示框弹出错误 由于找不到VCRUNTIME140_1.dll, 无法继续执行代码. 重新安装程序可能会解决此问题.

结论

老老实实在Ubuntu上运行吧.windows配置极其麻烦,而且还用不了
就算能用, 系统层面还有很多 不通用的地方,极其麻烦.懒得搞了, 放弃.

「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」

pch18

(๑>ڡ<)☆谢谢老板~

使用微信扫描二维码完成支付

版权声明:如无特别说明,本文为作者原创,转载请在首行注明来源:https://pch18.cn/archives/300.html
添加新评论
已有 2 条评论
  1. JOhn:

    ros2 apt-get安装太慢, 有何解决方案?

    1. pch18: 回复 @JOhn

      试试别的镜像站