ここではOpenRTM-aist(Python)のインストール方法を説明します。
MSIインストーラーによるOpenRTM-aistのインストール手順については下記のページに記載。
RTCの開発にはCMake、Doxygen、Visual Studioのインストールが必要です。
インストーラーは以下の作業を行います。
RTM_BASE=C:\Program Files\OpenRTM-aist\ RTM_ROOT=C:\Program Files\OpenRTM-aist\1.2.1\ RTM_VC_VERSION= //ここにはユーザーが指定したVisual StudioにのっとったVCのバージョンを指定するテキストが入ります RTM_JAVA_ROOT=C:\Program Files\OpenRTM-aist\1.2.1\ OMNI_ROOT=C:\Program Files\OpenRTM-aist\1.2.1\omniORB\4.2.3_%RTM_VC_VERSION%\ OpenCV_DIR=C:\Program Files\OpenRTM-aist\1.2.1\OpenCV3.4\ OpenRTM_DIR=C:\Program Files\OpenRTM-aist\1.2.1\cmake\
C:\Program Files\OpenRTM-aist\1.2.1\bin\%RTM_VC_VERSION%\ C:\Program Files\OpenRTM-aist\1.2.1\omniORB\4.2.1_%RTM_VC_VERSION%\bin\x86_win32\ C:\Program Files\OpenRTM-aist\1.2.1\OpenCV3.4\%RTM_VC_VERSION%\bin\
RTM_BASE=C:\Program Files (x86)\OpenRTM-aist\ RTM_ROOT=C:\Program Files (x86)\OpenRTM-aist\1.2.1\ RTM_VC_VERSION= //ここにはユーザーが指定したVisual StudioにのっとったVCのバージョンを指定するテキストが入ります RTM_JAVA_ROOT=C:\Program Files (x86)\OpenRTM-aist\1.2.1\ OMNI_ROOT=C:\Program Files\OpenRTM-aist\1.2.1\omniORB\4.2.3_%RTM_VC_VERSION%\ OpenCV_DIR=C:\Program Files\OpenRTM-aist\1.2.1\OpenCV3.4\ OpenRTM_DIR=C:\Program Files\OpenRTM-aist\1.2.1\cmake\
C:\Program Files(x86)\OpenRTM-aist\1.2.1\bin\%RTM_VC_VERSION%\ C:\Program Files(x86)\OpenRTM-aist\1.2.1\omniORB\4.2.3_%RTM_VC_VERSION%\bin\x86_win32\ C:\Program Files(x86)\OpenRTM-aist\1.2.1\OpenCV3.4\x86\%RTM_VC_VERSION%\bin\
ファイルは以下のような構造でインストールされます。
<install_dir> + OpenRTM-aist + 1.x.x :旧バージョンのランタイム + 1.2.1 + bin: dll、lib各種コマンド + cmake: OpenRTMConfig.cmake + coil: coilヘッダファイル + Components + C++ + Examples: C++サンプルコンポーネント + OpenCV: OpenCVのC++サンプルコンポーネント + Java: Java サンプルコンポーネント + Python: Python サンプルコンポーネント + etc: rtc.confサンプル + jar: jarファイル + jre: OpenJDK JRE + omniORB + OpenCV3.4 + rtm: OpenRTM-aistヘッダファイル + ext: 拡張モジュール用ファイル + idl: OpenRTM-aistIDLファイル + util + ExcelControlpy: PythonベースのMicrosoft Office用RTC + OpenRTP: RTCBuilderとRTSystemEditorツール + PowerPointControlpy: Microsoft Office PowerPoint用RTC + python_dist: pythonベースツール共通ライブラリ + RTCDT: PythonベースRTCの開発を支援するツール + rtc-template: RTCBuilderと似た機能を提供する古いツール + RTSystemEditor: RTSystem Editorのみのファイル + VCVerChanger: 使用しているVisual Studioのバージョンを指定するツール + WordContrlpy: PythonベースMicrosoft Office Word用RTC
Python版のOpenRTM-aistは、UbuntuやDebian GNU Linuxで利用可能なdebパッケージが提供されています。 対応しているディストリビューションのバージョンは、ダウンロードページで確認できます。 Ubuntu/Debian GNU Linuxへのサポートバージョンや対応の有無は、予告なしに変更されることがありますので、あらかじめご了承ください。
openrtm.orgが提供するインストール・スクリプトpkg_install_ubuntu.shまたはpkg_install_debian.shを指定のURLからダウンロードし、root権限で実行します。このスクリプトでは必要なパッケージを順次apt-getを用いてインストールしていきます。
オプションを指定することで、目的に合わせたパッケージをインストールすることが可能です。
一括インストールスクリプトのダウンロードや詳しいインストール方法、指定可能なオプションの種類につきましては、「一括インストールスクリプト」のページをご確認ください。
※最新バージョンが「1.2.2」である場合は、オプション指定で「1.2.1」のインストール、「1.2.2」から「1.2.1」へのダウングレードができます。
一括インストールスクリプトは、ダウンロードした後、ダウンロード先ディレクトリに移動し、
Ubuntuの場合は
$ sudo sh pkg_install_ubuntu.sh -l python --yes
# sh pkg_install_debian.sh -l python --yes
一般的なUbuntu/Debian環境での開発にはRTCBuilderやRTSystemEditorを使用しますが、その場合にはOpenRTPが必要です。一括インストールスクリプトを用いてOpenRTPをインストールしてください。Ubuntuではpkg_install_ubuntu.shが置いてあるディレクトリで
Ubuntuの場合は
$ sudo sh ./pkg_install_ubuntu.sh -l openrtp --yes
Debianの場合はsuでroot権限を得た後に
# sh pkg_install_debian.sh -l openrtp --yes
と入力するとOpenRTPをインストールできます。
制御コンピュータが小規模のシステムの場合など、CUIでRTCを制御したい場合にはOpenRTPのRTSystemEditor相当の機能をCUIから実行できるようなツールとしてrtshellと呼ばれるツールが提供されています。rtshellのインストールは一括インストールスクリプトを用いて、一括インストールスクリプト・ファイルが置かれているディレクトリで
Ubuntuの場合は
$ sudo sh pkg_install_ubuntu.sh -l rtshell --yes $ sudo rtshell_post_install
# sh pkg_install_debian.sh -l rtshell --yes # rtshell_post_install
でインストールできます。
インストールを確認します。(下記は1.2.1の例です。)
$ dpkg -l 'openrt*' 要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)保持 | 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール/(W)トリガ待ち/(T)トリガ保留 |/ エラー?=(空欄)無/(R)要再インストール (状態,エラーの大文字=異常) ||/ 名前 バージョン アーキテクチャ 説明 +++-=============================-===================-===================-=============================================================== ii openrtm-aist:amd64 1.2.1-0 amd64 OpenRTM-aist, RT-Middleware distributed by AIST ii openrtm-aist-dev:amd64 1.2.1-0 amd64 OpenRTM-aist headers for development ii openrtm-aist-idl:amd64 1.2.1-0 amd64 OpenRTM-aist idls for development ii openrtm-aist-python 1.2.1-0 amd64 OpenRTM-aist, RT-Middleware distributed by AIST ii openrtm-aist-python-doc 1.2.1-0 all Documentation for openrtm-aist-python ii openrtm-aist-python-example 1.2.1-0 amd64 OpenRTM-aist-Python examples ii openrtp:amd64 1.2.1-0 amd64 OpenRTP, Open RT Platform distributed by AIST
インストールを確認します。(下記は1.2.1の例です。)
$ dpkg -l 'openrt*' 要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)保持 | 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール/(W)トリガ待ち/(T)トリガ保留 |/ エラー?=(空欄)無/(R)要再インストール (状態,エラーの大文字=異常) ||/ 名前 バージョン アーキテクチャ 説明 +++-=============================-===================-===================-=============================================================== ii openrtm-aist-python 1.2.1-0 amd64 OpenRTM-aist, RT-Middleware distributed by AIST ii openrtm-aist-python-doc 1.2.1-0 all Documentation for openrtm-aist-python ii openrtm-aist-python-example 1.2.1-0 amd64 OpenRTM-aist-Python examples
rtshellのインストールは
$ pip show rtshell-aist Name: rtshell-aist Version: 4.2.2 Summary: Shell commands for managing RT Components and RT Systems. Home-page: http://github.com/gbiggs/rtshell Author: Geoffrey Biggs and contributors Author-email: geoffrey.biggs@aist.go.jp License: LGPL3 Location: /usr/local/lib/python2.7/dist-packages Requires: rtctree-aist, rtsprofile-aist
各パッケージの内容は以下の通りです。
openrtm-aist にはランタイムライブラリとコマンド群が含まれています。
/usr/bin/rtcd /usr/bin/rtcprof /usr/bin/rtm-config /usr/bin/rtm-naming
/usr/share/doc/openrtm-aist/changelog.gz /usr/share/doc/openrtm-aist/README.Debian /usr/share/doc/openrtm-aist/README /usr/share/doc/openrtm-aist/README.jp /usr/share/doc/openrtm-aist/copyright /usr/share/doc/openrtm-aist/changelog.Debian.gz
/usr/etc/rtc.conf.sample
/usr/lib/i386-linux-gnu/libRTC-X.X.X.so /usr/lib/i386-linux-gnu/libRTC.a /usr/lib/i386-linux-gnu/libRTC.la /usr/lib/i386-linux-gnu/libcoil-X.X.X.so /usr/lib/i386-linux-gnu/libcoil.a /usr/lib/i386-linux-gnu/librtmCamera.a /usr/lib/i386-linux-gnu/librtmCamera.la /usr/lib/i386-linux-gnu/librtmCamera.so.X.X.X /usr/lib/i386-linux-gnu/librtmManipulator.a /usr/lib/i386-linux-gnu/librtmManipulator.la /usr/lib/i386-linux-gnu/librtmManipulator.so.X.X.X /usr/lib/i386-linux-gnu/openrtm-1.2/ec/FileNameservice.la /usr/lib/i386-linux-gnu/openrtm-1.2/ec/FileNameservice.so.X.X.X /usr/lib/i386-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.a /usr/lib/i386-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.la /usr/lib/i386-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.so.X.X.X /usr/lib/i386-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.a /usr/lib/i386-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.la /usr/lib/i386-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.so.X.X.X /usr/lib/i386-linux-gnu/openrtm-1.2/ssl/SSLTransport.la /usr/lib/i386-linux-gnu/openrtm-1.2/ssl/SSLTransport.so.X.X.X /usr/lib/i386-linux-gnu/pigconfig/openrtm-aist.pc
/usr/lib/x86_64-linux-gnu/libRTC-X.X.X.so /usr/lib/x86_64-linux-gnu/libRTC.a /usr/lib/x86_64-linux-gnu/libRTC.la /usr/lib/x86_64-linux-gnu/libcoil-X.X.X.so /usr/lib/x86_64-linux-gnu/libcoil.a /usr/lib/x86_64-linux-gnu/librtmCamera.a /usr/lib/x86_64-linux-gnu/librtmCamera.la /usr/lib/x86_64-linux-gnu/librtmCamera.so.X.X.X /usr/lib/x86_64-linux-gnu/librtmManipulator.a /usr/lib/x86_64-linux-gnu/librtmManipulator.la /usr/lib/x86_64-linux-gnu/librtmManipulator.so.X.X.X /usr/lib/x86_64-linux-gnu/openrtm-1.2/ec/FileNameservice.la /usr/lib/x86_64-linux-gnu/openrtm-1.2/ec/FileNameservice.so.X.X.X /usr/lib/x86_64-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.a /usr/lib/x86_64-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.la /usr/lib/x86_64-linux-gnu/openrtm-1.2/ec/LogicalTimeTriggeredEC.so.X.X.X /usr/lib/x86_64-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.a /usr/lib/x86_64-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.la /usr/lib/x86_64-linux-gnu/openrtm-1.2/sdo/LoggerConsumer.so.X.X.X /usr/lib/x86_64-linux-gnu/openrtm-1.2/ssl/SSLTransport.la /usr/lib/x86_64-linux-gnu/openrtm-1.2/ssl/SSLTransport.so.X.X.X /usr/lib/x86_64-linux-gnu/pigconfig/openrtm-aist.pc
openrtm-aist-devには、開発に必要なコマンド群とヘッダが含まれています。
/usr/bin/coil-config /usr/bin/rtc-template /usr/bin/rtm-skelwrapper
/usr/share/doc/openrtm-aist-dev/changelog.Debian.gz /usr/share/doc/openrtm-aist-dev/changelog.gz /usr/share/doc/openrtm-aist-dev/copyright
/usr/include/coil-1.2/coil/Affinity.h /usr/include/coil-1.2/coil/Allocator.h 中略 /usr/include/coil-1.2/coil/stringutil.h /usr/include/openrtm-1.2/rtm/BufferBase.h /usr/include/openrtm-1.2/rtm/BufferStatus.h 中略 /usr/include/openrtm-1.2/rtm/config_rtc.h /usr/include/openrtm-1.2/rtm/ext/CameraCommonInterface.hh /usr/include/openrtm-1.2/rtm/ext/CameraCommonInterface.idl 中略 /usr/include/openrtm-1.2/rtm/ext/ManipulatorCommonInterface_MiddleStub.h /usr/include/openrtm-1.2/rtm/ext/ec/artlinux/ArtExecutionContext.h /usr/include/openrtm-1.2/rtm/ext/ec/artlinux/rtc.conf.sample /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredEC.h /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredEC.idl 中略 /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredECStub.h /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredEC.hh /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredEC.idl /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredECDynSK.cc /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredECSK.cc /usr/include/openrtm-1.2/rtm/ext/ec/rtpreempt /usr/include/openrtm-1.2/rtm/ext/ec/rtpreempt/RTPreemptEC.h /usr/include/openrtm-1.2/rtm/ext/ec/rtpreempt/rtc.conf.sample /usr/include/openrtm-1.2/rtm/ext/local_service/nameservice_file/FileNameservice.h /usr/include/openrtm-1.2/rtm/ext/logger/fluentbit_stream/FluentBit.h /usr/include/openrtm-1.2/rtm/ext/logger/fluentbit_stream/fluentbit.conf /usr/include/openrtm-1.2/rtm/ext/sdo/logger/Logger.hh /usr/include/openrtm-1.2/rtm/ext/sdo/logger/Logger.idl 中略 /usr/include/openrtm-1.2/rtm/ext/sdo/logger/LoggerStub.h /usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserver.idl /usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserverConsumer.h 中略 /usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserverStub.h /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserver.hh /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserver.idl /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserverDynSK.cc /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserverSK.cc /usr/include/openrtm-1.2/rtm/idl/BasicDataType.hh /usr/include/openrtm-1.2/rtm/idl/BasicDataType.idl 中略 /usr/include/openrtm-1.2/rtm/idl/device_interfaces/Ranger.idl /usr/include/openrtm-1.2/rtm/version.h /usr/include/openrtm-1.2/rtm/version.txt
/usr/lib/i386-linux-gnu/openrtm-1.2/cmake/OpenRTMConfig.cmake /usr/lib/i386-linux-gnu/openrtm-1.2/py_helper/README_gen.py /usr/lib/i386-linux-gnu/openrtm-1.2/py_helpver/cxx_gen.py 中略 /usr/lib/i386-linux-gnu/openrtm-1.2/py_helpver/yat.py /usr/lib/i386-linux-gnu/pkgconfig/libcoil.pc
/usr/lib/x86_64-linux-gnu/openrtm-1.2/cmake/OpenRTMConfig.cmake /usr/lib/x86_64-linux-gnu/openrtm-1.2/py_helper/README_gen.py /usr/lib/x86-64-linux-gnu/openrtm-1.2/py_helpver/cxx_gen.py 中略 /usr/lib/x86_64-linux-gnu/openrtm-1.2/py_helpver/yat.py /usr/lib/x86_64-linux-gnu/pkgconfig/libcoil.pc
OpenRTM-aist 1.2.2 からメインPythonバージョンが2系から3系へ変更されました。
/usr/bin/rtcd_python3 /usr/bin/rtcprof_python3
usr/lib/python3/dist-packages/OpenRTM-aist/*
/usr/lib/python3/dist-packages/OpenRTM_aist.ph
/usr/lib/python3/dist-packages/OpenRTM_aist/utils/__init__.py /usr/lib/python3/dist-packages/OpenRTM_aist/utils/rtc-template/* /usr/lib/python3/dist-packages/OpenRTM_aist/utils/rtcd/* /usr/lib/python3/dist-packages/OpenRTM_aist/utils/rtcprof/* /usr/lib/python3/dist-packages/OpenRTM_aist/utils/rtm-naming/*
/usr/share/openrtm-1.2/components/python3/__init__.py /usr/share/openrtm-1.2/components/python3/rtcd.conf /usr/share/openrtm-1.2/components/python3/components.conf /usr/share/openrtm-1.2/components/python3/AutoControl/* /usr/share/openrtm-1.2/components/python3/AutoTest/* /usr/share/openrtm-1.2/components/python3/Composite/* /usr/share/openrtm-1.2/components/python3/ConfigSample/* /usr/share/openrtm-1.2/components/python3/ExtTrigger/* /usr/share/openrtm-1.2/components/python3/MobileRobotCanvas/* /usr/share/openrtm-1.2/components/python3/SeqIO/* /usr/share/openrtm-1.2/components/python3/SimpleIO/* /usr/share/openrtm-1.2/components/python3/SimpleService/* /usr/share/openrtm-1.2/components/python3/Slider_and_Motor/* /usr/share/openrtm-1.2/components/python3/Templates/* /usr/share/openrtm-1.2/components/python3/Throughput/* /usr/share/openrtm-1.2/components/python3/TkJoyStick/ /usr/share/openrtm-1.2/components/python3/TkLRFViewer/*
/usr/share/openrtm-1.2/doc/python3/ClassReference-en/html/_async_8py.html /usr/share/openrtm-1.2/doc/python3/ClassReference-en/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python3/ClassReference-en/html/uuid_8py.html
/usr/share/openrtm-1.2/doc/python3/ClassReference-jp/html/_async_8py.html /usr/share/openrtm-1.2/doc/python3/ClassReference-jp/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python3/ClassReference-jp/html/uuid_8py.html
openrtpでは大量のファイルがインストールされるため、ここではリストしません。必要に応じて
$ dpkg -L openrtp
/usr/local/bin/rtact /usr/local/bin/rtcat /usr/local/bin/rtcheck /usr/local/bin/rtcomp /usr/local/bin/rtcon /usr/local/bin/rtconf /usr/local/bin/rtcryo /usr/local/bin/rtdeact /usr/local/bin/rtdel /usr/local/bin/rtdis /usr/local/bin/rtdoc /usr/local/bin/rtexit /usr/local/bin/rtfind /usr/local/bin/rtfsm /usr/local/bin/rtinject /usr/local/bin/rtlog /usr/local/bin/rtls /usr/local/bin/rtmgr /usr/local/bin/rtprint /usr/local/bin/rtpwd /usr/local/bin/rtreset /usr/local/bin/rtresurrect /usr/local/bin/rtshell_post_install /usr/local/bin/rtstart /usr/local/bin/rtstodot /usr/local/bin/rtstop /usr/local/bin/rtteardown /usr/local/bin/rtvlog /usr/local/bin/rtwatch
/usr/local/lib/python3.8/dist-packages/rtctree/* /usr/local/lib/python3.8/dist-packages/rtshell/* /usr/local/lib/python3.8/dist-packages/rtsprofile/*
/usr/local/lib/python3.8/dist-packages/rtctree_aist-4.2.0.egg-info/* /usr/local/lib/python3.8/dist-packages/rtshell_aist-4.2.2.dist-info/* /usr/local/lib/python3.8/dist-packages/rtsprofile_aist-4.1.2.dist-info/*
Python版OpenRTM-aistはRaspberry Pi用Raspbianl用debパッケージが提供されています。 Raspbianへの対応およびそのバージョンは、予告なしに変更または停止されることがありますので、あらかじめご了承ください。
現在パッケージが用意されているRaspbianのバージョンは
です。
SDカードへの書き込み方法については RPi Easy SD Card Setup を参照してください。
このリンクではいくつかの方法が説明されています。そのうちのいくつかの概要を示すと:
Windowsを用いる方法の方がLinuxやMac OSを用いるより簡単なので、初心者にはWindowsを用いる方法を推奨します。
$ sudo dd of=/dev/<SDカードのデバイスファイル> if=<ダウンロード・解凍したイメージファイル> bs=4M status=progress $ sudo sync
上記コマンドによるSDカードへの書き込みはかなり長い時間を必要とします。(数分から10数分)。また、SDカードのデバイスファイル名を見つけるには
$ df -h
$ umount /dev/sdf5 $ umount /dev/sdf6 $ umount /dev/sdf7
その後、上記の’’dd’’コマンドを実行しますが、この例でのデバイスファイル名は/dev/sdfになります。
openrtm.orgが提供するインストール・スクリプトpkg_install_raspbian.shを指定のURLからダウンロードし、root 権限で実行します。このスクリプトでは必要なパッケージを順次apt-getを用いてインストールしていきます。
オプションを指定することで、目的に合わせたパッケージをインストールすることが可能です。一括インストール・スクリプトをダウンロードして
$ sudo sh pkg_install_raspbian.sh -l python --yes
一括インストールスクリプトのダウンロードや詳しいインストール方法、指定可能なオプションの種類につきましては、「一括インストールスクリプト」のページをご確認ください。
RTCをRaspbianにインストールしてそのホスト上からローカルにRTCをコントロールしたい場合にはrtshellが必要です。一括インストールスクリプトを用いてrtshellをインストールしてください。Raspbianではpkg_install_raspbian.shが置いてあるディレクトリで
$ sudo sh pkg_install_raspbian.sh -l rtshell --yes $ sudo rtshell_post_install
でインストールできます。
インストールを確認します。
$ dpkg -l 'openrt*' 要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)保持 | 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール/(W)トリガ待ち/(T)トリガ保留 |/ エラー?=(空欄)無/(R)要再インストール (状態,エラーの大文字=異常) ||/ 名前 バージョン アーキテクチ 説明 +++-===========================-============-============-=============================================== ii openrtm-aist-python 1.2.1-0 armhf OpenRTM-aist, RT-Middleware distributed by AIST ii openrtm-aist-python-doc 1.2.1-0 all Documentation for openrtm-aist-python ii openrtm-aist-python-example 1.2.1-0 armhf OpenRTM-aist-Python examples
rtshellのインストールも確認します。
$ pip show rtshell-aist Name: rtshell-aist Version: 4.2.2 Summary: Shell commands for managing RT Components and RT Systems. Home-page: http://github.com/gbiggs/rtshell Author: Geoffrey Biggs and contributors Author-email: geoffrey.biggs@aist.go.jp License: LGPL3 Location: /usr/local/lib/python2.7/dist-packages Requires: rtctree-aist, rtsprofile-aist
各パッケージの内容は以下の通りです。
/usr/bin/rtcd_python /usr/bin/rtcprof_python
usr/lib/python2.7/dist-packages/OpenRTM-aist/*
/usr/lib/python2.7/dist-packages/OpenRTM_aist.ph
/usr/lib/python2.7/dist-packages/OpenRTM_aist/utils/__init__.py /usr/lib/python2.7/dist-packages/OpenRTM_aist/utils/rtc-template/* /usr/lib/python2.7/dist-packages/OpenRTM_aist/utils/rtcd/* /usr/lib/python2.7/dist-packages/OpenRTM_aist/utils/rtcprof/* /usr/lib/python2.7/dist-packages/OpenRTM_aist/utils/rtm-naming/*
/usr/share/openrtm-1.2/components/python/__init__.py /usr/share/openrtm-1.2/components/python/rtcd.conf /usr/share/openrtm-1.2/components/python/components.conf /usr/share/openrtm-1.2/components/python/AutoControl/* /usr/share/openrtm-1.2/components/python/AutoTest/* /usr/share/openrtm-1.2/components/python/Composite/* /usr/share/openrtm-1.2/components/python/ConfigSample/* /usr/share/openrtm-1.2/components/python/ExtTrigger/* /usr/share/openrtm-1.2/components/python/MobileRobotCanvas/* /usr/share/openrtm-1.2/components/python/SeqIO/* /usr/share/openrtm-1.2/components/python/SimpleIO/* /usr/share/openrtm-1.2/components/python/SimpleService/* /usr/share/openrtm-1.2/components/python/Slider_and_Motor/* /usr/share/openrtm-1.2/components/python/Templates/* /usr/share/openrtm-1.2/components/python/Throughput/* /usr/share/openrtm-1.2/components/python/TkJoyStick/ /usr/share/openrtm-1.2/components/python/TkLRFViewer/*
/usr/share/openrtm-1.2/doc/python/ClassReference-en/html/_async_8py.html /usr/share/openrtm-1.2/doc/python/ClassReference-en/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python/ClassReference-en/html/uuid_8py.html
/usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/_async_8py.html /usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/uuid_8py.html
/usr/local/bin/rtact /usr/local/bin/rtcat /usr/local/bin/rtcheck /usr/local/bin/rtcomp /usr/local/bin/rtcon /usr/local/bin/rtconf /usr/local/bin/rtcryo /usr/local/bin/rtdeact /usr/local/bin/rtdel /usr/local/bin/rtdis /usr/local/bin/rtdoc /usr/local/bin/rtexit /usr/local/bin/rtfind /usr/local/bin/rtfsm /usr/local/bin/rtinject /usr/local/bin/rtlog /usr/local/bin/rtls /usr/local/bin/rtmgr /usr/local/bin/rtprint /usr/local/bin/rtpwd /usr/local/bin/rtreset /usr/local/bin/rtresurrect /usr/local/bin/rtshell_post_install /usr/local/bin/rtstart /usr/local/bin/rtstodot /usr/local/bin/rtstop /usr/local/bin/rtteardown /usr/local/bin/rtvlog /usr/local/bin/rtwatch
/usr/local/lib/python2.7/dist-packages/rtctree/* /usr/local/lib/python2.7/dist-packages/rtshell/* /usr/local/lib/python2.7/dist-packages/rtsprofile/*
/usr/local/lib/python2.7/dist-packages/rtctree_aist-4.2.0.egg-info/* /usr/local/lib/python2.7/dist-packages/rtshell_aist-4.2.2.dist-info/* /usr/local/lib/python2.7/dist-packages/rtsprofile_aist-4.1.2.dist-info/*
現在、1.2系のOpenRTM-aistはFedoraの対応が不完全です。よって、本ページの情報はあくまでも参考情報として使用してください。
Python版OpenRTM-aistはFedora Linuxで利用可能なRPMパッケージが提供されています。 対応しているFedora Linuxのバージョンは、ダウンロードページから確認できます。 Fedora Linuxへの対応およびそのバージョンは、予告なしに変更または停止されることがありますので、あらかじめご了承ください。
Fedora Linuxへのインストールの方法には大きく分けて以下の二種類のインストール方法があります。openrtm.orgが提供するインストール・スクリプトpkg_install_fedora.shをダウンロードページからダウンロードし、root権限で実行します。 このスクリプトは、必要なパッケージを順次yumを用いてインストールしていきます。
OpenRTM-aistを開発・実行するために必要なパッケージをもれなくインストールしてくれるので大変便利です。
オプションを指定することで、目的に合わせたパッケージをインストールすることが可能です。一括インストール・スクリプトをダウンロードして
sudo sh pkg_install_fedora.sh -l python --yes
一般的なUbuntu/Debian環境での開発にはRTC BuilderやRTSystem Editorを使用しますが、その場合にはOpenRTPが必要ですので、一括インストールスクリプトを用いてOpenRTPをインストールしてください。Ubuntuではpkg_install_ubuntu.shが置いてあるディレクトリで
$ sudo sh ./pkg_install_fedora.sh -l openrtp --yes
現状Fedora用一括インストールスクリプトでは-l pythonでPython用の環境をインストールした後に、-l openrtpをインストールした場合OpenRTPの実行に必要なファイルが一部インストールされないという問題がありますので上記実行後
$ sudo yam install OpenRTM-aist
制御用コンピューター・システムが小規模の場合など、CUIでRTCを制御したい場合にはOpenRTPのRTSystemEditor相当の機能をCUIから実行できるようなツールとしてrtshellと呼ばれるツールが提供されています。rtshellのインストールはターミナル上で一括インストールスクリプトを用いて、一括インストールスクリプト・ファイルが置かれているディレクトリで以下のように入力します。
$ sudo sh pkg_install_fedora.sh -l rtshell --yes
openrtm.orgではyumから利用可能なパッケージリポジトリを提供しています。 ただし、デフォルトのパッケージリポジトリには含まれていませんので、yumの設定を変更する必要があります。
以下のような設定を記録したファイル/etc/yum.repos.d/openrtm.repoを作成しておきます。作成には通常root権限が必要です。
[openrtm] name=Fedora $releasever - $basearch failovermethod=priority baseurl=http://openrtm.org/pub/Linux/Fedora/releases/$releasever/Fedora/$basearch/os/Packages enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
openrtm.repoを作成したら、次の手順でインストールを行います。 途中、いくつかの応答を求められるので、yを入力しながら完了させます。
$ sudo yum install gcc-c++ python $ sudo yum install omniORB omniORB-devel omniORB-doc omniORB-servers omniORB-utils $ sudo yum install OpenRTM-aist-Python OpenRTM-aist-Python-doc OpenRTM-aist-Python-example
$ sudo yum install OpenRTP $ sudo yum install OpenRTM-aist
$ sudo pip3 install rtshell-aist
以下のコマンドでインストールの確認ができます。
$ rpm -qa OpenRT* OpenRTM-aist-devel-1.2.0-0.fc29.x86_64 OpenRTM-aist-Python-1.2.0-0.29.x86_64 OpenRTM-aist-Python-example-1.2.0-0.29.x86_64 OpenRTP-1.2.0-1.fc29.x86_64 OpenRTM-aist-1.2.0-0.fc29.x86_64 OpenRTM-aist-Python-doc-1.2.0-0.29.x86_64
$ rpm -qa OpenRT* OpenRTM-aist-Python-1.2.0-0.29.x86_64 OpenRTM-aist-Python-example-1.2.0-0.29.x86_64 OpenRTM-aist-Python-doc-1.2.0-0.29.x86_64
$ pip3 show rtshell-aist Name: rtshell-aist Version: 4.2.2 Summary: Shell commands for managing RT Components and RT Systems. Home-page: http://github.com/gbiggs/rtshell Author: Geoffrey Biggs and contributors Author-email: geoffrey.biggs@aist.go.jp License: LGPL3 Location: /usr/local/lib/python3.7/dist-packages Requires: rtctree-aist, rtsprofile-aist
各パッケージの内容は以下の通りです(64bit版Fedoraの場合)
/usr/bin/rtcd_python /usr/bin/rtcprof_python
usr/lib/python3.7/site-packages/OpenRTM-aist/*
/usr/lib/python3.7/site-packages/OpenRTM_aist.ph
/usr/lib/python3.7/site-packages/OpenRTM_aist/utils/__init__.py /usr/lib/python3.7/site-packages/OpenRTM_aist/utils/rtc-template/* /usr/lib/python3.7/site-packages/OpenRTM_aist/utils/rtcd/* /usr/lib/python3.7/site-packages/OpenRTM_aist/utils/rtcprof/* /usr/lib/python3.7/site-packages/OpenRTM_aist/utils/rtm-naming/*
/usr/share/openrtm-1.2/components/python/__init__.py /usr/share/openrtm-1.2/components/python/rtcd.conf /usr/share/openrtm-1.2/components/python/components.conf /usr/share/openrtm-1.2/components/python/AutoControl/* /usr/share/openrtm-1.2/components/python/AutoTest/* /usr/share/openrtm-1.2/components/python/Composite/* /usr/share/openrtm-1.2/components/python/ConfigSample/* /usr/share/openrtm-1.2/components/python/ExtTrigger/* /usr/share/openrtm-1.2/components/python/MobileRobotCanvas/* /usr/share/openrtm-1.2/components/python/SeqIO/* /usr/share/openrtm-1.2/components/python/SimpleIO/* /usr/share/openrtm-1.2/components/python/SimpleService/* /usr/share/openrtm-1.2/components/python/Slider_and_Motor/* /usr/share/openrtm-1.2/components/python/Templates/* /usr/share/openrtm-1.2/components/python/Throughput/* /usr/share/openrtm-1.2/components/python/TkJoyStick/ /usr/share/openrtm-1.2/components/python/TkLRFViewer/*
/usr/share/openrtm-1.2/doc/python/ClassReference-en/html/_async_8py.html /usr/share/openrtm-1.2/doc/python/ClassReference-en/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python/ClassReference-en/html/uuid_8py.html
/usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/_async_8py.html /usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/_buffer_base_8py.html 中略 /usr/share/openrtm-1.2/doc/python/ClassReference-jp/html/uuid_8py.html
openrtm-aistにはランタイムライブラリとコマンド群が含まれています。
/etc/rtc.conf.sample
/usr/bin/rtcd /usr/bin/rtcprof /usr/bin/rtm-config /usr/bin/rtm-naming
/usr/lib64/libRTC-1.2.0.so /usr/lib64/libRTC.a /usr/lib64/libRTC.la 中略 /usr/lib64/librtmManipulator.so.0.0.0 /usr/lib64/openrtm-1.2/ec/FileNameservice.la /usr/lib64/openrtm-1.2/ec/FileNameservice.so 中略 /usr/lib64/openrtm-1.2/ssl/SSLTransport.so.0.0.0
openrtm-aist-devには、開発に必要なコマンド群とヘッダが含まれています。
/usr/bin/coil-config /usr/bin/rtc-template /usr/bin/rtm-skelwrapper
/usr/include/coil-1.2/coil/Affinity.h /usr/include/coil-1.2/coil/Allocator.h 中略 /usr/include/coil-1.2/coil/stringutil.h /usr/include/openrtm-1.2/rtm/BufferBase.h /usr/include/openrtm-1.2/rtm/BufferStatus.h 中略 /usr/include/openrtm-1.2/rtm/version.txt /usr/include/openrtm-1.2/rtm/ext/CameraCommonInterface.hh /usr/include/openrtm-1.2/rtm/ext/CameraCommonInterface.idl 中略 /usr/include/openrtm-1.2/rtm/ext/ManipulatorCommonInterface_MiddleStub.h /usr/include/openrtm-1.2/rtm/ext/ec/artlinux/ArtExecutionContext.h /usr/include/openrtm-1.2/rtm/ext/ec/artlinux/rtc.conf.sample /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredEC.h /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredEC.idl 中略 /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/LogicalTimeTriggeredECStub.h /usr/include/openrtm-1.2/rtm/ext/ec/rtpreempt/RTPreemptEC.h /usr/include/openrtm-1.2/rtm/ext/ec/rtpreempt/rtc.conf.sample /usr/include/openrtm-1.2/rtm/ext/local_service/nameservice_file /usr/include/openrtm-1.2/rtm/ext/local_service/nameservice_file/FileNameservice.h /usr/include/openrtm-1.2/rtm/ext/logger/fluentbit_stream/FluentBit.h /usr/include/openrtm-1.2/rtm/ext/logger/fluentbit_stream/fluentbit.conf /usr/include/openrtm-1.2/rtm/ext/sdo/logger/Logger.hh /usr/include/openrtm-1.2/rtm/ext/sdo/logger/Logger.idl 中略 /usr/include/openrtm-1.2/rtm/ext/sdo/logger/LoggerStub.h
/usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserver.idl /usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserverConsumer.h 中略 /usr/include/openrtm-1.2/rtm/ext/sdo/observer/ComponentObserverStub.h /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredEC.hh /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredEC.idl /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredECDynSK.cc /usr/include/openrtm-1.2/rtm/ext/ec/logical_time/idl/LogicalTimeTriggeredECSK.cc /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserver.hh /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserver.idl /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserverDynSK.cc /usr/include/openrtm-1.2/rtm/ext/sdo/observer/idl/ComponentObserverSK.cc /usr/include/openrtm-1.2/rtm/idl/BasicDataType.hh /usr/include/openrtm-1.2/rtm/idl/BasicDataType.idl 中略 /usr/include/openrtm-1.2/rtm/idl/SharedMemoryStub.h /usr/include/openrtm-1.2/rtm/idl/device_interfaces/AIO.idl /usr/include/openrtm-1.2/rtm/idl/device_interfaces/ActArray.idl 中略 /usr/include/openrtm-1.2/rtm/idl/device_interfaces/Ranger.idl
/usr/lib64/openrtm-1.2/cmake/OpenRTMConfig.cmake /usr/lib64/openrtm-1.2/py_helper/README_gen.py /usr/lib64/openrtm-1.2/py_helper/cxx_gen.py 中略 /usr/lib64/openrtm-1.2/py_helper/yat.py /usr/lib64/pkgconfig/libcoil.pc /usr/lib64/pkgconfig/openrtm-aist.pc
OpenRtpでは大量のファイルがインストールされるため、ここではリストしません。必要に応じて
$ rpm -ql OpenRTP
/usr/local/bin/rtact /usr/local/bin/rtcat /usr/local/bin/rtcheck /usr/local/bin/rtcomp /usr/local/bin/rtcon /usr/local/bin/rtconf /usr/local/bin/rtcryo /usr/local/bin/rtdeact /usr/local/bin/rtdel /usr/local/bin/rtdis /usr/local/bin/rtdoc /usr/local/bin/rtexit /usr/local/bin/rtfind /usr/local/bin/rtfsm /usr/local/bin/rtinject /usr/local/bin/rtlog /usr/local/bin/rtls /usr/local/bin/rtmgr /usr/local/bin/rtprint /usr/local/bin/rtpwd /usr/local/bin/rtreset /usr/local/bin/rtresurrect /usr/local/bin/rtshell_post_install /usr/local/bin/rtstart /usr/local/bin/rtstodot /usr/local/bin/rtstop /usr/local/bin/rtteardown /usr/local/bin/rtvlog /usr/local/bin/rtwatch
/usr/local/lib/python3.7/dist-packages/rtctree/* /usr/local/lib/python3.7/dist-packages/rtshell/* /usr/local/lib/python3.7/dist-packages/rtsprofile/*
/usr/local/lib/python3.7/dist-packages/rtctree_aist-4.2.0.egg-info/* /usr/local/lib/python3.7/dist-packages/rtshell_aist-4.2.2.dist-info/* /usr/local/lib/python3.7/dist-packages/rtsprofile_aist-4.1.2.dist-info/*
インストールまたはビルドが正常に終了したら、付属のサンプルで動作テストをします。サンプルは、通常は以下の場所にあります。
サンプルコンポーネントセットSimpleIOを使って、OpenRTM-aistが正しくビルド・インストールされているかを確認します。
RTコンポーネント ConsoleIn、ConsoleOutからなるサンプルセットです。ConsoleInはコンソールから入力された数値をOutPortから出力するコンポーネント、ConsoleOutはInPortに入力された数値をコンソールに表示するコンポーネントです。 これらは、最もSimpleなI/O(入出力)を例示するためのサンプルです。ConsoleInのOutPortからConsoleOutのInPortへ接続を構成し、これらの2つのコンポーネントをアクティブ化(Activate)することで動作します。
以下では、MSIインストーラーでOpenRTM-aistをデフォルトでインストールした環境で、スタートメニューから各種プログラムを起動する場合しOpenRTPを使う方法を説明します。OpenRTPを使わないでrtshellを使う場合は、rtshellのインストールにおける動作確認(Windows編)を参照してください。なお、ソースビルドした場合は、サンプルコンポネントは、<ソースディレクトリ>\OpenRTM-aist\examples\SimpleIOにありますので、リンク先や下記の説明でのConsoleIn/ConsoleOutコンポーネントの場所はそこに置き換えてください。
以下の手順に従ってRTSystemEditor、ネームサーバーを起動してください。
ネームサーバー起動後、適当なサンプルコンポーネントを起動します。
Windows 10の場合は右下の[ここに入力して検索]にPython_Examplesと入力してサンプルのディレクトリを開きます。
ここでは、「ConsoleIn.bat」「ConsoleOut.bat」をそれぞれダブルクリックして2つのコンポーネントを起動します。起動すると、下図のような2つのコンソール画面が開きます。
コンポーネントが起動しない場合、いくつかの原因が考えられます。
rtc.confの設定に問題があり、起動できないケースがあります。上記検索から開かれるディレクトリの[rtc.conf for examples]を開いて設定を確認してください。例えば、corba.endpoint/corba.endpointsなどの設定が現在実行中のPCのホストアドレスとミスマッチを起こしている場合などは、CORBAが異常終了します。
以下のような最低限のrtc.confに設定しなおして試してみてください。
corba.nameservers: localhost
openrtm.orgが提供するMSIインストーラーにはomniORBpyが含まれていますが、カスタムインストールを選択すると、omniORBpyをインストールせずにOpenRTM-aist-Pythonをインストールできます。また、手動でインストールした場合には、omniORBpyが入っていない場合も考えられますので、omniORBpyがインストールされているか確認してください。
ConsoleIn、ConsoleOutを起動するファイルは、
C:\Program Files\OpenRTM-aist\1.2.x\Components\Python\Examples\SimpleIO\ConsoleIn.py
C:\Program Files\OpenRTM-aist\1.2.x\Components\Python\Examples\SimpleIO\ConsoleOut.py
です。(64bit版MSIでインストールした場合)このディレクトリでコンソール画面を開き、python ConsoleIn.pyを実行すると起動するが、ConsoleIn.pyをダブルクリックして起動できない場合はインストールしているpythonを確認してください。Pythonの32bit版、64bit版の両方をインストールしている場合、先にインストールしたものがpyファイルに関連付けられるようなので、OpenRTM-aist-Pythonのインストーラーと同じアーキテクチャのPythonを先にインストールすると解決するかもしれません。
ホスト名やアドレスの設定の問題で、起動がうまくいかないケースがあります。その場合、利用しているPCのIPアドレスをomniNames.exeに教えてあげるとうまくいくケースがあります。 環境変数OMNIORB_USEHOSTNAMEを以下のように設定します(以下は自ホストのIPアドレスが192.168.0.11の場合の例)。
変数名(N): OMNIORB_USEHOSTNAME 変数値(V): 192.168.0.11
RTSystemEditorのツリー表示の[>]をクリックすると、先ほど起動した2つのコンポーネントが登録されていることがわかります。
システムを編集するエディタ(System Diagram)を開きます。上部の[Open New System Editor]ボタン をクリックすると、中央のペインにエディタ(System Diagram)が開きます。左側のネームサービスビューに のアイコンで表示されているコンポーネント(2つ)を中央のエディタ・エリアにドラッグアンドドロップします。
ConsoleIn0コンポーネント・アイコンの右側にはデータが出力されるOutPort が 、ConsoleOut0コンポーネント・アイコンの左側にはデータが入力されるInPort がそれぞれ配置されています。
これらInPort/OutPort(まとめてデータポートと呼びます)を接続します。OutPortからInPort(またはInPortからOutPort)へドラッグランドドロップすると、図のようなダイアログが現れますので、デフォルト設定のまま[OK]ボタンをクリックします。
2つのコンポーネントの間に接続線が現れます。次に、エディタ上部メニューの[All Activate]ボタン をクリックし、これらのコンポーネントをアクティブ化します。アクティブ化されると、コンポーネントが緑色に変化します。
コンポーネントがアクティブ化されるとConsoleInコンポーネント側のコンソールには
Please input number:
というプロンプト表示に変わりますので、適当な数値(short intの範囲内:32767以下)を入力しEnterキーを押してください。すると、ConsoleOut側のコンソールにも入力した数値が表示され、ConsoleInコンポーネントからConsoleOutコンポーネントへデータが転送されたことがわかります。
以上で、OpenRTPを用いたコンポーネントの基本動作の確認は終了です。
インストーラーには、このほかにもいくつかのサンプルコンポーネントが付属しています。これらのコンポーネントも同様に起動し、RTSystemEditorでポート同士を接続し、アクティブ化することで試すことができます。付属しているコンポーネントのリストと簡単な説明を以下に示します。
ConsoleIn.py | コンソールから入力された数値をOutPortから出力する。ConsoleOut.pyに接続して使用する。 |
ConsoleOut.py | InPortに入力された数値をコンソールに表示するコンポーネント。ConsoleIn.pyに接続して使用する。 |
SeqIn.py | ランダムな数値(Short、Long、Float、Doubleとそのシーケンス型)を出力するコンポーネント。SeqOut.pyに接続して使用する。 |
SeqOut.py | InPortに入力される数値(Short、Long、Float、Doubleとそのシーケンス型)を表示。SeqIn.pyに接続して使用する。 |
MyServiceProvider.py | MyService型のサービスを提供するコンポーネント。MyServiceConsumer.pyに接続して使用する。 |
MyServiceConsumer.py | MyService型のサービスを利用するコンポーネント。MyServiceProvider.pyに接続して使用する。 |
ConfigSample.py | Configurationのサンプル。RTSystemEditorからConfigurationを変更してConfigurationの挙動を理解するためのサンプル。 |
TkMobileRobotSimulator.py | モバイルロボットの簡易シミュレーター。ロボットの速度をInPortで受け、移動後の位置をOutPortから出力する。 |
NXTRTC.py | LEGO MINDSTORMを用いたモバイルロボットを制御するためのサンプル。InPortにて速度を受け、赤外線センサーと現在位置をそれぞれOutPortから出力する。 |
AutoControl.py | モバイルロボット用のコンポーネントで速度を出力する。測位センサーのデータをInPortで受け、ロボットの速度を計算してOutPortから出力する。 |
Composite.py | Composite用のサンプル。Motor、Controller、Sensorを包含するコンポーネント。Compositeの使用方法を理解するためのサンプル。 |
Motor.py | Compositeコンポーネント用のサンプル。Compositeの子要素として使用。 |
Controller.py | Compositeコンポーネント用のサンプル。Compositeの子要素として使用。 |
Sensor.py | Compositeコンポーネント用のサンプル。Compositeの子要素として使用。 |
SliderComp.py | Tcl/Tkを用いたGUIコンポーネントのサンプル。Sliderで指定した値をOutPortから出力する。 |
TkMotorComp.py | Tcl/Tkを用いたGUIコンポーネントのサンプル。InPortで受け取った値の速度で回転する様子をGUIで表示する。 |
TkMotorPosComp.py | Tcl/TKを用いたGUIコンポーネントのサンプル。InPortで受け取った値を回転角として動く様子をGUIで表示する。 |
TkLRFViewer.py | Tcl/Tkを用いたGUIコンポーネントのサンプル。レーザーレンジセンサーなどから出力されるデータを表示する。 |
TkJoystickComp.py | Tcl/Tkを用いたGUIコンポーネントのサンプル。簡易ジョイスティックコンポーネント。 |
サンプルコンポーネントセットSimpleIOを使って、OpenRTM-aistが正しくビルド・インストールされているかを確認します。
RTコンポーネントConsoleIn、ConsoleOutからなるサンプルセットです。ConsoleInはコンソールから入力された数値をOutPortから出力するコンポーネント、ConsoleOutはInPortに入力された数値をコンソールに表示するコンポーネントです。これらは、SimpleなI/O(入出力)を例示するためのサンプルです。ConsoleInのOutPortからConsoleOutのInPortへ接続を構成し、これらの2つのコンポーネントをアクティブ化(Activate)することで動作します。
以降、サンプルは/usr/share/openrtm-1.2/components/python/SimpleIO下にあることを前程に説明します。また、Python本体の実行ファイルに対してはサーチパスが設定されているものとします。なお、ソースコードからビルドした場合はサンプル実行ファイルルは<source_dir>/OpenRTM_aist/examples/SimpleIO/にあるので、起動パスを置き換えて下記の説明を利用してください。
以下の説明ではRTSystemEditor(OpenRTP)を使った動作確認を説明します。RaspbianのケースのようにOpenRTPを使用しない環境での動作確認についてはrtshellのインスト―ルの動作確認(Linux編)>を参照ください。
以下の手順に従ってRTSystemEditor、ネームサーバーを起動してください。
$ python /usr/share/openrtm-1.2/components/python/SimpleIO/ConsoleIn.py
$ python <source_dir>/OpenRTM_aist/examples/SimpleIO/ConsoleIn.py
$ /usr/share/openrtm-1.2/components/python/SimpleIO/ConsoleOut
$ python <source_dir>/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py
Please input number:
以上で、RTSystemEditorを用いたコンポーネントの基本動作の確認は終了です。
Windows上でソースパッケージからインストールしたい場合、OpenRTM-aist-Pythonを自分でビルドする必要があります。
が必要です。以下に入手方法を説明しますのでインストールしてください。
Python 2.7(もしくは3.6、3.7)が必要です。以下のサイトから最新のものを取得しインストールしてください。
以降の説明では、Pythonのインストールに際して以下の設定が必要です。(その他はインストーラのデフォルト設定です。)
OpenRTM-aist-PythonのビルドにはomniORBpyのライブリが必要です。omniORBpyは以下のリンクから、必要なファイルを入手できます。
また、公式サイトからはソースが入手できます。openrtm.orgのサイトのファイルは、特別な理由がない限りは最新版(現時点では4.2.3)を使用することを推奨します。また、複数のファイルがあり、そのファイル名の意味は以下になります。説明にあわせて使用するファイルを選択してください。
ファイル名の書式は、以下のフォーマットになっています。
omniORB-x.y.z-{win32|x64}-{vc100|vc110|vc120|vc140}-{py27|py36|py37}.zip
ここで、omniORB 4.2.3を64bitのPython 3.7の環境で使用する場合、omniORB-4.2.3-x64-vc140-py37.zipをダウンロードします。
ダウンロードしたZIPファイルを展開すると、以下の様なディレクトリツリーが展開されます。それぞれのディレクトリ下のファイルを以下の指示通りに Python のディレクトリにコピーしてください。
なお、omniORBpyのバージョンをx.y、PythonのバージョンをX.Yとして記述しています。
+ omniORBpy-x.y + bin + x86_win32 -> exe、dllともにC:\PythonX.Y直下へ + doc -> 削除してもよい + examples -> 削除してもよい + idl -> 削除してもよいがC:\PythonX.Y\Lib\site-packages\omniORB\idl以下においておいてもよい + lib + python -> 以下のディレクトリとファイルを丸ごとC:\PythonX.Y\Lib\site-packages直下へ + x86_win32 -> .pydをC:\PythonX.Y\Lib\site-packages直下へ
のWebページからWindows版のバイナリ実行形式ファイルをダウンロードして実行してインストールしてください。
まず下記リンクよりソースコードファイルOpenRTM-aist-Python-1.2.x.zipをダウンロードし、適当なディレクトリに展開します。
コマンドプロンプトを起動し、先程ソースコードを展開したフォルダーに移動後、以下のコマンドにてビルドを行います。
> python setup.py build
すべてが正しくビルドできたら、以下のコマンドにてインストールを完了させます。
> python setup.py install
以上で、OpenRTM-aist-pythonのインストールは終了です。
Linux上でソースパッケージからインストールしたい場合、OpenRTM-aist-Pythonを自分でビルドする必要があります。以下にUbuntu 18.04でのビルド作業の手順を説明します。
上記以外の環境でも一般的なLinux/UNIX環境であれば、ビルドできる可能性があります。
それぞれのソフトウエアのドキュメントに従いインストールを行ってください。これらのパッケージが、標準のディレクトリ(/usr、/usr/lib/ など)下にインストールされていると、以降のOpenRTM-aist-Pythonのビルド作業を比較的簡単に行うことができます。
Ubuntu, DebianではomniORB関連のものは以下のコマンドでインストールできます。
sudo apt-get install python-omniorb-omg omniidl-python omniorb-nameserver
まずソースコードパッケージOpenRTM-aist-Python-1.2.1.tar.gzを適当なディレクトリに展開します。
$ tar xvzf OpenRTM-aist-Python-X.X.X.tar.gz $ cd OpenRTM-aist-Python-X.X.X
OpenRTM-aist-Pythonはパッケージのビルドにdistutilsモジュールを使用しています。 ビルドの仕方は、他のdistutilsを使用したパッケージと同様に行います。
$ python setup.py build [options]
[options]で使用可能なオプションは
$ python setup.py --help
で参照してください。
ビルド が正常に終了したら、Pythonモジュール、ユーティリティコマンド群をインストールします。
$ sudo python setup.py install
以上で、ソースコードからのビルドおよびインストールは終了です。