[openrtm-users 00464] OpenRTM-Python のサービスの参照について: some feedback

2 個の投稿 / 0 new
最終投稿
root
オフライン
Last seen: 5日 12時間 前
登録日: 2009-06-23 14:31
[openrtm-users 00464] OpenRTM-Python のサービスの参照について: some feedback

Dear Florent Lamiraux,

Thank you very much for your feedback.

> 1. The OpenRTM-Python package that I have downloaded from OpenRTM
> web-page (OpenRTM-aist-Python-0.4.1-RC1.tar.gz) contains some compiled
> python xxx_idl.py generated using a version of omniidl older than the
> one installed on my computer. For this reason, I have regenerated those
> files by invoking omniidl:
Sorry, when installing OpenRTM-aist-Python, IDL compile is done in the
next release version.

> Notice that I installed OpenRTM-Python in a user directory (not in
> /usr/lib) and defined PYTHONPATH environment variable accordingly. In
> this case, python interpreter does not search recursively
> sub-directories of PYTHONPATH paths. That is why I had to add the
> following lines:
Does the OpenRTM.pth file exist in the same hierarchy as the OpenRTM directory?

for example:
> cd tmp
> ls
OpenRTM/ OpenRTM.pth

> more OpenRTM.pth
OpenRTM
OpenRTM/RTM_IDL

> Then, I could call all fonctions defined in my idl interface, except one
> function with an out parameter:
>
> boolean hppWalkPlannerComp::service::solve(out SwalkPlanFootInPlaneSeq
> outStepSequence);
>
> The function was correctly executed in the RTM component, but the result
> could not reach the python interpreter.
Is the call of hppWalkPlannerComp::service::solve() from the client
side as follows?

ret, outSepSequence = walkPlannerClient.solve()

Best regards,
Shinji Kurihara

On Thu, 05 Jun 2008 15:45:18 +0900
Florent Lamiraux wrote:

