ROS2 MAC OS Install

ROS2 MAC OS Install(非原創),安裝過程記錄一下node

注意python

(1)若是安裝了anaconda,請將~/.bash_profile文件中的export PATH="/anaconda3/bin:$PATH"屏蔽,不然默認使用anaconda中的python,致使接下來安裝catkin_pkg錯誤。git

(2)須要注意tinyxml2的版本,在ROS 2 Bouncy Bolson的時候tinyxml2的版本要求是6,而macOS 10.14.1的tinyxml2是7,須要降版本。github

安裝bash

ROS2的安裝有兩種方式:Binary packages與Building from source,這裏選擇Binary packages安裝方式。測試

1. 安裝brew(通常必定安裝),參考https://brew.sh/網址。ui

安裝brew後,在Terminal中執行spa

$ brew doctor

修復一些錯誤。code

2. 安裝一些庫文件xml

$ brew install python3

# install asio and tinyxml2 for Fast-RTPS
$ brew install asio tinyxml2

# install dependencies for robot state publisher
$ brew install tinyxml eigen pcre poco

# OpenCV isn't a dependency of ROS 2, but it is used by some demos.
$ brew install opencv

# install OpenSSL for DDS-Security
$ brew install openssl

# install Qt for RViz
$ brew install qt freetype assimp

3. 安裝一些其餘的依賴褲

$ python3 -m pip install catkin_pkg empy git+https://github.com/lark-parser/lark.git@0.7b pyparsing pyyaml setuptools argcomplete

4. 關閉系統的SIP

重啓系統後,按住command+R鍵,進入Recovery OS,啓動Terminal,輸入

$ csrutil status

若是顯示:System Integrity Protection status: enabled.那麼須要關閉,在終端輸入

$ csrutil disable

關閉SIP

5. 下載ROS2

進入https://github.com/ros2/ros2/releases找到對應的版本,macOS應該下載到~/Downloads/ros2-package-osx-x86_64.tar.bz2。

解壓:

$ mkdir -p ~/ros2_install
$ cd ~/ros2_install
$ tar xf ~/Downloads/ros2-package-osx-x86_64.tar.bz2

6. 安裝DDS(Data Distribution Service)

若是須要OpenSplice的支持,那麼須要去 https://github.com/ADLINK-IST/opensplice/releases下載,而後解壓,在~/.bash_profile文件中文件中添加OSPL_HOME環境變量,路徑中必須包含release.com,如:

export OSPL_HOME=/Users/<name>/x86_64.darwin10_clang/

 若是須要RTI支持,那麼在https://www.rti.com/free-trial中下載一個30試用版本,安裝完成後,在~/.bash_profile文件中添加:

export NDDSHOME=/Applications/rti_connext_dds-5.3.1/

7. 設置ROS2

進入ROS2環境

$ . ~/ros2_install/ros2-osx/setup.bash

運行一個例子測試,在一個終端中運行:

$ ros2 run demo_nodes_cpp talker

在另外一個終端中運行:

$ ros2 run demo_nodes_cpp listener

8. 安裝vsc, colcon等

$ python3 -m pip install argcomplete catkin_pkg colcon-common-extensions coverage empy flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes mock nose pep8 pydocstyle pyflakes pyparsing setuptools vcstool

9. 參考:

https://index.ros.org/doc/ros2/OSX-Install-Binary/

相關文章
相關標籤/搜索