인스톨이 정상적으로 종료하면, 부속 샘플로 동작 테스트를 합니다. 샘플은,{prefix}* /share/OpenRTM-aist/examples에 있습니다(다만, 스스로 빌드·인스톨 했을 경우는 인스톨 디렉토리 이하의 /examples/<샘플 컴포넌트 세트명>에 있습니다). 샘플 컴포넌트 세트 SimpleIO를 사용하고, 샘플 컴포넌트와 OpenRTM-aist의 동작을 확인합니다.
{prefix}*: 통상은 Linux 라면 /usr 그 이외에서는 /usr/local인 경우가 대부분입니다.
샘플 컴포넌트 세트 SimpleIO:
RT 컴포넌트 ConsoleInComp, ConsoleOutComp와 이것들의 통신을 접속하는 ConnectorComp로 된 샘플 세트입니다. 이 세트는 ConsoleInComp에게 준 수치를 ConsoleOutComp에 표시시키는 「가장 간단한 I/O 데몬스트레이션」을 목적으로 한 샘플입니다. ConsoleInComp로부터 ConsoleOutComp에 접속해, 그 통신을 개시시키는 것이 ConnectorComp의 역할입니다.
◆ 편의상 샘플은 usr/share/OpenRTM-aist/examples 이하에 있는 것으로서 설명을 기술합니다.
$ rtm-naming 2809 tarting omniORB omniNames: localhost.localdomain:9876 $ Wed Jun 4 23:03:09 2008: Starting omniNames for the first time. Wrote initial log file. Read log file successfully. Root context is IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000006400000001010200100000003139322e3136382e3130302e32333600942600000b0000004e616d6553657276696365000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100 Checkpointing Phase 1: Prepare. Checkpointing Phase 2: Commit. Checkpointing completed.
*패스는{prefix} /bin/rtm-naming. 대부분, which rtm-naming 로 검색할 수 있습니다.
corba.nameservers:iiop:1.0@orbexpress:2809 corba.id:oeORB naming.formats: %n.rtc logger.log_level: PARANOID
corba.nameservers:iiop:1.0@orbexpress:2809 corba.endpoint:orbexpress:5012 corba.id:oeORB naming.formats: %n.rtc logger.log_level: PARANOID
corba.nameservers:iiop:1.0@orbexpress:2809 corba.endpoint:orbexpress:5013 corba.id:oeORB naming.formats: %n.rtc logger.log_level: PARANOID
$cd /usr/share/OpenRTM-aist/examples/SimpleIO $./gen_conf.sh
$/usr/share/OpenRTM-aist/examples/ConsoleInComp -f ~/RTCwork/rtcconin.conf [ manager: _orbexpress_31210: Server available [null class] / orbexpress_31210 ] [ manager: _orbexpress_31210: Configuration: tcp://orbexpress:5012 ] [ manager: _orbexpress_31210: NEW CONNECTION to 'tcp://orbexpress:2809' ] Creating a component: "ConsoleIn"....succeed. ================================================= Component Profile ------------------------------------------------- InstanceID: ConsoleIn0 Implementation: ConsoleIn Description: Console input component Version: 1.0 Maker: Noriaki Ando, AIST Category: example Other properties ================================================= ================================================= Port0 (name): out ------------------------------------------------- - properties - port.port_type: DataOutPort dataport.data_type: TimedLong dataport.interface_type: CORBA_Any dataport.dataflow_type: Push, Pull dataport.subscription_type: Flush, New, Periodic -------------------------------------------------
스스로 빌드·인스톨 했을 경우는, {인스톨 디렉토리}/examples/SimpleIO/로 이동하고 나서
${인스톨 디렉토리}/examples/SimpleIO/
$./ConsoleInComp -f rtcconin.conf그리고 ConsoleInComp를 기동합니다.
$/usr/share/OpenRTM-aist/examples/ConsoleOutComp -f ~/RTCwork/rtcconout.conf $./ConsoleOutComp -f rtcconout.conf [ manager: _orbexpress_31242: Server available [null class] / orbexpress_31242 ] [ manager: _orbexpress_31242: Configuration: tcp://orbexpress:5013 ] [ manager: _orbexpress_31242: NEW CONNECTION to 'tcp://orbexpress:2809' ] succeed. ================================================= Component Profile ------------------------------------------------- InstanceID: ConsoleOut0 Implementation: ConsoleOut Description: Console output component Version: 1.0 Maker: Noriaki Ando, AIST Category: example Other properties ================================================= ================================================= Port0 (name): in ------------------------------------------------- - properties - port.port_type: DataInPort dataport.data_type: TimedLong dataport.interface_type: CORBA_Any dataport.dataflow_type: Push, Pull dataport.subscription_type: Any -------------------------------------------------
자신이 빌드·인스톨 했을 경우는, {인스톨 디렉토리}/examples/SimpleIO/로 이동하고 나서
${인스톨 디렉토리}/examples/SimpleIO/
$./ConsoleOutComp -f rtcconout.conf$/usr/share/OpenRTM-aist/examples/ConnectorComp Subscription Type: [ : _orbexpress_32078: NEW CONNECTION to 'tcp://localhost:2809' ] [ : _orbexpress_32078: NEW CONNECTION to 'tcp://orbexpress:5012' ] [ : _orbexpress_32078: NEW CONNECTION to 'tcp://orbexpress:5013' ] Connector ID: 26123142-0000-2000-0100-000c29123441 dataport.interface_type: CORBA_Any dataport.dataflow_type: Push dataport.subscription_type: dataport.corba_any.outport_ref: not a string value dataport.corba_any.inport_ref: not a string value
스스로 빌드·인스톨 했을 경우는, {인스톨 디렉토리}/examples/SimpleIO/로 이동하고 나서
$cd {인스톨 디렉토리}/examples/SimpleIO/
$./ConnectorCompPlease input number:
컴포넌트의 템플릿 제네레이터를 사용하여 간단한 컴포넌트를 작성하는 테스트를 합니다. 템플릿 제네레이터(rtc-template)를 사용합니다.
> cd > mkdir SampleComponent > cd SampleComponent
> rtc-template --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();
};> 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 File "MyServiceSVC_impl.h" was generated. File "MyServiceSVC_impl.cpp" was generated. File "Sample.h" was generated. File "Sample.cpp" was generated. File "SampleComp.cpp" was generated. File "Makefile.Sample" was generated. File "SampleComp_vc8.vcproj" was generated. File "Sample_vc8.vcproj" was generated. File "SampleComp_vc9.vcproj" was generated. File "Sample_vc9.vcproj" was generated. File "Sample_vc8.sln" was generated. File "Sample_vc9.sln" was generated. File "copyprops.bat" was generated. File "user_config.vsprops" was generated. File "README.Sample" was generated. File "Sample.yaml" was generated. > ls Makefile.Sample Sample.h Sample_vc8.vcproj MyService.idl Sample.yaml Sample_vc9.sln MyServiceSVC_impl.cpp SampleComp.cpp Sample_vc9.vcproj MyServiceSVC_impl.h SampleComp_vc8.vcproj YourService.idl README.Sample SampleComp_vc9.vcproj copyprops.bat Sample.cpp Sample_vc8.sln user_config.vsprops
> make -f Makefile.Sample 혹은 > mv Makefile.Sample Makefile > make
> make -f Makefile.Sample
:
중략
:
g++ -o SampleComp Sample.o MyServiceSkel.o YourServiceStub.o MyServiceSVC_impl.o SampleComp.o `rtm-config --libs`
> ls
Makefile.Sample README.Sample Sample_vc9.sln
MyService.hh Sample.cpp Sample_vc9.vcproj
MyService.idl Sample.h YourService.hh
MyServiceDynSK.cc Sample.o YourService.idl
MyServiceSK.cc Sample.so YourServiceDynSK.cc
MyServiceSVC_impl.cpp Sample.yaml YourServiceSK.cc
MyServiceSVC_impl.h SampleComp YourServiceSkel.cpp
MyServiceSVC_impl.o SampleComp.cpp YourServiceSkel.h
MyServiceSkel.cpp SampleComp.o YourServiceStub.cpp
MyServiceSkel.h SampleComp_vc8.vcproj YourServiceStub.h
MyServiceSkel.o SampleComp_vc9.vcproj YourServiceStub.o
MyServiceStub.cpp Sample_vc8.sln copyprops.bat
MyServiceStub.h Sample_vc8.vcproj user_config.vsprops> rtm-naming [포트 번호]
> rtm-naming Starting omniORB omniNames: rtm:2809 n-ando@rtm:/tmp/SampleComponent> Fri Apr 27 03:53:09 2007: Starting omniNames for the first time. Wrote initial log file. Read log file successfully. Root context is IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e300000010000000000000060000000010102000e0000003135302e32392e39362e31363900611e0b0000004e616d6553657276696365000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100 Checkpointing Phase 1: Prepare. Checkpointing Phase 2: Commit. Checkpointing completed.
$ rtm-naming Starting omniORB omniNames: localhost.localdomain: omniORB: Error: Unable to create an endpoint of this description: giop:tcp::2809 Failed to initialise the POAs. Is omniNames already running? $
corba.nameservers:iiop:1.0@orbexpress:2809 corba.endpoint:orbexpress:5010 corba.id:oeORB naming.formats: %n.rtc logger.log_level: PARANOID
corba.nameservers: rtm.or.jp:2809
> ./SampleComp -f rtc.conf 혹은 > ./SampleComp (디폴트로 커런트 디렉토리의 rtc.conf를 읽어들인다)
2008/6/20 片見