Slider_and_Motor/Connector.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # -*- Python -*-
4 
5 import sys
6 
7 from omniORB import CORBA
8 
9 import RTC
10 import OpenRTM_aist
11 
12 
13 def main():
14 
15  # subscription type
16  subs_type = "Flush"
17 
18  # initialization of ORB
19  orb = CORBA.ORB_init(sys.argv)
20 
21  # get NamingService
22  naming = OpenRTM_aist.CorbaNaming(orb, "localhost")
23 
26 
27  # find TkMotorComp0 component
28  tkm.setObject(naming.resolve("TkMotorComp0.rtc"))
29 
30  # get ports
31  inobj = tkm.getObject()._narrow(RTC.RTObject)
32  pin = inobj.get_ports()
33  pin[0].disconnect_all()
34 
35 
36  # find SliderComp0 component
37  sl.setObject(naming.resolve("SliderComp0.rtc"))
38 
39  # get ports
40  outobj = sl.getObject()._narrow(RTC.RTObject)
41  pout = outobj.get_ports()
42  pout[0].disconnect_all()
43 
44 
45  # connect ports
46  conprof = RTC.ConnectorProfile("connector0", "", [pin[0],pout[0]], [])
47  OpenRTM_aist.CORBA_SeqUtil.push_back(conprof.properties,
48  OpenRTM_aist.NVUtil.newNV("dataport.interface_type",
49  "corba_cdr"))
50 
51  OpenRTM_aist.CORBA_SeqUtil.push_back(conprof.properties,
52  OpenRTM_aist.NVUtil.newNV("dataport.dataflow_type",
53  "push"))
54 
55  OpenRTM_aist.CORBA_SeqUtil.push_back(conprof.properties,
56  OpenRTM_aist.NVUtil.newNV("dataport.subscription_type",
57  subs_type))
58 
59  ret = pin[0].connect(conprof)
60 
61  # activate TkMotorComp0
62  eclistin = inobj.get_owned_contexts()
63  eclistin[0].activate_component(inobj)
64 
65  # activate SliderComp0
66  eclistout = outobj.get_owned_contexts()
67  eclistout[0].activate_component(outobj)
68 
69 
70 
71 if __name__ == "__main__":
72  main()
def push_back(seq, elem)
Push the new element back to the CORBA sequence.
CORBA Naming Service helper class.
Definition: CorbaNaming.py:61
def newNV(name, value)
Create NameVale.
Definition: NVUtil.py:50


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34