> Dear Kurihara san,
>
> I am currently working with Neo San on an RTM component wrapping path
> planning functions for a humanoid robot.
>
> One month ago, Neo San sent you an e-mail to know how to implement a
> python client to an OpenRTM component. You sent the reply to Neo San who
> forwarded me the solution.
>
> First, thank you very much for your help.
> Second, I would like to give you some feedback about my experience.
>
> I have implemented the solution you suggested me but I ran into some
> troubles that I am going to describe you.
>
> 1. The OpenRTM-Python package that I have downloaded from OpenRTM
> web-page (OpenRTM-aist-Python-0.4.1-RC1.tar.gz) contains some compiled
> python xxx_idl.py generated using a version of omniidl older than the
> one installed on my computer. For this reason, I have regenerated those
> files by invoking omniidl:
>
> cd OpenRTM/RTM_IDL
> omniidl -bpython BasicDataType.idl
> omniidl -bpython DataPort.idl
> omniidl -bpython OpenRTM.idl
> omniidl -bpython RTC.idl
> omniidl -bpython SDOPackage.idl
>
> 2. Then, I have followed your instruction in my python file:
>
> -----------------------------------------------------------
> import sys, os
> import re
>
> pythonPath = os.environ.get("PYTHONPATH")
> pathList = re.split(':', pythonPath)
>
> for path in pathList:
> addPath1 = path+"/OpenRTM"
> addPath2 = path+"/OpenRTM/RTM_IDL"
> sys.path.append(addPath1)
> sys.path.append(addPath2)
>
> import omniORB
> import RTC
> from CorbaNaming import *
>
> CORBA = omniORB.CORBA
> from omniORB import any
>
> import hppWalkPlannerComp
>
> import string
> from math import sin, cos, pi
>
> orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
>
> naming = CorbaNaming(orb, "localhost:2024")
> rtObjRef = naming.resolve("walkPlannerORTM0.rtc")
>
> rtObject = rtObjRef._narrow(RTC.RTObject)
>
> componentPorts = rtObject.get_ports()
>
> connectorProfile =
> RTC.ConnectorProfile("connect0","",[componentPorts[0]],[])
> ret,cntProf = componentPorts[0].connect(connectorProfile)
>
> componentServiceRef =
> any.from_any(cntProf.properties[0].value,keep_structs=True)
> walkPlannerClient = componentServiceRef._narrow(hppWalkPlannerComp.service)
>
> -----------------------------------------------------------
>
> Notice that I installed OpenRTM-Python in a user directory (not in
> /usr/lib) and defined PYTHONPATH environment variable accordingly. In
> this case, python interpreter does not search recursively
> sub-directories of PYTHONPATH paths. That is why I had to add the
> following lines:
>
> -----------------------------------------------------------
>
> for path in pathList:
> addPath1 = path+"/OpenRTM"
> addPath2 = path+"/OpenRTM/RTM_IDL"
> sys.path.append(addPath1)
> sys.path.append(addPath2)
>
> -----------------------------------------------------------
>
> Then, I could call all fonctions defined in my idl interface, except one
> function with an out parameter:
>
> boolean hppWalkPlannerComp::service::solve(out SwalkPlanFootInPlaneSeq
> outStepSequence);
>
> The function was correctly executed in the RTM component, but the result
> could not reach the python interpreter.
>
> I then modified my client file as follows, using another python CORBA
> python that works well.
>
> -----------------------------------------------------------
>
> import sys, os
> import re
>
> pythonPath = os.environ.get("PYTHONPATH")
> pathList = re.split(':', pythonPath)
>
> for path in pathList:
> addPath1 = path+"/OpenRTM"
> addPath2 = path+"/OpenRTM/RTM_IDL"
> sys.path.append(addPath1)
> sys.path.append(addPath2)
>
> from omniORB import CORBA
> import RTC
> from omniORB import any
>
> import CosNaming, hppWalkPlannerComp
> orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
>
> obj = orb.resolve_initial_references("NameService")
> rootContext = obj._narrow(CosNaming.NamingContext)
>
> if rootContext is None:
> print "failed to narrow the root naming context"
> sys.exit(1)
>
> #Create Robot client
> compName = [CosNaming.NameComponent("walkPlannerORTM0", "rtc")]
>
> try:
> rtObjRef = rootContext.resolve(compName)
> except CosNaming.NamingContext.NotFound, ex:
> print "walkPlannerORTM0.rtc not found"
> sys.exit(1)
>
> rtObject = rtObjRef._narrow(RTC.RTObject)
>
> componentPorts = rtObject.get_ports()
>
> connectorProfile =
> RTC.ConnectorProfile("connect0","",[componentPorts[0]],[])
> ret,cntProf = componentPorts[0].connect(connectorProfile)
>
> componentServiceRef =
> any.from_any(cntProf.properties[0].value,keep_structs=True)
> walkPlannerClient = componentServiceRef._narrow(hppWalkPlannerComp.service)
>
> -----------------------------------------------------------
>
> And now, it works perfectly.
>
> I hope this information can be useful to you.
> Thank you for your help.
>
> Sincerely yours,
>
> Florent Lamiraux
> Joint Robotics Laboratory AIST-CNRS
>

未定義
root
オフライン
Last seen: 5日 12時間 前
登録日: 2009-06-23 14:31
[openrtm-users 00466] OpenRTM-Python のサービスの参照について: some feedba

Hello,

Thank you for your reply.

Florent Lamiraux wrote:
> I installed in /home/florent/devel
> python setup.py install --prefix=/home/florent/devel
>
> > cd /home/florent/devel/lib/python2.5/site-packages
> > ls
> OpenRTM/
> OpenRTM_aist_Python-0.4.1.egg-info
> OpenRTM.pth
>
> > more OpenRTM.pth
> OpenRTM
> OpenRTM/RTM_IDL

Did you add "/home/florent/devel/lib/python2.5/site-packages" to PYTHONPATH ?

Sincerely yours,
Shinji Kurihara

コメントを投稿するにはログインまたはユーザー登録を行ってください

ダウンロード

最新バージョン

初めての方へ

Windows msi(インストーラ) パッケージ (サンプルの実行ができます。)

C++,Python,Java,
Toolsを含む
1.2.1-RELEASE

RTコンポーネントを開発するためには開発環境のインストールが必要です。詳細はダウンロードページ

統計

Webサイト統計
ユーザ数:1840
プロジェクト統計
RTコンポーネント297
RTミドルウエア28
ツール22
文書・仕様書1

Choreonoid

モーションエディタ/シミュレータ

OpenHRP3

動力学シミュレータ

OpenRTP

統合開発プラットフォーム

産総研RTC集

産総研が提供するRTC集

TORK

東京オープンソースロボティクス協会

DAQ-Middleware

ネットワーク分散環境でデータ収集用ソフトウェアを容易に構築するためのソフトウェア・フレームワーク