Visual Studio 2017がインストール済みの環境で確認してください。
以下のページの指示に従いインストールします。
以下のコマンドでインストールします。
> choco install -y python
以下からWin64OpenSSL-1_0_2r.exeを入手して、それを実行してインストールします。
以下の環境変数を設定します。
OPENSSL_CONF | C:\OpenSSL-Win64\bin\openssl.cfg |
環境変数PATHにC:\OpenSSL-Win64\binを追加します。
以下のページからNuGetパッケージ(.nupkg)ファイルをダウンロードしてください。
以下のコマンドでインストールします。依存するNugetパッケージが増える場合もあるようなので、適宜変更してください。
> choco install -y -s <'''ダウンロードしたパス'''> asio eigen tinyxml-usestl tinyxml2 log4cxx
以下のコマンドでインストールします。
> python -m pip install -U catkin_pkg empy pyparsing pyyaml setuptools
以下のページからros2-crystal-20190314-windows-release-amd64.zipをダウンロードします。
C:\dev\ros2等に展開して完了です。
CMake実行前にROS2の環境を設定するスクリプトを実行します。
> call C:\dev\ros2\local_setup.bat
CMake実行時にFASTRTPS_ENABLE、ROS2_ENABLEのオプションをONにします。
> cmake -DORB_ROOT=C:/workspace/omniORB-4.2.3-win64-vc14 -DCORBA=omniORB -G "Visual Studio 15 2017" -A x64 -DFASTRTPS_ENABLE=ON -DROS2_ENABLE=ON ..
その他の手順は通常と同じです。
適当な場所にインストールしてください。
インストールするディレクトリはCMAKE_INSTALL_PREFIXのオプションで設定します。
> cmake .. -DCMAKE_INSTALL_PREFIX=C:/workspace/OpenRTM-aist/build_omni/install > cmake --build . --config Release --target install
<'インストールしたパス'>\2.0.0\Components\C++\Examples\vc14のサンプルコンポーネントを実行します。
以下の内容のrtc.confを作成してください。
manager.modules.load_path: {インストールしたパス}\\2.0.0\\ext\\transport manager.modules.preload: FastRTPSTransport.dll, ROS2Transport.dll manager.components.preconnect: ConsoleOut0.in?interface_type=fast-rtps&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter, ConsoleIn0.out?interface_type=fast-rtps&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter manager.components.preactivation: ConsoleOut0, ConsoleIn0
ROS/ROS2用のシリアライザと対応するROS/ROS2メッセージ型の関係を以下のリンクで示します。
コネクタの生成はmanager.components.preconnectオプションにより設定します。 この例ではConsoleOut0コンポーネントのinのポート、ConsoleIn0コンポーネントのoutのポートにそれぞれコネクタを生成しています。
実行前に環境変数PATHに以下を追加する必要があります。
ConsoleInComp.exe、ConsoleOutComp.exeを実行すると通信ができるようになります。
以下のコマンドでインストールします。
$ curl http://repo.ros2.org/repos.key | sudo apt-key add - $ sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' $ export ROS_DISTRO=crystal $ sudo apt update $ sudo apt install ros-${ROS_DISTRO}-ros-core
ROS2用にbashの設定を以下のように行います。(次回以降のbash起動時の設定と、現在実行中のbashの設定を行います。)
echo "source /opt/ros/crystal/setup.bash" >> ~/.bashrc source ~/.bashrc
CMake実行時にFASTRTPS_ENABLE、ROS2_ENABLEのオプションをONにします。
$ cmake -DCORBA=omniORB -DCMAKE_BUILD_TYPE=Release -DFASTRTPS_ENABLE=ON -DROS2_ENABLE=ON ..
その他の手順は通常と同じです。
ビルド後にインストールしてください。
$ cmake --build . --target install
以下のrtc.confを作成します。
manager.modules.load_path: /usr/local/lib/openrtm-2.0/transport/ manager.modules.preload: FastRTPSTransport.so, ROS2Transport.so manager.components.preconnect: ConsoleOut0.in?interface_type=fast-rtps&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter, ConsoleIn0.out?interface_type=fast-rtps&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter manager.components.preactivation: ConsoleOut0, ConsoleIn0
OpenRTM-aistのシリアライザが対応しているメッセージ型を以下に示します。
RTCを起動して動作確認します。
それぞれ別のターミナルから起動してください。
/usr/local/share/openrtm-2.0/components/c++/examples/ConsoleInComp
/usr/local/share/openrtm-2.0/components/c++/examples/ConsoleOutComp
執筆中
以下のコマンドでインストールします。
$ curl http://repo.ros2.org/repos.key | sudo apt-key add - $ sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' $ export ROS_DISTRO=crystal $ sudo apt update $ sudo apt install ros-${ROS_DISTRO}-desktop
ROS2の環境設定のbashを実行するようにします。
$ echo "source /opt/ros/crystal/setup.bash" >> ~/.bashrc $ source ~/.bashrc
執筆中
OpenRTM-aist Python版のソースコードを入手してください。
以下のコマンドでOpenRTM-aist Python版をビルド/インストールしてください。
$ python setup.py build $ python setup.py install
ros2のsetup.bashを実行するとPYTHONPATHが上書きされるようなので以下のコマンドを実行する。
$ export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages $ export PATH=$PATH:/usr/local/lib/python3.6/site-packages/
omniORBpyがインストールされているディレクトリにあわせて変更してください。
以下のようなrtc.confを作成し、ROS2Transport.pyをロードし、インターフェース型にros2、シリアライザにros2:std_msgs/Float32を指定して起動するように指定します。
manager.modules.load_path: /usr/local/lib/python3.6/site-packages/OpenRTM_aist/ext/transport/ROS2Transport/ manager.modules.preload: ROS2Transport.py manager.components.preconnect: ConsoleOut0.in?interface_type=ros2&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter, ConsoleIn0.out?interface_type=ros2&marshaling_type=ros2:std_msgs/Float32&fastrtps.topic=chatter
OpenRTM-aistのシリアライザが対応しているメッセージ型を以下に示します。
以下のコマンドでRTCを起動して動作確認してください。
$ python /usr/local/share/openrtm-2.0/components/python/SimpleIO/ConsoleIn.py
$ python /usr/local/share/openrtm-2.0/components/python/SimpleIO/ConsoleOut.py