※이후의 설명은 편의상 OpenRTM-aist-0.4.0에 대해 쓰여져 있습니다. OpenRTM-aist-0.4.x에 대해서도 같은 순서로 인스톨 할 수 있습니다.
프로그램 메뉴에 등록되어 있는 샘플 프로그램은 디폴트로 로컬 호스트의 CORBA 네임서버를 사용하도록 설정되어 있습니다. 따라서, 다음의 어느 방법(인스톨 방법에 의해 다소 차이가 생깁니다)으로 우선 CORBA 네임서버를 기동할 필요가 있습니다.
| ConsoleInComp.exe | 콘솔로부터 입력된 수치를 OutPort로부터 출력한다. ConsoleOutComp.exe와 연결해 사용 |
| ConsoleOutComp.exe | InPort에 입력된 수치를 콘솔에 표시하는 컴포넌트. ConsoleInComp.exe와 연결해 사용 |
| SequenceInComp.exe | 랜덤인 수치(Short,Long,Float,Double과 그 순서형)을 출력하는 컴포넌트. SequenceOutComp.exe와 연결해 사용 |
| SequenceOutComp.exe | InPort에 입력되는 수치(Short,Long,Float,Double와 그 순서형)을 표시. SequenceInComp.exe와 연결해 사용 |
| MyServiceProviderComp.exe | MyService형의 서비스를 제공하는 컴포넌트. MyServiceConsumerComp.exe와 연결해 사용 |
| MyServiceConsumerComp.exe | MyService형의 서비스를 제공하는 컴포넌트. MyServiceProviderComp.exe와 연결해 사용 |
| ConfigSampleComp.exe | Configuration의 샘플. RtcLink로부터 Configuration를 변경해 Configuration의 거동을 이해하기 위한 샘플. |
| USBCameraAcquireComp.exe | USB 카메라로부터 화상을 취득해 OutPort로부터 출력하는 default 컴포넌트. USBCameraMonitor.exe와 연결해 사용 |
| USBCameraMonitor.exe | InPort에 입력되는 화상을 화면에 표시하는 컴포넌트. USBCameraAquire.exe와 연결해 사용 |
> 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.idlrtc-template에 대해서 작성하고 싶은 컴포넌트의 설정을 인수로서 건네주면, 컴포넌트의 양식을 작성합니다. 여기에서는 help의 표시의 마지막에 표시된Example:이하의 서비스 포트에 관한 기술 이외를 복사하고 시험해 보겠습니다.
※ Windows환경에서 CUI판의 rtc-template를 실행하는 경우, 서비스 포트에 관한 옵션은 사용할 수 없습니다.
※ Windows판 컴포넌트에서 서비스 포트를 사용하고 싶은 경우는 UNIX 환경에서 rtc-template를 실행 후에 Windows상의 컴파일러에서 컴포넌트를 빌드하거나, Eclipse판 RtcTemplate를 이용해 코드의 양식을 생성해 주십시오. Eclipse판 RtcTemplate에서는 Windows상에서도 서비스 포트를 가지는 컴포넌트의 양식을 생성하는 것이 가능해지고 있습니다.
커멘드 prompt로부터 커멘드 입력을 실시하는 일도 할 수 있습니다만, 이번은 이하와 같은 배치파일(gen.bat)을 임의의 폴더에 작성해 봅니다. NOTES: OpenRTM-aist-0.4.2에서는 -bvcproject 옵션은 불필요해졌습니다.
@echo off rtc-template.py -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 pause
배치파일을 실행하면, 이하와 같은 메세지가 표시된 DOS창이 열려, 컴포넌트의 C++의 코드, VC++용 프로젝트 파일이 작성(OpenRTM-aist-0.4.2의 경우).
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. 계속하려면 아무 키나 눌러 주세요 . . .
copyprops.bat라고 하는 배치파일이 작업 폴더내에 생성되고 이것을 실행합니다.
>copyprops.bat
copy "(RTM_ROOT) \etc\rtm_config.vsprops" .
1 개의 파일을 복사했습니다.>copyprops.bat copy "(RTM_ROOT) \etc\rtm_config.vsprops" . 지정된 파일이 발견되지 않습니다.
여기서, Sample_vc8.sln(개발 환경이 VC2005의 경우)를, 혹은 Sample_vc9.sln(같이 VC2008의 경우)를 더블 클릭 하면 Visual Studio 등의 개발 환경이 기동됩니다. 「솔루션의 리빌드」를 실시하는 것으로 실행 형식의 컴포넌트SampleComp.exe가 작성됩니다(통상은 작업 폴더\SampleComp\Debug에 작성됩니다).
※프로젝트를 빌드하기 위해서는 Visual Studio 등의 VC++개발 환경이 인스톨 되어 있어야 합니다. VC++개발 환경의 인스톨에 대해서는 Windows계 시스템으로의 빌드 를 참조해 주십시오.
SampleComp.exe 의 동작을 확인하려면 , 이하의 순서를 따릅니다.
corba.nameservers: localhost naming.formats: %n.rtc
→ 참고: 샘플의 실행