Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonスクリプトから簡単に動かしたい #340

Closed
YoheiKakiuchi opened this issue Feb 28, 2014 · 11 comments
Closed

pythonスクリプトから簡単に動かしたい #340

YoheiKakiuchi opened this issue Feb 28, 2014 · 11 comments
Assignees

Comments

@YoheiKakiuchi
Copy link
Member

python scriptから動かすときに最も短く書いてみたのが以下なのですが、
もっと短くできるでしょうか? または他にいい方法がありますか?

import roslib
roslib.load_manifest("hrpsys")
import OpenRTM_aist.RTM_IDL # for catkin
import sys

import hrpsys
from hrpsys.hrpsys_config import *
import OpenHRP

import os
import rtm

from rtm import *
from OpenHRP import *

import socket
import time

initCORBA()
seq = rtm.findRTC('seq')
srv = seq.service('service0')
srv.setJointAngle('LLEG_HIP_R', 0.0, 1.0)
@k-okada
Copy link
Member

k-okada commented Feb 28, 2014

rosrun hrpsys_tools hrpsys_tools_config.py
はどうでしょうか?init()すると接続するのが怖いのであれば,init()せずにCreateCompsだけやるようなものあるいは,findComps()みたいなのだけ呼ぶ,というふうにするでしょうか?

いずれにせよ,importの順番などわかりにくいところがあるので,なにか共通のプログラムを使うのがいいですよね.

https://github.com/start-jsk/rtmros_common/blob/master/hrpsys_tools/scripts/hrpsys_tools_config.py

https://code.google.com/p/hrpsys-base/source/browse/trunk/python/hrpsys_config.py

@k-okada
Copy link
Member

k-okada commented Mar 1, 2014

#345 で hrpsys_tool_config.pyにインタラクティブモードを追加しました.

roscd hrpsys_tools/scripts
ipython ./hrpsys_tools_config.py -- --host xxxx --port xxxx 

で期待していることが出来ると思います.hrpsys-baseのhttps://code.google.com/p/hrpsys-base/source/detail?r=1008 の変更が反映されている必要があります.

使ってみてフィードバックをお願いします.

@k-okada
Copy link
Member

k-okada commented Mar 19, 2014

close if this is ok

@130s
Copy link
Contributor

130s commented Apr 27, 2014

+1 I'm willing to test

@k-okada
Copy link
Member

k-okada commented Apr 27, 2014

@snozawa
Copy link
Contributor

snozawa commented Apr 27, 2014

追加していただいたインタラクティブモード、とても重要な機能ですが、
hrpsys_tools_config.pyをなぜか使ってなかったです。

なぜかをよくよく考えると、使っているロボットのシミュレーション環境ではgetRTCListがちがっていて、
https://github.com/start-jsk/rtmros_common/blob/master/hrpsys_tools/test/test-hrpsys-config.test
のサンプルのようにHrpsysConfiguratorを継承して使っているので、
hrpsys_tools_config.pyのインタラクティブモードを使ってなかったように思います。

hrpsys_tools_config.pyのmainの中にかいてあるような引数のパースなどを、
hcfのメンバ関数のようにしておくと、継承しても簡単につかえるようになりそうな予感がします。

@snozawa
Copy link
Contributor

snozawa commented Apr 27, 2014

ちなみに、hironxはどうしてますか?
getRTCListをうわがいていると思うので、hrpsys_tools_config.pyでない方法をつかっているのでしょうか?

@130s
Copy link
Contributor

130s commented Apr 28, 2014

For hiro,

your guess is right; hiro's program interface extends HrpsysConfigurator and overrides getRTCList and is not currently using hrpsys_tools_config.py (I haven't been aware of this script until recently).

@130s
Copy link
Contributor

130s commented Apr 28, 2014

hrpsys_tools_config.pyのmainの中にかいてあるような引数のパースなどを、
hcfのメンバ関数のようにしておくと、継承しても簡単につかえるようになりそうな予感がします。

+1

I actually realized that I don't know how I can integrate hrpsys_tools_config.py with the robot's interface class, say HIRONX (that currently extends HrpsysConfigurator) that is called from another script "hironx.py". In these scripts, I think we want to instantiate the derived robot class (HIRONX in hiro), and its parent HrpsysConfigurator isn't enough.

@k-okada I might be misunderstanding something but can I ask what is the intended usecase for hrpsys_tools_config.py?

@k-okada
Copy link
Member

k-okada commented Apr 30, 2014

what is the intended usecase for hrpsys_tools_config.py?

instead of every one start writing they own "small python code just for now..." as
#340 (comment)

@k-okada
Copy link
Member

k-okada commented Apr 30, 2014

I think adding argument parsing in extends HrpsysConfigurator and overrides getRTCList is right direction.

but since I have very poor python knowledge and experience so I do not undersntand what is doing around https://github.com/start-jsk/rtmros_common/pull/345/files#diff-2a584a188be430268e2456bda54bddd8R44 and not sure at all.

So in order to test and get feedback if you dont have your own client for your robot, please run ./hrpsys_tools_config.py and this loads stableRTC, it will be ok for most of your work and if you'd like to configure your own RTC, use findRTC() manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants