18 tkjoystick_spec = [
"implementation_id",
"TkJoyStick",
19 "type_name",
"TkJoyStick",
20 "description",
"Sample component for MobileRobotCanvas component",
22 "vendor",
"Noriaki Ando and Shinji Kurihara",
23 "category",
"example",
24 "activity_type",
"DataFlowComponent",
27 "lang_type",
"SCRIPT",
34 def __init__(self, x = 0.0, y = 0.0, r = 0.0, th = 0.0):
46 OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
54 self.
_d_pos = RTC.TimedFloatSeq(RTC.Time(0,0),[])
56 self.
_d_vel = RTC.TimedFloatSeq(RTC.Time(0,0),[])
71 self._d_pos.data = [self.
x, self.
y]
72 self._d_vel.data = self.
convert(self.
x, self.
y)
79 \brief Converting from canvas data to MobileRobotCanvas data 83 _v = self.
_k * math.hypot(x, y)
84 _vl = _v * math.cos(_th - (math.pi/4.0))
85 _vr = _v * math.sin(_th - (math.pi/4.0))
110 tkJoyCanvas.master.title(
"TkJoystick")
111 mgr = OpenRTM_aist.Manager.init(sys.argv)
112 mgr.activateManager()
116 mgr.registerFactory(profile,
120 comp = mgr.createComponent(
"TkJoyStick")
122 tkJoyCanvas.set_on_update(comp.set_pos)
124 tkJoyCanvas.mainloop()
126 if __name__ ==
"__main__":
def set_pos(self, pos, pol)
The Properties class represents a persistent set of properties.
def __init__(self, x=0.0, y=0.0, r=0.0, th=0.0)
def __init__(self, manager)
def onShutdown(self, ec_id)
def addOutPort(self, name, outport)
def onExecute(self, ec_id)
DataFlowComponentBase class.