[openrtm-users 02378] rtprint でのフォーマッタの使い方について

Kei Okada k-okada @ jsk.t.u-tokyo.ac.jp
2012年 1月 5日 (木) 22:31:25 JST


岡田です.

いつもお世話になります.本年もよろしくお願いします.
早速ですが,
http://www.openrtm.org/pub/OpenRTM-aist/tools/rtshell/3.0/ja/rtprint.html
にある,

> $ rtprint /localhost/ConsoleIn0.rtc:out#printers.my_formatter
>
> ConsoleIn0.rtc の out ポートの最初の値を printers モジュールの my_formatter 関数に送って結果を表示します。

という便利な機能を見つけたので使おうとしたのですが,
$ rtprint localhost/SequencePlayer0.rtc:qRef
comp_args: rtprint_reader0?exec_cxt.periodic.type=PeriodicExecutionContext&exec_cxt.periodic.rate=100.0
[0.000000000] [7.673073771999763e-14, -3.1496517535800726e-06,
-3.149633230452652e-06, -1.7323215873923887e-05,
-5.17454292139448e-06, 8.998955333107988e-06, -1.6496828591857673e-06,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

$ rtprint localhost/SequencePlayer0.rtc:qRef#printers.my_formatter
rtprint: global name 'rts_exceptions' is not defined

となっていしまします.
カレントディレクトリは以下のファイルがあります.
簡単なことだとは思うのですが,正しい利用方法を
ご教示いただけると幸いです.

$ cat printers.py
#!/usr/bin/env python

def my_formatter(a):
    print a


openrtm-users メーリングリストの案内