17 tkjoystick_spec = [
"implementation_id",
"TkJoyStick",
18 "type_name",
"TkJoyStick",
19 "description",
"Sample component for MobileRobotCanvas component",
21 "vendor",
"Noriaki Ando and Shinji Kurihara",
22 "category",
"example",
23 "activity_type",
"DataFlowComponent",
26 "lang_type",
"SCRIPT",
33 def __init__(self, x = 0.0, y = 0.0, r = 0.0, th = 0.0):
45 OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
47 self.
_d_pos = RTC.TimedFloatSeq(RTC.Time(0,0),[])
49 self.
_d_vel = RTC.TimedFloatSeq(RTC.Time(0,0),[])
54 self.registerOutPort(
"pos",self.
_posOut)
55 self.registerOutPort(
"vel",self.
_velOut)
73 self._d_pos.data = [self.
x, self.
y]
74 self._d_vel.data = self.
convert(self.
x, self.
y)
81 \brief Canvas$B$N%G!<%?$r(BMobileRobotCanvas$BMQ$N%G!<%?$KJQ49$9$k!#(B 85 _v = self.
_k * math.hypot(x, y)
86 _vl = _v * math.cos(_th - (math.pi/4.0))
87 _vr = _v * math.sin(_th - (math.pi/4.0))
112 tkJoyCanvas.master.title(
"TkJoystick")
113 mgr = OpenRTM_aist.Manager.init(sys.argv)
114 mgr.activateManager()
117 profile = OpenRTM_aist.Properties(defaults_str=tkjoystick_spec)
118 mgr.registerFactory(profile,
122 comp = mgr.createComponent(
"TkJoyStick")
124 tkJoyCanvas.set_on_update(comp.set_pos)
126 tkJoyCanvas.mainloop()
128 if __name__ ==
"__main__":
def set_pos(self, pos, pol)
def onExecute(self, ec_id)
def __init__(self, x=0.0, y=0.0, r=0.0, th=0.0)
def onShutdown(self, ec_id)
def __init__(self, manager)