ORBexpress의 동작확인

샘플을 사용해 테스트

 인스톨이 정상적으로 종료하면, 부속 샘플로 동작 테스트를 합니다. 샘플은,{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 이하에 있는 것으로서 설명을 기술합니다.


  • 1.네임서버를 기동
    우선, rtm-naming*로 네임서버를 기동합니다.이 때 포토 넘버는 2809를 지정해 주세요.
     $ 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 로 검색할 수 있습니다.


  • 2.RTC 컨피그레이션 파일의 작성, 배치
    테스트를 위한 RTC 컨피그레이션 파일을 작성, 배치합니다. 우선, 적당한 작업 디렉토리를 만듭니다. 여기에서는 편의상 홈 디렉토리 바로 아래의 RTCwork라는 디렉토리를 작업 디렉토리로 하겠습니다. 작업 디렉토리 RTCwork에 이하의 파일을 작성해 배치합니다.
    • rtc.conf
       corba.nameservers:iiop:1.0@orbexpress:2809
       corba.id:oeORB
       naming.formats: %n.rtc
       logger.log_level: PARANOID
    • rtcconin.conf(ConsoleInComp용 컨피그레이션 파일)
       corba.nameservers:iiop:1.0@orbexpress:2809
       corba.endpoint:orbexpress:5012
       corba.id:oeORB
       naming.formats: %n.rtc
       logger.log_level: PARANOID
    • rtcconout.conf(ConsoleOutComp용 컨피그레이션 파일)
       corba.nameservers:iiop:1.0@orbexpress:2809
       corba.endpoint:orbexpress:5013
       corba.id:oeORB
       naming.formats: %n.rtc
       logger.log_level: PARANOID
       
      자신이 빌드·인스톨 했을 경우는, {인스톨 디렉토리}/examples/SimpleIO/로 이동하고 나서 컨피그레이션 파일을 생성하는 셸 스크립트( gen_conf.sh )를 실행합니다.
       $cd /usr/share/OpenRTM-aist/examples/SimpleIO
       $./gen_conf.sh
      실행 후에는, 이하의 RTC 컨피그레이션 파일이 생성됩니다.
    • rtc.conf
    • rtcconin.conf(ConsoleInComp용 컨피그레이션 파일)
    • rtcconout.conf(ConsoleOutComp용 컨피그레이션 파일)

  • 3.ConsoleInComp의 기동~
    터미널을 기동하고, 다음과 같이2.에서 작성한 rtcconin.conf 를 참조시키는 형태로 ConsoleInComp를 기동합니다.
     $/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를 기동합니다.


  • 4.ConsoleOutComp의 기동
    터미널을 기동하고, 다음과 같이 2.에서 작성한 rtcconin.conf 를 참조하는 형태로 ConsoleOutComp를 기동합니다.
     $/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
그리고 ConsoleOutComp 를 기동합니다.


  • 5.ConnectorComp의 기동
    터미널을 기동하고, 다음과 같이 ConnectorComp를 기동합니다.
     $/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/
 $./ConnectorComp
그리고 ConnectorComp를 기동합니다.


  • 6.ConsoleInComp의 터미널에 숫자를 입력
    5.ConnectorComp을 기동 후에, ConsoleInComp측의 터미널에
     Please input number: 
    라는 prompt가 나타나므로, 거기에 숫자를 입력합니다. 입력하는 숫자는 short int에 들어가는 범위의 수치를 입력해 주십시오.

  • 7.그 숫자가 ConsoleOutComp의 터미널상에 표시
     ConsoleInComp 측의 터미널에 숫자를 입력하면, ConsoleOutComp 측의 터미널에 입력한 수치가 나타납니다. 여기까지 할 수 있으면, OpenRTM-aist가 정상적으로 인스톨 되고 있는 것을 확인 할 수 있습니다.


컴포넌트 템플릿의 테스트

 컴포넌트의 템플릿 제네레이터를 사용하여 간단한 컴포넌트를 작성하는 테스트를 합니다. 템플릿 제네레이터(rtc-template)를 사용합니다.


  • 1.컴포넌트를 작성하는 작업 디렉토리의 준비
     컴포넌트를 작성하는 디렉토리(임의의 디렉토리에서 좋습니다.)를 작성하고, 거기서 컴포넌트를 작성해 컴파일 해 보겠습니다.
     > cd 
     > mkdir SampleComponent
     > cd SampleComponent

  • 2.rtc-template의 기동 확인
     먼저 help를 봐주십시오.
     > 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
    rtc-template에 대해서 작성하고 싶은 컴포넌트의 설정을 인수로서 건네주면, 컴포넌트의 양식을 작성합니다. 여기에서는 help 의 표시의 마지막에 표시된 Example: 이하를 복사해 테스트 해보겠습니다.

  • 3.MyService.idl 와 YourService.idl의 준비
     Example: 의 예에서는, 서비스 프로바이더로서 MyService, 서비스 컨슈머로서 YourService를 이용하는 옵션이 주어지고 있어 그것을 위해 IDL 파일이 커런트 디렉토리에 위치해야 합니다. 여기에서는, 간단한 IDL 파일을 이하와 같이 작성해 둡니다.
    • MyService.idl
       interface MyService 
       {
         void echo();
       };
    • YourService.idl
       interface YourService
       {
          void echo();
       };

  • 4.rtc-template를 실행해 템플릿 코드를 생성
     이러한 파일을 작성하면 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
       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

  • 5.make
     4.의 결과, 위와 같이 컴포넌트의 C++의 코드, 서비스의 구현 코드 및 Makefile 등(그 밖에 VC++관련의 파일=Windows용을 포함한다)이 작성됩니다. 여기서,
     > make -f Makefile.Sample
     혹은
     > mv Makefile.Sample Makefile
     > make
    로 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
    이것으로, loadable module판의 컴포넌트(Sample.so)와 실행 형식의 컴포넌트(SampleComp)가 작성되었습니다.

  • 6.컴포넌트의 실행 준비:네임서버의 기동
     작성된 실행 형식의 컴포넌트를 실행해 보겠습니다. 우선, 그 준비를 시작합니다.
     우선, CORBA의 네임 서비스를 기동합니다. CORBA의 네임 서비스는,
     > rtm-naming [포트 번호]
    위의 명령어 기동할 수 있기 때문에 8.에서 작성하는 rtc.conf에 설정하는 포트 번호를 지정해 기동해 주십시오. 아무것도 지정하지 않으면 디폴트 포트(2809)를 사용합니다. 여기에서는 디폴트 포트를 사용하는 예를 들고 있습니다.
     > 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를 기동하면, 다음과 같은 표시가 나타나는 경우가 있습니다.
     $ 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?
     $
    이것은 해당 포토를 사용한 네임서버가 이미 기동되고 있는 것을 나타내고 있습니다. 이 경우는 그대로 다음의 7.로 진행해도 괜찮습니다.

  • 7.컴포넌트의 실행 준비:RtcLink를 기동
     다음으로 컴포넌트를 조작하기 위한 GUI 툴:RtcLink를 기동합니다(RtcLink에 대한 자세한 내용은RtcLink >를, 또 인스톨 방법 등은RtcLink·RtcTemplate의 인스톨 을 참조해 주십시오).

  • 8.컴포넌트의 실행 준비:rtc.conf의 배치
     컴포넌트의 실행에는 컨피그레이션 파일(통상은 rtc.conf라는 이름)이 필요합니다. 여기에서는 다음과 같은 *를 커런트 디렉토리(작업 디렉토리)에 작성, 배치합니다.
    • rtc.conf
       corba.nameservers:iiop:1.0@orbexpress:2809
       corba.endpoint:orbexpress:5010
       corba.id:oeORB
       naming.formats: %n.rtc
       logger.log_level: PARANOID

*NOTES:

 corba.nameservers: rtm.or.jp:2809
과 같이 corba.nameservers: 에는 호스트명 혹은 IP주소와 포트 번호(rtm.or.jp는 호스트명, 2809는 포트 번호)를 줄 수 있습니다.


  • 9.컴포넌트를 기동
     마지막으로, 컴포넌트를 기동합니다.
     > ./SampleComp -f rtc.conf
     혹은
     > ./SampleComp (디폴트로 커런트 디렉토리의 rtc.conf를 읽어들인다)
    이것으로, 컴포넌트를 기동할 수 있고 RtcLink상에
      • InPort를 2개
      • OutPort를 2개
      • 서비스 포트를 2개
      • 컨피그레이션을 6개
를 가지는 컴포넌트가 표시되면, OpenRTM-aist-0.4.2-ORBexpress 가 정상적으로 인스톨 된 것을 확인할 수 있습니다. 구체적인 컴포넌트의 작성의 방법은 여기를 참조해 주십시오.

개판 이력

2008/6/20 片見