TkMobileRobotSimulator.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # -*- Python -*-
4 
5 # @brief 2D mobile robot on tk canvas
6 # @date $Date$
7 # @author Norkai Ando <n-ando@aist.go.jp>
8 #
9 # Copyright (C) 2007
10 # Noriaki Ando
11 # Task-intelligence Research Group,
12 # Intelligent Systems Research Institute,
13 # National Institute of
14 # Advanced Industrial Science and Technology (AIST), Japan
15 # All rights reserved.
16 #
17 # $Id$
18 #
19 
20 # $Log$
21 #
22 
23 #from Tkinter import *
24 from tkinter.tix import *
25 import time
26 import math
27 
28 # Import RTM module
29 import RTC
30 import OpenRTM_aist
31 # This module's spesification
32 # <rtc-template block="module_spec">
33 tkmobilerobotsimulator_spec = ["implementation_id", "TkMobileRobotSimulator",
34  "type_name", "TkMobileRobotSimulator",
35  "description", "sample component for Python and Tkinter",
36  "version", "1.0",
37  "vendor", "Noriaki Ando, AIST",
38  "category", "example",
39  "activity_type", "DataFlowComponent",
40  "max_instance", "10",
41  "language", "Python",
42  "lang_type", "SCRIPT",
43  ""]
44 # </rtc-template>
45 
46 
48  def __init__(self, manager):
49  OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
50 
51  self.pos = []
52  self.vel = []
53  return
54 
55  def onInitialize(self):
56  self._d_vel = RTC.TimedFloatSeq(RTC.Time(0,0),[])
57  self._velIn = OpenRTM_aist.InPort("vel", self._d_vel)
58 
59  self._d_pos = RTC.TimedFloatSeq(RTC.Time(0,0),[])
60  self._posOut = OpenRTM_aist.OutPort("pos", self._d_pos)
61 
62  # Set InPort buffers
63  self.addInPort("vel",self._velIn)
64  self.addOutPort("pos",self._posOut)
65 
66  # Bind variables and configuration variable
67  return RTC.RTC_OK
68 
69  def onShutdown(self, ec_id):
70  return RTC.RTC_OK
71 
72  def onDeactivated(self, ec_id):
73  self.pos = []
74  self.vel = []
75  return RTC.RTC_OK
76 
77  def onExecute(self, ec_id):
78  if self._velIn.isNew():
79  self.vel = self._velIn.read().data
80  self._d_pos.data = self.pos
81  self._posOut.write()
82  time.sleep(0.01)
83  return RTC.RTC_OK
84 
85  def get_velocity(self):
86  return self.vel
87 
88  def set_position(self, pos):
89  self.pos = pos
90 
91 
92 class ToggleItem:
93  def __init__(self):
94  self.active = True
95  return
96 
97  def __del__(self):
98  self.delete()
99  return
100 
101  def activate(self):
102  self.active = True
103  self.draw()
104  return
105 
106  def deactivate(self):
107  self.active = False
108  self.delete()
109  return
110 
111  def toggle(self):
112  if self.active:
113  self.deactivate()
114  else:
115  self.activate()
116  return
117 
119  def __init__(self, canvas, text, x, y):
120  ToggleItem.__init__(self)
121  self.canvas = canvas
122  self.id = self.canvas.create_text(x, y, text=text)
123  self.text = text
124  self.x = x
125  self.y = y
126  self.draw_text(x, y, text)
127  return
128 
129  def draw(self):
130  if self.active == False: return
131  self.delete()
132  self.id = self.canvas.create_text(self.x, self.y, text=self.text)
133  return
134 
135  def draw_text(self, x, y, text):
136  self.x = x
137  self.y = y
138  self.text = text
139  self.draw()
140  return
141 
142  def delete(self):
143  self.canvas.delete(self.id)
144  return
145 
147  def __init__(self, simulator, robot, name, r):
148  ToggleItem.__init__(self)
149  self.canvas = simulator.get_canvas()
150  self.trans = simulator.get_translation()
151  self.robot = robot
152  self.name = name
153  self.r = r
154  self.id_circle = None
155  self.id_line0 = None
156  self.id_line1 = None
157  self.id_name = None
158  self.id_pos = None
159  self.llength = 50
160  return
161 
162  def draw(self):
163  if self.active == False: return
164  self.delete()
165  rx, ry, rt = self.robot.get_pos()
166 
167  tmp_x0 = - self.r
168  tmp_y0 = - self.r
169  tmp_x1 = self.r
170  tmp_y1 = self.r
171  x0, y0 = self.trans(tmp_x0, tmp_y0, rx, ry, 0)
172  x1, y1 = self.trans(tmp_x1, tmp_y1, rx, ry, 0)
173 
174  self.id_circle = self.canvas.create_oval(x0, y0, x1, y1,
175  width=2,
176  fill="", outline="#aaaaaa")
177  r = (x1 - x0)/2
178  xo = x0 + r
179  yo = y0 - r
180 
181  lx0 = xo + (r / math.sqrt(2))
182  ly0 = yo - (r / math.sqrt(2))
183  lx1 = lx0 + self.llength
184  ly1 = ly0 - self.llength
185 
186  self.id_line0 = self.canvas.create_line(lx0, ly0, lx1, ly1,
187  fill="#777777")
188  self.id_line1 = self.canvas.create_line(lx1, ly1, lx1 + 120, ly1,
189  fill="#777777")
190  self.id_name = self.canvas.create_text(lx1+120, ly1-8,
191  anchor=E, text=self.name)
192  pos_text = '(%5.2f, %5.2f, %5.2f)' % (rx, ry, (rt*180/math.pi)%360)
193  self.id_pos = self.canvas.create_text(lx1+120, ly1+8,
194  anchor=E, text=pos_text)
195  return
196 
197 
198  def delete(self):
199  if self.id_circle != None:
200  self.canvas.delete(self.id_circle)
201  if self.id_line0 != None:
202  self.canvas.delete(self.id_line0)
203  if self.id_line1 != None:
204  self.canvas.delete(self.id_line1)
205  if self.id_name != None:
206  self.canvas.delete(self.id_name)
207  if self.id_pos != None:
208  self.canvas.delete(self.id_pos)
209  return
210 
211 
213  def __init__(self, canvas, x0, y0, width, height, pitch, color, linewd):
214  ToggleItem.__init__(self)
215  self.canvas = canvas
216  self.x0 = x0
217  self.y0 = y0
218  self.width = width
219  self.height = height
220  self.pitch = pitch
221  self.color = color
222  self.linewd = linewd
223  self.idx = []
224  self.idy = []
225 
226  self.draw()
227  return
228 
229 
230  def draw(self):
231  if self.active == False: return
232  self.delete()
233 
234  x_start = int(self.x0 % self.pitch)
235  x_num = int((self.width - x_start) / self.pitch) + 1
236  for x in range(x_num):
237  x0 = x_start + self.pitch * x
238  id = self.canvas.create_line(x0, 0, x0, self.height,
239  fill=self.color, width=self.linewd)
240  self.idx.append(id)
241 
242  y_start = int(self.y0 % self.pitch)
243  y_num = int((self.height - y_start) / self.pitch) + 1
244  for y in range(y_num):
245  y0 = y_start + self.pitch * y
246  id = self.canvas.create_line(0, y0, self.width, y0,
247  fill=self.color, width=self.linewd)
248  self.idy.append(id)
249 
250  for i in self.idx:
251  self.canvas.tag_lower(i)
252  for i in self.idy:
253  self.canvas.tag_lower(i)
254  return
255 
256 
257  def delete(self):
258  for i in self.idx:
259  self.canvas.delete(i)
260  for i in self.idy:
261  self.canvas.delete(i)
262  return
263 
264 
265  def set_pitch(self, pitch):
266  self.pitch = pitch
267  self.draw()
268  return
269 
270 
272  def __init__(self, canvas, width, height):
273  ToggleItem.__init__(self)
274  self.x0 = width/2
275  self.y0 = height/2
276  self.width = width
277  self.height = height
278  self.canvas = canvas
279  self.id = [None] * 4
280  self.draw()
281  return
282 
283 
284  def draw(self):
285  if self.active == False: return
286  self.delete()
287  self.id[0] = self.canvas.create_line(0, self.height/2,
288  self.width, self.height/2)
289  self.id[1] = self.canvas.create_text(self.width - 10,
290  self.height/2 + 10,
291  text="x")
292  self.id[2] = self.canvas.create_line(self.width/2, 0,
293  self.width/2, self.height)
294  self.id[3] = self.canvas.create_text(self.width/2 + 10,
295  + 10, text="y")
296 
297  return
298 
299  def delete(self):
300  for i in self.id:
301  self.canvas.delete(i)
302  return
303 
304 
305 
307  def __init__(self, simulator):
308  self.simulator = simulator
309  self.tick = simulator.get_tick()
310  self.canvas = simulator.get_canvas()
311  self.trans = simulator.get_translation()
312  return
313 
314  def translate(self, x, y, dx, dy, dth):
315  return self.trans(x, y, dx, dy, dth)
316 
317  def get_tick(self):
318  return self.simulator.get_tick()
319 
320 
321 import tkinter.simpledialog
322 
324  def __init__(self):
325  # robot's profile
326  self.name = ""
327  self.type = ""
328  self.description = ""
329  self.vendor = ""
330  # robot's parameter/input/output
331  self.param = []
332  self.input = []
333  self.output = []
334  # max length of label text
335  self.label_len = 0
336  # max length of unit text
337  self.unit_len = 0
338 
339  self.apply_param = None
340  self.apply_input = None
341  self.reset_output = None
342  return
343 
344  def set_profile(self, name, type, description, vendor):
345  self.name = name
346  self.type = type
347  self.description = description
348  self.vendor =vendor
349  return
350 
351  def append_parameter(self, label, variable, unit):
352  self.param.append({"label":label, "var":variable, "unit":unit})
353  self.label_len = max(len(label), self.label_len)
354  self.unit_len = max(len(unit), self.unit_len)
355  return
356 
357  def append_input(self, label, variable, unit):
358  self.input.append({"label":label, "var":variable, "unit":unit})
359  self.label_len = max(len(label), self.label_len)
360  self.unit_len = max(len(unit), self.unit_len)
361  return
362 
363  def append_output(self, label, variable, unit):
364  self.output.append({"label":label, "var":variable, "unit":unit})
365  self.label_len = max(len(label), self.label_len)
366  self.unit_len = max(len(unit), self.unit_len)
367  return
368 
369  def set_apply_param(self, func):
370  self.apply_param = func
371  return
372 
373  def set_apply_input(self, func):
374  self.apply_input = func
375  return
376 
377  def set_reset_output(self, func):
378  self.reset_output = func
379  return
380 
381  def pack(self):
382  f = Toplevel()
383  self.toplevel = f
384  f.title(self.name)
385  w0 = LabelFrame(f, label="Robot's Profile",
386  options="frame.anchor w frame.justify left")
387  prof_frame = w0.subwidget('frame')
388  self.profile_label(prof_frame)
389 
390  w1 = LabelFrame(f, label="Robot's Parameters")
391  param_frame = w1.subwidget('frame')
392  self.label_entries(param_frame, self.param)
393  if self.apply_param != None:
394  self.button(param_frame, "Apply", self.apply_param)
395 
396  w2 = LabelFrame(f, label="Robot's Input Values")
397  input_frame = w2.subwidget('frame')
398  self.label_entries(input_frame, self.input)
399  if self.apply_input != None:
400  self.button(input_frame, "Set", self.apply_input)
401 
402  w3 = LabelFrame(f, label="Robot's Output Values")
403  output_frame = w3.subwidget('frame')
404  self.label_entries(output_frame, self.output)
405  if self.reset_output != None:
406  self.button(output_frame, "Reset", self.reset_output)
407 
408 
409  for w in [w0, w1, w2, w3]:
410  w.pack(side=TOP, anchor=W, fill=X)
411  self.button(f, "OK", self.on_ok)
412 
413  return
414 
415  def on_ok(self):
416  self.toplevel.destroy()
417  return
418 
419 
420  def button(self, master, label, func):
421  bt = Button(master, text=label, command=func, width=10,
422  padx=3, pady=3)
423  bt.pack(side=TOP, padx=5, pady=5)
424  return
425 
426 
427  def profile_label(self, master):
428  t = ["Robot's name: ", "Robot's type: ", "Description: ", "Vendor: "]
429  for i in range(len(t)):
430  Label(master, text=t[i], anchor=W).grid(row=i, sticky=W,
431  padx=3, pady=3)
432  l = [self.name, self.type, self.description, self.vendor]
433  for i in range(len(l)):
434  Label(master, text=l[i], anchor=W).grid(row=i, column=1, sticky=W,
435  padx=3, pady=3)
436  return
437 
438 
439  def label_entry(self, master, label0, var, label1):
440  f = Frame(master)
441  l0 = Label(f, text=label0, width=self.label_len, justify=LEFT, anchor=W)
442  e = Entry(f, width=7, textvariable=var,
443  justify=RIGHT, relief=GROOVE, bd=2)
444  l1 = Label(f, text=label1, width=self.unit_len, justify=LEFT, anchor=W)
445  for w in [l0, e, l1]:
446  w.pack(side=LEFT, anchor=W, padx=3, pady=3)
447  return f
448 
449  def label_entries(self, f, props):
450  for p in props:
451  self.label_entry(f, p["label"], p["var"], p["unit"]).pack(side=TOP)
452  return
453 
454 
455 
457  def __init__(self, radius, wheeld, pos = (0, 0, math.pi/2), dt=0.1):
458  self.radius = radius
459  self.wheeld = wheeld
460  self.dt = dt
461  self.pre_x = pos[0]
462  self.pre_y = pos[1]
463  self.pre_t = pos[2]
464  self.pre_x_dot = 0
465  self.pre_y_dot = 0
466  self.pre_t_dot = 0
467  return
468 
469 
470  def set_wheel_radius(self, radius):
471  # wheel radius [m]
472  self.radius = radius
473  return
474 
475 
476  def set_wheel_distance(self, distance):
477  # distance between wheels [m]
478  self.wheeld = distance
479  return
480 
481 
482  def set_time_tick(self, tick):
483  # time tick for simulation [sec]
484  self.dt = tick
485  return
486 
487 
488  def set_pos(self, pos = (0, 0, math.pi/2)):
489  # x: pos[0] [m]
490  # y: pos[1] [m]
491  # theta: pos[2] [rad]
492  self.pre_x = pos[0]
493  self.pre_y = pos[1]
494  self.pre_t = pos[2]
495  return
496 
497 
498  def get_pos(self):
499  return self.pre_x, self.pre_y, self.pre_t
500 
501  def control(self, w1, w2):
502  # w1: [rad/s]
503  # w2: [rad/s]
504  x_dot = self.radius * (w1 + w2) * math.cos(self.pre_t)
505  y_dot = self.radius * (w1 + w2) * math.sin(self.pre_t)
506  t_dot = self.radius * (-w1 + w2) / self.wheeld
507 
508  x = (self.dt * (self.pre_x_dot + x_dot) / 2) + self.pre_x
509  y = (self.dt * (self.pre_y_dot + y_dot) / 2) + self.pre_y
510  theta = (self.dt * (self.pre_t_dot + t_dot) / 2) + self.pre_t
511 
512  self.pre_x = x
513  self.pre_y = y
514  self.pre_t = theta
515 
516  self.pre_x_dot = x_dot
517  self.pre_y_dot = y_dot
518  self.pre_t_dot = t_dot
519 
520  return x, y, theta
521 
522 
523 
525  count = 0
526  def __init__(self, simulator, radius=2, wheeld=20,
527  pos = (0, 0, math.pi/2)):
528  SimulatedObject.__init__(self, simulator)
529  self.tick = self.get_tick()
530  self.model = DiffMobileModel(radius, wheeld, pos, self.tick)
531  self.fig = [[10, 0], [5, 10], [-10, 10], [-10, -10], [5, -10]]
532  self.id = None
533  self.wl = 0.0
534  self.wr = 0.0
535  self.name = "DDMobileRobot" + str(self.__class__.count)
536  self.__class__.count += 1
537  self.comp = OpenRTM_aist.Manager.instance().createComponent("TkMobileRobotSimulator")
538 
539  # properties
540  self.rentry = StringVar()
541  self.rentry.set(radius)
542  self.dentry = StringVar()
543  self.dentry.set(wheeld)
544  # input variables
545  self.wlentry = StringVar()
546  self.wrentry = StringVar()
547  # output variables
548  self.xentry = StringVar()
549  self.yentry = StringVar()
550  self.tentry = StringVar()
551  return
552 
553 
554  def __del__(self):
555  try:
556  self.comp.exit()
557  del self.comp
558  except:
559  pass
560  self.delete()
561  return
562 
563 
564  def get_name(self):
565  return self.name
566 
567 
568  def set_pos(self, xxx_todo_changeme):
569  (x, y, th) = xxx_todo_changeme
570  self.model.set_pos((x, y, th))
571  return
572 
573 
574  def get_pos(self):
575  return self.model.get_pos()
576 
577 
578  def set_wheel_velocity(self, wl, wr):
579  self.wl = wl
580  self.wr = wr
581  self.wlentry.set('%5.2f'%self.wl)
582  self.wrentry.set('%5.2f'%self.wr)
583  return
584 
585 
586  def on_update(self):
587  self.model.set_time_tick(self.get_tick())
588  v = self.comp.get_velocity()
589  if len(v) == 2:
590  self.set_wheel_velocity(v[0], v[1])
591  self.x, self.y, self.th = self.model.control(self.wl, self.wr)
592  self.th_deg = (self.th * 180 / math.pi) % 360
593  self.comp.set_position((self.x, self.y, self.th_deg))
594  self.xentry.set('%5.2f'%self.x)
595  self.yentry.set('%5.2f'%self.y)
596  self.tentry.set('%5.2f'%self.th_deg)
597  self.draw()
598  return
599 
600 
601  def draw(self):
602  # converting actual coordinate system into display coordinate
603  # system, and drawing figures
604  robotfig = []
605  for pos in self.fig:
606  robotfig.append(self.translate(pos[0], pos[1],
607  self.x, self.y, self.th))
608  if self.id != None:
609  self.canvas.delete(self.id)
610  self.id = self.canvas.create_polygon(robotfig,
611  fill="#00aa00",
612  outline="#eeeeee")
613  return
614 
615 
616  def delete(self):
617  if self.id != None:
618  self.canvas.delete(self.id)
619  return
620 
621 
622  def property_page(self):
623  p = PropertyDialog()
624  p.set_profile(self.name, "DDMobileRobot",
625  "Differential Drive Mobile Robot", "AIST")
626  p.append_parameter("Wheel radius r: ", self.rentry, "[m]")
627  p.append_parameter("Wheel distance d: ", self.dentry, "[m]")
628  p.append_input("Angular velocity (LEFT) wl: ", self.wlentry, "[rad/s]")
629  p.append_input("Angular velocity (RIGHT) wr: ", self.wrentry, "[rad/s]")
630  p.append_output("Robot position x : ", self.xentry, "[m]")
631  p.append_output("Robot position y : ", self.yentry, "[m]")
632  p.append_output("Robot position th: ", self.tentry, "[deg]")
633  p.set_apply_param(self.on_apply_param)
634  p.set_apply_input(self.on_apply_input)
635  p.set_reset_output(self.on_reset_output)
636  p.pack()
637  return
638 
639 
640  def on_reset_output(self):
641  self.set_pos((0.0, 0.0, math.pi/2))
642  return
643 
644 
645  def on_apply_param(self):
646  r = float(self.rentry.get())
647  d = float(self.dentry.get())
648  self.model.set_wheel_radius(r)
649  self.model.set_wheel_distance(d)
650  return
651 
652 
653  def on_apply_input(self):
654  self.wl = float(self.wlentry.get())
655  self.wr = float(self.wrentry.get())
656  return
657 
658 
659 
660 
661 class TkMobileRobot(Frame):
662  def __init__(self, master=None, width=800, height=600):
663  Frame.__init__(self, master)
664 
665  # canvas properties
666  self.width = width
667  self.height = height
668  # zero of canvas
669  self.x0 = width/2
670  self.y0 = height/2
671 
672  self.wd = 150
673 
674  self.robots = {}
675 
676  self.robot = None
677  self.postext = None
678 
679  self.scale = 1.0
680  self.scale_var = DoubleVar()
681  self.scale_var.set(self.scale)
682 
683  self.grid_pitch = 50
684 
685  self.tick = 0.1
686  self.default_tick = 0.1
687  self.tickscale_var = DoubleVar()
688  self.tickscale_var.set(self.tick)
689 
690  self.axis_check = StringVar()
691  self.axis_check.set("on")
692  self.grid_check = StringVar()
693  self.grid_check.set("on")
694  self.rname_check = StringVar()
695  self.rname_check.set("on")
696  self.rnames = {}
697 
698  self.robot_kind_var = StringVar()
699  self.robot_factory = {"DDMobileRobot": DDMobileRobot}
700 
701 
702 
703  self.init()
704  self.pack()
705 
706 
707  self.after(20, self.on_update)
708  return
709 
710  def init(self):
711  self.canvas = Canvas(self, bg="#eeeeee",
712  width = self.width, height = self.height)
713  self.canvas.pack(side=LEFT)
714 
715  self.can_grid = CanvasGrid(self.canvas, self.x0, self.y0,
716  self.width, self.height, self.grid_pitch,
717  "#aaaaaa", 1)
718  self.can_axis = CanvasAxis(self.canvas, self.width, self.height)
719 
720  self.frame = Frame(self)
721  self.frame.pack(side=LEFT)
722 
723  # Screen control
724  self.scrctrl_frame = Frame(self.frame, width=self.wd, height=300,
725  relief=GROOVE, bd=2)
726  self.scrctrl_frame.pack(side=TOP, fill=X)
727  self.create_scale(self.scrctrl_frame)
729 
730  # Robot manager
731  self.robomgr_frame = Frame(self.frame, width=self.wd, height=300,
732  relief=GROOVE, bd=2)
733  self.robomgr_frame.pack(side=TOP)
736  return
737 
738 
739  def on_update(self):
740  for o in list(self.robots.keys()):
741  self.robots[o].on_update()
742  for r in list(self.rnames.keys()):
743  self.rnames[r].draw()
744  self.after(20, self.on_update)
745  return
746 
747 
748  def get_tick(self):
749  return self.tick
750 
751 
752  def get_canvas(self):
753  return self.canvas
754 
755 
756  def get_translation(self):
757  return self.real_to_canvas
758 
759 
760  #------------------------------------------------------------
761  # Scale control set
762  def create_scale(self, frame):
763  dummy = Frame(frame, width=self.wd)
764  dummy.pack(side=TOP)
765  sl = Scale(frame, from_=0, to=10, resolution=0.01,
766  label="Scale Factor", command=self.on_scale,
767  variable=self.scale_var, orient=HORIZONTAL)
768  bt = Button(frame, text="Reset Scale", command=self.reset_scale)
769  sl.pack(side=TOP, fill=X)
770  bt.pack(side=TOP, fill=X)
771 
772  sl = Scale(frame, from_=0.001, to=1, resolution=0.001,
773  label="Time tick [s]", command=self.on_tickchange,
774  variable=self.tickscale_var, orient=HORIZONTAL)
775  bt = Button(frame, text="Reset Tick", command=self.reset_tickscale)
776  sl.pack(side=TOP, fill=X)
777  bt.pack(side=TOP, fill=X)
778  return
779 
780 
781  def on_scale(self, val):
782  v = float(val)
783  if v == 0.0:
784  pitch = 0
785  else:
786  pitch = self.grid_pitch/v
787  self.scale = v
788  self.can_grid.set_pitch(pitch)
789  return
790 
791 
792  def reset_scale(self):
793  self.scale_var.set(1.)
794  pitch = self.grid_pitch/1.0
795  self.scale = 1.0
796  self.can_grid.set_pitch(pitch)
797  return
798 
799 
800  def on_tickchange(self, val):
801  v = self.tickscale_var.get()
802  if v == 0.0:
803  self.tick = 0
804  else:
805  self.tick = v
806  return
807 
808  def reset_tickscale(self):
809  self.tick = self.default_tick
810  self.tickscale_var.set(self.default_tick)
811  return
812  # end of Scale widget set
813  #------------------------------------------------------------
814 
815  #------------------------------------------------------------
816  # Canvas control set
817  def create_checkbutton(self, frame):
818  axis = Checkbutton(frame, text="Axis",
819  onvalue="on", offvalue="off",
820  justify=LEFT, anchor=W,
821  variable=self.axis_check,
822  command=self.can_axis.toggle)
823  grid = Checkbutton(frame, text="Grid",
824  onvalue="on", offvalue="off",
825  justify=LEFT, anchor=W,
826  variable=self.grid_check,
827  command=self.can_grid.toggle)
828  rname = Checkbutton(frame, text="Robots' name",
829  onvalue="on", offvalue="off",
830  justify=LEFT, anchor=W,
831  variable=self.rname_check,
832  command=self.on_rname_toggle)
833  for w in [axis, grid, rname]:
834  w.pack(side=TOP, anchor=W, fill=X)
835  return
836 
837 
838  def on_rname_toggle(self):
839  for r in list(self.rnames.keys()):
840  self.rnames[r].toggle()
841  return
842 
843 
844  # end of Canvas control set
845  #------------------------------------------------------------
846 
847 
848  #------------------------------------------------------------
849  # Robot creator control set
850  def create_robotcreator(self, frame):
851  lb = Label(frame, text="Robot Type", anchor=W, justify=LEFT)
852 
853  om = OptionMenu(frame, label="Type: ", variable=self.robot_kind_var)
854  for opt in list(self.robot_factory.keys()):
855  om.add_command(opt, label=opt)
856  self.robot_kind_var.set(list(self.robot_factory.keys())[0])
857 
858  creater = Button(frame, text="Create", command=self.create_robot)
859  deleter = Button(frame, text="Delete", command=self.delete_robot)
860 
861  om.pack(side=TOP, fill=X)
862  creater.pack(side=TOP, fill=X)
863  deleter.pack(side=TOP, fill=X)
864  return
865 
866 
867  def create_robotlist(self, frame):
868  f = Frame(frame, width=self.wd, height=200)
869  f.pack(side=TOP, fill=BOTH, expand=1)
870  ys = Scrollbar(f, orient = VERTICAL)
871  ys.grid(row = 0, column=1, sticky = N+S)
872  xs = Scrollbar(f, orient = HORIZONTAL)
873  xs.grid(row = 1, column=0, sticky = E+W)
874 
875  self.rlistbox = Listbox(f,
876  xscrollcommand = xs.set,
877  yscrollcommand = ys.set,
878  selectmode = 'single',
879  setgrid = TRUE,
880  height=20)
881  self.rlistbox.grid(row = 0, column = 0, sticky = N+S+E+W,)
882  xs['command']=self.rlistbox.xview
883  ys['command']=self.rlistbox.yview
884  self.rlistbox.bind("<Double-Button-1>", self.on_clickrlistbox)
885  return
886 
887 
888  def on_clickrlistbox(self, event):
889  index = self.rlistbox.curselection()
890  if len(index) > 0:
891  robot_name = self.rlistbox.get(index[0])
892  self.robots[robot_name].property_page()
893  return
894 
895 
896  def create_robot(self):
897  kind = self.robot_kind_var.get()
898  robot = self.robot_factory[kind](self)
899 
900  self.rlistbox.insert(END, robot.get_name())
901  self.rnames[robot.get_name()] = RobotTitle(self,
902  robot,
903  robot.get_name(),
904  20)
905  self.robots[robot.get_name()] = robot
906  return
907 
908 
909  def delete_robot(self):
910  index = self.rlistbox.curselection()
911  if len(index) > 0:
912  robot_name = self.rlistbox.get(index[0])
913  r = self.rnames.pop(robot_name)
914  del(r)
915  r = self.robots.pop(robot_name)
916  del(r)
917  self.rlistbox.delete(index)
918  return
919 
920  # end of Robot creator control set
921  #------------------------------------------------------------
922 
923 
924  #------------------------------------------------------------
925  #
926  def real_to_canvas(self, x, y, dx, dy, dt):
927  # Simulator coordinate system -> display coordinate system
928  # x, y: original position
929  # dx, dy, dt: translation and rotation vector
930  # translation and rotation
931  x_tmp = (math.cos(dt) * x - math.sin(dt) * y + dx)/self.scale
932  y_tmp = (math.sin(dt) * x + math.cos(dt) * y + dy)/self.scale
933  # align to canvas coordinate system (origin is center and y+ is upward)
934  xo = x_tmp + self.x0
935  yo = -y_tmp + self.y0
936  return xo, yo
937 
938 
940  profile = OpenRTM_aist.Properties(defaults_str=tkmobilerobotsimulator_spec)
941  manager.registerFactory(profile,
942  TkMobileRobotSimulator,
943  OpenRTM_aist.Delete)
944  return
945 
946 
947 def main():
948  m = TkMobileRobot(Tk())
949  m.master.title("Tk Mobile Robot Simulator")
950  mgr = OpenRTM_aist.Manager.init(sys.argv)
951  mgr.activateManager()
952  profile = OpenRTM_aist.Properties(defaults_str=tkmobilerobotsimulator_spec)
953  mgr.registerFactory(profile, TkMobileRobotSimulator, OpenRTM_aist.Delete)
954  mgr.runManager(True)
955  m.mainloop()
956 
957 if __name__ == '__main__':
958  main()
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.x
x
Definition: TkMobileRobotSimulator.py:124
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.name
name
Definition: TkMobileRobotSimulator.py:326
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.height
height
Definition: TkMobileRobotSimulator.py:219
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject
Definition: TkMobileRobotSimulator.py:306
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_y_dot
pre_y_dot
Definition: TkMobileRobotSimulator.py:465
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.r
r
Definition: TkMobileRobotSimulator.py:153
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator._posOut
_posOut
Definition: TkMobileRobotSimulator.py:60
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.draw_text
def draw_text(self, x, y, text)
Definition: TkMobileRobotSimulator.py:135
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.wlentry
wlentry
Definition: TkMobileRobotSimulator.py:544
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.deactivate
def deactivate(self)
Definition: TkMobileRobotSimulator.py:106
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.draw
def draw(self)
Definition: TkMobileRobotSimulator.py:230
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.pack
def pack(self)
Definition: TkMobileRobotSimulator.py:381
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.__init__
def __init__(self, manager)
Constructor.
Definition: TkMobileRobotSimulator.py:48
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.on_update
def on_update(self)
Definition: TkMobileRobotSimulator.py:739
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.x0
x0
Definition: TkMobileRobotSimulator.py:274
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem
Definition: TkMobileRobotSimulator.py:92
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.draw
def draw(self)
Definition: TkMobileRobotSimulator.py:162
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.draw
def draw(self)
Definition: TkMobileRobotSimulator.py:284
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.height
height
Definition: TkMobileRobotSimulator.py:667
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.fig
fig
Definition: TkMobileRobotSimulator.py:530
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.apply_param
apply_param
Definition: TkMobileRobotSimulator.py:339
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.get_velocity
def get_velocity(self)
Definition: TkMobileRobotSimulator.py:85
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.reset_scale
def reset_scale(self)
Definition: TkMobileRobotSimulator.py:792
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.y0
y0
Definition: TkMobileRobotSimulator.py:670
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.width
width
Definition: TkMobileRobotSimulator.py:276
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.__del__
def __del__(self)
Definition: TkMobileRobotSimulator.py:97
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.property_page
def property_page(self)
Definition: TkMobileRobotSimulator.py:622
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.set_pos
def set_pos(self, pos=(0, 0, math.pi/2))
Definition: TkMobileRobotSimulator.py:488
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.type
type
Definition: TkMobileRobotSimulator.py:327
OpenRTM_aist.CORBA_SeqUtil.insert
def insert(seq, elem, index)
Insert the element to the CORBA sequence.
Definition: CORBA_SeqUtil.py:161
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.delete
def delete(self)
Definition: TkMobileRobotSimulator.py:198
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.delete_robot
def delete_robot(self)
Definition: TkMobileRobotSimulator.py:909
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.canvas
canvas
Definition: TkMobileRobotSimulator.py:711
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.get_canvas
def get_canvas(self)
Definition: TkMobileRobotSimulator.py:752
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.robot
robot
Definition: TkMobileRobotSimulator.py:676
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_x
pre_x
Definition: TkMobileRobotSimulator.py:461
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot
Definition: TkMobileRobotSimulator.py:661
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.tick
tick
Definition: TkMobileRobotSimulator.py:309
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.canvas
canvas
Definition: TkMobileRobotSimulator.py:121
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator
Definition: TkMobileRobotSimulator.py:47
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.wr
wr
Definition: TkMobileRobotSimulator.py:533
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.create_robotlist
def create_robotlist(self, frame)
Definition: TkMobileRobotSimulator.py:867
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.name
name
Definition: TkMobileRobotSimulator.py:534
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.apply_input
apply_input
Definition: TkMobileRobotSimulator.py:340
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.grid_pitch
grid_pitch
Definition: TkMobileRobotSimulator.py:683
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.y0
y0
Definition: TkMobileRobotSimulator.py:275
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.on_scale
def on_scale(self, val)
Definition: TkMobileRobotSimulator.py:781
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.pitch
pitch
Definition: TkMobileRobotSimulator.py:220
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.init
def init(self)
Definition: TkMobileRobotSimulator.py:710
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.dt
dt
Definition: TkMobileRobotSimulator.py:460
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_t
pre_t
Definition: TkMobileRobotSimulator.py:463
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.trans
trans
Definition: TkMobileRobotSimulator.py:311
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.append_parameter
def append_parameter(self, label, variable, unit)
Definition: TkMobileRobotSimulator.py:351
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.onInitialize
def onInitialize(self)
Definition: TkMobileRobotSimulator.py:55
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.unit_len
unit_len
Definition: TkMobileRobotSimulator.py:337
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.control
def control(self, w1, w2)
Definition: TkMobileRobotSimulator.py:501
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.set_wheel_radius
def set_wheel_radius(self, radius)
Definition: TkMobileRobotSimulator.py:470
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.profile_label
def profile_label(self, master)
Definition: TkMobileRobotSimulator.py:427
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog
Definition: TkMobileRobotSimulator.py:323
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.get_name
def get_name(self)
Definition: TkMobileRobotSimulator.py:564
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulatorInit
def TkMobileRobotSimulatorInit(manager)
Definition: TkMobileRobotSimulator.py:939
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_y
pre_y
Definition: TkMobileRobotSimulator.py:462
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.robot
robot
Definition: TkMobileRobotSimulator.py:151
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.on_update
def on_update(self)
Definition: TkMobileRobotSimulator.py:586
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.th_deg
th_deg
Definition: TkMobileRobotSimulator.py:592
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.vendor
vendor
Definition: TkMobileRobotSimulator.py:329
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.real_to_canvas
def real_to_canvas(self, x, y, dx, dy, dt)
Definition: TkMobileRobotSimulator.py:926
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.height
height
Definition: TkMobileRobotSimulator.py:277
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel
Definition: TkMobileRobotSimulator.py:456
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.set_wheel_velocity
def set_wheel_velocity(self, wl, wr)
Definition: TkMobileRobotSimulator.py:578
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.id_line0
id_line0
Definition: TkMobileRobotSimulator.py:155
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.tentry
tentry
Definition: TkMobileRobotSimulator.py:549
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.output
output
Definition: TkMobileRobotSimulator.py:333
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.label_len
label_len
Definition: TkMobileRobotSimulator.py:335
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.name
name
Definition: TkMobileRobotSimulator.py:152
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.id_circle
id_circle
Definition: TkMobileRobotSimulator.py:154
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.__init__
def __init__(self, simulator)
Definition: TkMobileRobotSimulator.py:307
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.append_input
def append_input(self, label, variable, unit)
Definition: TkMobileRobotSimulator.py:357
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.grid_check
grid_check
Definition: TkMobileRobotSimulator.py:692
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.input
input
Definition: TkMobileRobotSimulator.py:332
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.main
def main()
Definition: TkMobileRobotSimulator.py:947
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.create_robot
def create_robot(self)
Definition: TkMobileRobotSimulator.py:896
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.append_output
def append_output(self, label, variable, unit)
Definition: TkMobileRobotSimulator.py:363
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.x0
x0
Definition: TkMobileRobotSimulator.py:216
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator._d_pos
_d_pos
Definition: TkMobileRobotSimulator.py:59
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.description
description
Definition: TkMobileRobotSimulator.py:328
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.__init__
def __init__(self, canvas, width, height)
Definition: TkMobileRobotSimulator.py:272
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.y0
y0
Definition: TkMobileRobotSimulator.py:217
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.pos
pos
Definition: TkMobileRobotSimulator.py:51
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.translate
def translate(self, x, y, dx, dy, dth)
Definition: TkMobileRobotSimulator.py:314
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.create_robotcreator
def create_robotcreator(self, frame)
Definition: TkMobileRobotSimulator.py:850
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.frame
frame
Definition: TkMobileRobotSimulator.py:720
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle
Definition: TkMobileRobotSimulator.py:146
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.llength
llength
Definition: TkMobileRobotSimulator.py:159
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator._d_vel
_d_vel
Definition: TkMobileRobotSimulator.py:56
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot
Definition: TkMobileRobotSimulator.py:524
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.__init__
def __init__(self, simulator, radius=2, wheeld=20, pos=(0, 0, math.pi/2))
Definition: TkMobileRobotSimulator.py:526
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator._velIn
_velIn
Definition: TkMobileRobotSimulator.py:57
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.on_reset_output
def on_reset_output(self)
Definition: TkMobileRobotSimulator.py:640
OpenRTM_aist.DataFlowComponentBase.DataFlowComponentBase
DataFlowComponentBase class.
Definition: DataFlowComponentBase.py:35
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.__del__
def __del__(self)
Definition: TkMobileRobotSimulator.py:554
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.width
width
Definition: TkMobileRobotSimulator.py:666
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.vel
vel
Definition: TkMobileRobotSimulator.py:52
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.draw
def draw(self)
Definition: TkMobileRobotSimulator.py:601
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.__init__
def __init__(self)
Definition: TkMobileRobotSimulator.py:324
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.set_pos
def set_pos(self, xxx_todo_changeme)
Definition: TkMobileRobotSimulator.py:568
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis
Definition: TkMobileRobotSimulator.py:271
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.rnames
rnames
Definition: TkMobileRobotSimulator.py:696
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.get_tick
def get_tick(self)
Definition: TkMobileRobotSimulator.py:317
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.canvas
canvas
Definition: TkMobileRobotSimulator.py:149
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.param
param
Definition: TkMobileRobotSimulator.py:331
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.th
th
Definition: TkMobileRobotSimulator.py:591
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.yentry
yentry
Definition: TkMobileRobotSimulator.py:548
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.wl
wl
Definition: TkMobileRobotSimulator.py:532
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.create_scale
def create_scale(self, frame)
Definition: TkMobileRobotSimulator.py:762
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.id_pos
id_pos
Definition: TkMobileRobotSimulator.py:158
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.delete
def delete(self)
Definition: TkMobileRobotSimulator.py:257
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.__init__
def __init__(self, canvas, x0, y0, width, height, pitch, color, linewd)
Definition: TkMobileRobotSimulator.py:213
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.__init__
def __init__(self, radius, wheeld, pos=(0, 0, math.pi/2), dt=0.1)
Definition: TkMobileRobotSimulator.py:457
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_x_dot
pre_x_dot
Definition: TkMobileRobotSimulator.py:464
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.x0
x0
Definition: TkMobileRobotSimulator.py:669
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.onExecute
def onExecute(self, ec_id)
Definition: TkMobileRobotSimulator.py:77
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.id_line1
id_line1
Definition: TkMobileRobotSimulator.py:156
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.on_clickrlistbox
def on_clickrlistbox(self, event)
Definition: TkMobileRobotSimulator.py:888
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.set_wheel_distance
def set_wheel_distance(self, distance)
Definition: TkMobileRobotSimulator.py:476
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.__init__
def __init__(self, master=None, width=800, height=600)
Definition: TkMobileRobotSimulator.py:662
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.on_rname_toggle
def on_rname_toggle(self)
Definition: TkMobileRobotSimulator.py:838
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.button
def button(self, master, label, func)
Definition: TkMobileRobotSimulator.py:420
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.get_pos
def get_pos(self)
Definition: TkMobileRobotSimulator.py:574
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.reset_tickscale
def reset_tickscale(self)
Definition: TkMobileRobotSimulator.py:808
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.activate
def activate(self)
Definition: TkMobileRobotSimulator.py:101
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.canvas
canvas
Definition: TkMobileRobotSimulator.py:278
tix
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.width
width
Definition: TkMobileRobotSimulator.py:218
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.can_grid
can_grid
Definition: TkMobileRobotSimulator.py:715
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.robot_kind_var
robot_kind_var
Definition: TkMobileRobotSimulator.py:698
OpenRTM_aist.InPort.InPort
InPort template class.
Definition: InPort.py:58
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.get_pos
def get_pos(self)
Definition: TkMobileRobotSimulator.py:498
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.default_tick
default_tick
Definition: TkMobileRobotSimulator.py:686
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.delete
def delete(self)
Definition: TkMobileRobotSimulator.py:142
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.set_position
def set_position(self, pos)
Definition: TkMobileRobotSimulator.py:88
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.reset_output
reset_output
Definition: TkMobileRobotSimulator.py:341
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.color
color
Definition: TkMobileRobotSimulator.py:221
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.label_entries
def label_entries(self, f, props)
Definition: TkMobileRobotSimulator.py:449
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.rname_check
rname_check
Definition: TkMobileRobotSimulator.py:694
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.can_axis
can_axis
Definition: TkMobileRobotSimulator.py:718
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.id
id
Definition: TkMobileRobotSimulator.py:122
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.robot_factory
robot_factory
Definition: TkMobileRobotSimulator.py:699
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.onDeactivated
def onDeactivated(self, ec_id)
Definition: TkMobileRobotSimulator.py:72
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.on_apply_input
def on_apply_input(self)
Definition: TkMobileRobotSimulator.py:653
OpenRTM_aist.Properties.Properties
Definition: Properties.py:83
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid
Definition: TkMobileRobotSimulator.py:212
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.toplevel
toplevel
Definition: TkMobileRobotSimulator.py:383
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.canvas
canvas
Definition: TkMobileRobotSimulator.py:215
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.canvas
canvas
Definition: TkMobileRobotSimulator.py:310
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.set_profile
def set_profile(self, name, type, description, vendor)
Definition: TkMobileRobotSimulator.py:344
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.postext
postext
Definition: TkMobileRobotSimulator.py:677
OpenRTM_aist.ComponentActionListener.Entry
Definition: ComponentActionListener.py:579
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.create_checkbutton
def create_checkbutton(self, frame)
Definition: TkMobileRobotSimulator.py:817
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.pre_t_dot
pre_t_dot
Definition: TkMobileRobotSimulator.py:466
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.id
id
Definition: TkMobileRobotSimulator.py:279
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.set_time_tick
def set_time_tick(self, tick)
Definition: TkMobileRobotSimulator.py:482
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.scale
scale
Definition: TkMobileRobotSimulator.py:679
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.wheeld
wheeld
Definition: TkMobileRobotSimulator.py:459
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.model
model
Definition: TkMobileRobotSimulator.py:529
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.robomgr_frame
robomgr_frame
Definition: TkMobileRobotSimulator.py:731
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.comp
comp
Definition: TkMobileRobotSimulator.py:536
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.wd
wd
Definition: TkMobileRobotSimulator.py:672
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DiffMobileModel.radius
radius
Definition: TkMobileRobotSimulator.py:458
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.trans
trans
Definition: TkMobileRobotSimulator.py:150
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.on_apply_param
def on_apply_param(self)
Definition: TkMobileRobotSimulator.py:645
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.set_reset_output
def set_reset_output(self, func)
Definition: TkMobileRobotSimulator.py:377
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.__init__
def __init__(self)
Definition: TkMobileRobotSimulator.py:93
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.__init__
def __init__(self, canvas, text, x, y)
Definition: TkMobileRobotSimulator.py:119
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.id
id
Definition: TkMobileRobotSimulator.py:531
OpenRTM_aist.OutPort.OutPort
Definition: OutPort.py:69
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.idx
idx
Definition: TkMobileRobotSimulator.py:223
OpenRTM_aist.RTObject.RTObject_impl.addOutPort
def addOutPort(self, name, outport)
Definition: RTObject.py:2765
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.toggle
def toggle(self)
Definition: TkMobileRobotSimulator.py:111
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.get_translation
def get_translation(self)
Definition: TkMobileRobotSimulator.py:756
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.idy
idy
Definition: TkMobileRobotSimulator.py:224
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.linewd
linewd
Definition: TkMobileRobotSimulator.py:222
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.robots
robots
Definition: TkMobileRobotSimulator.py:674
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.ToggleItem.active
active
Definition: TkMobileRobotSimulator.py:94
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.text
text
Definition: TkMobileRobotSimulator.py:123
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.set_apply_input
def set_apply_input(self, func)
Definition: TkMobileRobotSimulator.py:373
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.dentry
dentry
Definition: TkMobileRobotSimulator.py:541
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasAxis.delete
def delete(self)
Definition: TkMobileRobotSimulator.py:299
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.tickscale_var
tickscale_var
Definition: TkMobileRobotSimulator.py:687
OpenRTM_aist.RTObject.RTObject_impl.addInPort
def addInPort(self, name, inport)
Definition: RTObject.py:2721
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.delete
def delete(self)
Definition: TkMobileRobotSimulator.py:616
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.get_tick
def get_tick(self)
Definition: TkMobileRobotSimulator.py:748
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.xentry
xentry
Definition: TkMobileRobotSimulator.py:547
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.scrctrl_frame
scrctrl_frame
Definition: TkMobileRobotSimulator.py:724
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.id_name
id_name
Definition: TkMobileRobotSimulator.py:157
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.axis_check
axis_check
Definition: TkMobileRobotSimulator.py:690
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.y
y
Definition: TkMobileRobotSimulator.py:125
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.wrentry
wrentry
Definition: TkMobileRobotSimulator.py:545
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.RobotTitle.__init__
def __init__(self, simulator, robot, name, r)
Definition: TkMobileRobotSimulator.py:147
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.scale_var
scale_var
Definition: TkMobileRobotSimulator.py:680
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.label_entry
def label_entry(self, master, label0, var, label1)
Definition: TkMobileRobotSimulator.py:439
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.SimulatedObject.simulator
simulator
Definition: TkMobileRobotSimulator.py:308
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.rlistbox
rlistbox
Definition: TkMobileRobotSimulator.py:875
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasGrid.set_pitch
def set_pitch(self, pitch)
Definition: TkMobileRobotSimulator.py:265
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobotSimulator.onShutdown
def onShutdown(self, ec_id)
Definition: TkMobileRobotSimulator.py:69
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.on_tickchange
def on_tickchange(self, val)
Definition: TkMobileRobotSimulator.py:800
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText
Definition: TkMobileRobotSimulator.py:118
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.CanvasText.draw
def draw(self)
Definition: TkMobileRobotSimulator.py:129
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.on_ok
def on_ok(self)
Definition: TkMobileRobotSimulator.py:415
OpenRTM_aist.NVUtil.append
def append(dest, src)
Definition: NVUtil.py:386
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.PropertyDialog.set_apply_param
def set_apply_param(self, func)
Definition: TkMobileRobotSimulator.py:369
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.TkMobileRobot.tick
tick
Definition: TkMobileRobotSimulator.py:685
OpenRTM_aist.examples.MobileRobotCanvas.TkMobileRobotSimulator.DDMobileRobot.rentry
rentry
Definition: TkMobileRobotSimulator.py:539


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Apr 21 2025 02:45:07