[openrtm-users 00525] Re: サービスポートのRTC以外からの利用に関して

野村 琢磨 nomura-takuma @ jp.yamatake.com
2008年 7月 10日 (木) 21:45:43 JST


$B$*@$OC$K$J$j$^$9!#-j;3Ip$NLnB<$G$9!#(B

$B8E$$OC$G62=L$G$9$,!"0JA0$N(BML$B$N(BNo.266$B!I(BRe: $B%5!<%S%9%]!<%H$N(BRTC$B0J30$+$i$NMxMQ$K4X$7$F!I(B
$B$G>R2pD:$$$?J}K!$r;29M$K!"%3%s%]!<%M%s%H0J30$N%W%m%0%i%`$+$i%5!<%S%9%]!<%H$r8F$S=P$9=hM}$r<BAu$7$F$$$^$9!#(B

$BDs<(D:$$$?%5%s%W%k$NCf$G5$IU$$$?$N$G$9$,!"(B
ComponentProfile$B$NJQ?t$K$D$$$F$O!"(BComponentProfile_var$B$G$O$J$/DL>o$N%]%$%s%?$,;H$o$l$F$$$^$9!#(B
CORBA$B$N(BIDL$B$GDj5A$5$l$F$$$k%/%i%9$J$N$G!"(B***_var$B%/%i%9$r;H$&$N$, @ 5$7$$J}K!$G$O$J$$$G$7$g$&$+!)(B

***_var$B%/%i%9$r;H$&!JJ}$,NI$$!K>l9g$H!";H$o$J$$!J;H$o$J$/$FNI$$!K>l9g$,$"$k$N$G$7$g$&$+!)(B

$B0J>e!"$4B8CN$NJ}$,$$$i$7$?$i!"$465<(2<$5$$!#(B
$B$I$&$>59$7$/$*4j$$$7$^$9!#(B


----------
$BLnB<!!BvKa(B
$B3t<02q<R!!;3Ip(B
$B @ 8;:5;=Q3+H/It!!<+F02=5;=Q%0%k!<%W(B
$B")(B251-8522$B?@F`@n8)F#Bt;T @ nL>(B1-12-2
TEL:070-6660-5322$B!JD>DL!K(B
E-mail:nomura-takuma @ jp.yamatake.com
URL:http://jp.azbil.com



----- Original Message ----- 
From: "Ando Noriaki" <n-ando @ aist.go.jp>
To: "Fumio Kanehiro" <f-kanehiro @ aist.go.jp>
Cc: <openrtm-users @ m.aist.go.jp>
Sent: Friday, November 16, 2007 9:17 AM
Subject: [openrtm-users 00266] Re: $B%5!<%S%9%]!<%H$N(BRTC$B0J30$+$i$NMxMQ$K4X$7$F(B


> $B6b9-MM(B
>
> $B0BF#$G$9(B
>
>> $B%5!<%S%9%]!<%H$KDj5A$5$l$F$$$k(BIDL$B$N%$%s%?%U%'!<%9$r(BRTC$B0J30$N(B
>> $BDL>o$N(BCORBA$B%/%i%$%"%s%H$+$i8F$S=P$9J}K!$O$"$j$^$9$G$7$g$&$+!)(B
>> $B$I$N$h$&$K$9$k$H%5!<%S%9$N;2>H$r<hF@$G$-$k$G$7$g$&$+!)(B
>
> RTC$B$N(BPort$B$K(Bconnect$B$r$9$k:]$K!"$=$N%]!<%H<+?H$N%*%V%8%'%/%H%j%U%!%l%s%9$N$_(B
> $B$r(BConnectorProfile$B$K%;%C%H$7$F(Bconnect$B$7$F$/$@$5$$!#(B
> $B$=$&$9$k$H!"La$C$F$-$?(BConnectorProfile::properties$B$NCf$K!"(B
> port.[Service Type].[Service Name] $B$H$$$&%-!<$G(BCORBA::Any$B7?$G(B
> $B%*%V%8%'%/%H%j%U%!%l%s%9$,F~$C$F$$$^$9!#(B
> $B$=$l$r!";HMQ$7$?$$%5!<%S%9$N7?$K(Bnarrow$B$7$F;HMQ$7$F$/$@$5$$!#(B
>
> $B$A$g$C$H$4$A$c$4$A$c$7$F$^$9$,!"$*$*$h$=0J2<$N$h$&$K$J$j$^$9!#(B
>
> $B$3$N%U%!%$%k$H(BMakefile$B$rE:IU$7$^$9!#(B
> $BE:IU$N(Btar-ball$B$r(Bexamples/SimpleService$B$N2<$GE83+$7(Bmake$B$7$F$/$@$5$$!#(B
> make -f Makefile.client$B$G(Bmake$B$G$-$^$9!#(B
>
> $B$3$N%W%m%0%i%`$r;n$9<j=g$O0J2<$NDL$j$G$9!#(B
> MyServiceProvider$B$N%5!<%S%9%]!<%H$,(BProvide$B$7$F$k(BMyService$B%$%s%?!<%U%'!<%9$r(B 
> 
> $B<hF@$7$F!"(BMyService$B%$%s%?!<%U%'!<%9$N%*%Z%l!<%7%g%s$G$"$k(Becho()$B$r8F$s$G$$$^$9!#(B
>
> 1. $B%M!<%`%5!<%P$r%m!<%+%k$KN)$A>e$2$k(B
> 2. MyServiceProvider$B$r(Bterminal1$B$GN)$A>e$2$k(B
> 3. terminal2$B$G2<$N%W%m%0%i%`$r%3%s%Q%$%k$7$?$b$N$r5/F0(B
> 4. terminal1$B$G0J2<$N$h$&$KI=<($5$l$k(B
> MyService::echo() was called.
> Message: hogehoge
>
> $B%W%m%0%i%`Cf$K$O%/%i%9%j%U%!%l%s%9$*$h$S(BIDL$B%j%U%!%l%s%9$X$N(BURL$B$b(B
> $B=q$$$F$"$j$^$9$N$GE,59;2>H$7$J$,$i$4$i$s$/$@$5$$!#(B
>
>
> ------------------
> #include <rtm/CorbaNaming.h>
> #include <iostream>
> #include "MyService.hh"
> #include <rtm/NVUtil.h>
>
> int main(int argc, char** argv)
> {
>  CORBA::ORB_var orb;
>  orb = CORBA::ORB_init(argc, argv);
>
>  // RTC::CorbaNaming $B$r;HMQ$7$F%M!<%`%5!<%P$K%"%/%;%9(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/ClassReference/classRTC_1_1CorbaNaming.html
>  RTC::CorbaNaming ns(orb, "localhost");
>
>  // RTObject$B$r<hF@(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/IDLReference/interfaceRTC_1_1RTObject.html
>  CORBA::Object_var obj = ns.resolve("MyServiceProvider0.rtc");
>  RTC::RTObject_var rtc = RTC::RTObject::_narrow(obj);
>
>  // ComponentProfile$B$r<hF@(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/IDLReference/structRTC_1_1ComponentProfile.html
>  RTC::ComponentProfile* prof;
>  prof = rtc->get_component_profile();
>  std::cout << "RTC name: " << prof->instance_name << std::endl;
>
>  // PortProfile$B$r<hF@(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/IDLReference/structRTC_1_1PortProfile.html
>  RTC::PortProfileList port_prof;
>  port_prof = prof->port_profiles;
>  for (CORBA::ULong i(0), len(port_prof.length()); i < len; ++i)
>    {
>      std::cout << "name: " << port_prof[i].name << std::endl;
>
>      // $B%$%s%?!<%U%'!<%9$rI=<($7$F$_$k(B
>      // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/IDLReference/structRTC_1_1PortInterfaceProfile.html
>      RTC::PortInterfaceProfileList  ifs(port_prof[i].interfaces);
>      for (CORBA::ULong j(0), jlen(ifs.length()); j < jlen; ++j)
> {
>   std::cout << "IF name: " << ifs[j].instance_name << std::endl;
>   std::cout << "IF type: " << ifs[j].type_name << std::endl;
>   const char* pol;
>   pol = ifs[j].polarity == RTC::PROVIDED ? "Provided" : "Required";
>   std::cout << "IF polarity: " << pol << std::endl;
> }
>    }
>
>  RTC::Port_var port;
>  port = port_prof[0].port_ref;
>
>
>
>  //
>  // ConnectorProfile $B$N(Bport$B%a%s%P$K<+J,<+?H$N%j%U%!%l%s%9$N$_F~$l$F(B
>  // connect $B$9$k!#La$C$F$-$?(BConnectorProfile$B$N(Bproperties$B$NCf$K$O(B
>  // $B%5!<%S%9$N(BObjectReference$B$,F~$C$F$$$k$N$G<hF@$9$k!#(B
>  //
>  // $B%5!<%S%9$N@\B3$K4X$9$k>pJs$O%/%i%9%j%U%!%l%s%9$N(BCorbaPort$B$r;2>H(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/ClassReference/classRTC_1_1CorbaPort.html
>  //
>  // ConnectorProfile
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/IDLReference/structRTC_1_1ConnectorProfile.html
>  RTC::ConnectorProfile con_prof;
>  con_prof.name = CORBA::string_dup("tekitouna_namae0");
>  con_prof.connector_id = "";
>  con_prof.ports.length(1);
>  con_prof.ports[0] = port;
>  con_prof.properties.length(0);
>  if (CORBA::is_nil(port))
>    {
>      std::cout << "nil reference" << std::endl;
>      return 0;
>    }
>
>  if (port->connect(con_prof) != RTC::RTC_ERROR)
>    {
>      // $B%(%i!<$OL5;k(B
>      std::cout << "ignore error" << std::endl;
>    }
>  std::cout << "connect OK" << std::endl;
>
>  CORBA::Object_ptr aobj;
>  MyService_var mysvc;
>
>  // NVUtil$B$G(Bproperties$B$NCf$+$i%5!<%S%9$N%*%V%8%'%/%H%j%U%!%l%s%9$r<hF@(B
>  // 
> http://www.is.aist.go.jp/rt/OpenRTM-aist/doxygen/ClassReference/namespaceNVUtil.html
>  if (NVUtil::find(con_prof.properties, "port.MyService.myservice0")
>>>= CORBA::Any::to_object(aobj))
>    {
>      mysvc = MyService::_narrow(aobj);
>    }
>
>  // $B%5!<%S%9$r8F$V(B
>  mysvc->echo("hogehoge");
>  // MyServiceProvider$B$r<B9T$7$?2hLL$G0J2<$N$h$&$KI=<($5$l$k$O$:(B
>  //
>  // MyService::echo() was called.
>  // Message: hogehoge
>
>
>
> }
>
>
>
> -- 
> $B0BF#7D><!wFHN)9T@/K!?M;:6H5;=QAm9g8&5f=j(B $B8&5f0w(B
>                   $BCNG=%7%9%F%`8&5fItLg(B $B%?%9%/%$%s%F%j%8%'%s%98&5f%0%k!<%W(B
>                   $B")(B305-8568 $B0q>k8)$D$/$P;TG_1`(B1-1-1 $BCf1{Bh(B2
>                   TEL: 029-861-5981 FAX: 029-861-5971
>                   n-ando @ aist.go.jp, n-ando @ ieee.org
> 




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