부속의 샘플 RT컴포넌트를 이용하여 동작 확인을 실시합니다. "내 컴퓨터"에서 SimpleIO ※1 폴더를 표시해, 그 중의 run.py 를 더블 클릭 합니다. ※2 처음에 터미널 화면이 3개 열리고, 몇초후에 또 하나 열립니다. 4번째의 터미널 화면이 열릴 때까지, 반드시 기다려 주십시오. "Please input number:"라고 표시되고 있는 윈도우에 숫자를 입력합니다. ※3 입력하는 숫자는 long int 에 들어가는 범위의 값을 입력해 주십시오. 그러면 다른 한쪽의 윈도우에서 입력한 수치와 같은 수치가 나타납니다. 여기까지 할 수 있으면 OpenRTM-aist-Python이 정상적으로 인스톨 되고 있는 것을 알 수 있습니다.
인스톨러를 사용했을 경우는 통상 C:\Program Files\OpenRTM-aist\0.4\examples\Python\SimpleIO에, 소스로부터 빌드 했을 경우 <소스의 전개 폴더>\OpenRTM\examples\SimpleIO에 각각 인스톨 되고 있습니다.
다음으로 컴포넌트의 템플릿 제네레이터를 사용하여 간단한 컴포넌트를 작성하는 테스트를 실시합니다. 템플릿 제네레이터 (rtc-template.py)를 사용합니다. 또한 여기에서는 편의상 Python2.4를 사용하는 환경에서의 예를 들고 있습니다. Python2.5 를 사용하는 환경에서는 Python24라고 부분을 Python25로 수정하여 사용해 주십시오.
> cd C:\Documents and Settings\<user name>\SampleComponent
> C:\Python24\Lib\site-packages\OpenRTM\rtc-template\rtc-template.py --help
Usage: rtc-template [OPTIONS]
Options:
[-h] Print short help.
[--help] Print details help.
[--backend[=backend] or -b] Specify template code generator.
[--module-name[=name]] Your module name.
[--module-desc[=description]] Module description.
[--module-version[=version]] Module version.
[--module-vendor[=vendor]] Module vendor.
[--module-category[=category]] Module category.
[--module-comp-type[=component_type]] Component type.
[--module-act-type[=activity_type]] Component's activity type.
[--module-max-inst[=max_instance]] Number of maximum instance.
[--module-lang[=language]] Language.
[--config[=ParamName:Type:Default]] Configuration variable.
[--inport[=PortName:Type]] InPort's name and type.
[--outport[=PortName:Type]] OutPort's name and type
[--service[=PortName:Name:Type]] Service Provider Port
[--service-idl[=IDL_file]] IDL file name for service
[--consumer[=PortName:Name:Type]] Service Consumer Port
[--consumer-idl[=IDL_file]] IDL file name for consumer
[--idl-include=[path]] Search path for IDL compile
:
중략
:
Example:
rtc-template -bcxx --module-name=Sample --module-desc='Sample component' --module-version=0.1 --module-vendor=AIST --module-category=Generic --module-comp-type=DataFlowComponent --module-act-type=SPORADIC --module-max-inst=10 --config=int_param0:int:0 --config=int_param1:int:1 --config=double_param0:double:3.14 --config=double_param1:double:9.99 --config="str_param0:std::string:hoge" --config="str_param1:std::string:foo" --inport=Ref:TimedFloat --inport=Sens:TimedFloat --outport=Ctrl:TimedDouble --outport=Monitor:TimedShort --service=MySvcPort:myservice0:MyService --consumer=YourSvcPort:yourservice0:YourService --service-idl=MyService.idl --consumer-idl=YourService.idl interface MyService
{
void echo();
}; interface YourService
{
void echo();
}; > python C:\Python24\Lib\site-packages\OpenRTM\rtc-template\rtc-template.py -bpython^
--module-name=Sample --module-desc="Sample component"^
--module-version=0.1 --module-vendor=AIST --module-category=Generic^
--module-comp-type=DataFlowComponent --module-act-type=SPORADIC^
--module-max-inst=10^
--config=int_param0:int:0 --config=int_param1:int:1^
--config=double_param0:double:3.14 --config=double_param1:double:9.99^
--config="str_param0:std::string:hoge"^
--config="str_param1:std::string:foo"^
--inport=Ref:TimedFloat --inport=Sens:TimedFloat^
--outport=Ctrl:TimedDouble --outport=Monitor:TimedShort^
--service=MySvcPort:myservice0:MyService^
--consumer=YourSvcPort:yourservice0:YourService^
--service-idl=MyService.idl --consumer-idl=YourService.idl
File "MyService_idl_example.py" was generated.
File "Sample.py" was generated.
File "README.Sample" was generated.
> dir
2008/06/25 12:28 <DIR> .
2008/06/25 12:28 <DIR> ..
2008/06/25 12:27 45 MyService.idl
2008/06/25 12:28 2,226 MyService_idl.py
2008/06/25 12:28 1,341 MyService_idl_example.py
2008/06/25 12:28 3,557 README.Sample
2008/06/25 12:28 4,615 Sample.py
2008/06/25 12:27 47 YourService.idl
2008/06/25 12:28 2,312 YourService_idl.py
2008/06/25 12:28 <DIR> _GlobalIDL
2008/06/25 12:28 <DIR> _GlobalIDL__POA rtc-template.py를 실행할 때에 매회 커멘드 입력하는 것은 불편하므로, 이하와 같은 배치파일을 작성해 사용하는 것을 추천합니다.
python C:\Python24\Lib\site-packages\OpenRTM\rtc-template\rtc-template.py -bpython^
--module-name=Sample --module-desc="Sample component"^
--module-version=0.1 --module-vendor=AIST --module-category=Generic^
--module-comp-type=DataFlowComponent --module-act-type=SPORADIC^
--module-max-inst=10^
--config=int_param0:int:0 --config=int_param1:int:1^
--config=double_param0:double:3.14 --config=double_param1:double:9.99^
--config="str_param0:std::string:hoge"^
--config="str_param1:std::string:foo"^
--inport=Ref:TimedFloat --inport=Sens:TimedFloat^
--outport=Ctrl:TimedDouble --outport=Monitor:TimedShort^
--service=MySvcPort:myservice0:MyService^
--consumer=YourSvcPort:yourservice0:YourService^
--service-idl=MyService.idl --consumer-idl=YourService.idl> python "C:\Program Files\OpenRTM-aist\0.4\bin\rtm-naming.py" [포트 번호] 또는, C:\Program Files\OpenRTM-aist\0.4\bin로 커런트를 이동하고 나서 >python rtm-naming.py을 하던지 또는, C:\Program Files\OpenRTM-aist\0.4\bin\에 있는 rtm-naming.py를 더블 클릭
> python "C:\Program Files\OpenRTM-aist\0.4\bin\rtm-naming.py" Starting omniORB omniNames: localhost : 2809 Starting omniNames for the first time. Wrote initial log file. Read log file successfully. Root context is IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e300000010000000000000060000000010102000e0000003135302e32392e39362e31363700f90a0b0000004e616d6553657276696365000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100 Checkpointing Phase 1: Prepare. Checkpointing Phase 2: Commit. Checkpointing completed.
corba.nameservers: 네임서버명:포트 번호 naming.formats: %n.rtc logger.log_level: PARANOID
corba.nameservers: localhost naming.formats: %n.rtc logger.log_level: PARANOID
> python Sample.py -f rtc.conf 혹은 > python Sample.py (디폴트로 커런트 디렉토리의 rtc.conf를 읽어들인다) 혹은 Sample.py를 더블 클릭