Ejemplo n.º 1
0
  def motorOutput(self, v, w):
#    traceback.print_stack()
    if self.acceptMotorCmds:
      self.trans.set(clip(v, -MAX_TRANS, MAX_TRANS))
      self.rot.set(clip(w, -MAX_ROT, MAX_ROT))
      if (not self.asynchronous):
        self.update()
Ejemplo n.º 2
0
 def motorOutput(self, v, w):
     #    traceback.print_stack()
     if self.acceptMotorCmds:
         self.trans.set(clip(v, -MAX_TRANS, MAX_TRANS))
         self.rot.set(clip(w, -MAX_ROT, MAX_ROT))
         if (not self.asynchronous):
             self.update()
Ejemplo n.º 3
0
 def color(self, scalar = GARBAGE):
     try:
         ind = int(clip(int(len(self.colormap)*(scalar-self.func.min)/(self.func.max-self.func.min)), 0, len(self.colormap)-1))
     except AttributeError:
         return self.colormap[0]
     except TypeError:
         return self.colormap[0]
     return self.colormap[ind]
Ejemplo n.º 4
0
 def color(self, scalar = GARBAGE):
     try:
         ind = int(clip(int(len(self.colormap)*(scalar-self.func.min)/(self.func.max-self.func.min)), 0, len(self.colormap)-1))
     except AttributeError:
         return self.colormap[0]
     except TypeError:
         return self.colormap[0]
     return self.colormap[ind]
Ejemplo n.º 5
0
 def __init__(self, startup = common.skip):
   """The main hook to start the form GUI. This doesn't exit until the end of the program since it calls Tk's mainloop, but it's ok, since we are in a class, we just assign self to a __builtin__ name. This becomes app."""
   __builtins__['app'] = self
   self.commands = formulae.FormulaPool()
   #try:
   #  self.command_listener = listener.CommandListener(settings.COMMAND_PORT,
   #                                                   self.commands)
   #  self.command_listener.start()
   #except:
   #  pass # for now..
   tk_enqueue(self.setUpInterface)
   tk_enqueue(startup)
   tk.after(int(common.clip(GUI_FPMS_INVERSE,0,GUI_FPMS_INVERSE)),
            tk_update)
   tk.mainloop()
   return 0
Ejemplo n.º 6
0
 def __init__(self, startup=common.skip):
     """The main hook to start the form GUI. This doesn't exit until the end of the program since it calls Tk's mainloop, but it's ok, since we are in a class, we just assign self to a __builtin__ name. This becomes app."""
     __builtins__['app'] = self
     self.commands = formulae.FormulaPool()
     #try:
     #  self.command_listener = listener.CommandListener(settings.COMMAND_PORT,
     #                                                   self.commands)
     #  self.command_listener.start()
     #except:
     #  pass # for now..
     tk_enqueue(self.setUpInterface)
     tk_enqueue(startup)
     tk.after(int(common.clip(GUI_FPMS_INVERSE, 0, GUI_FPMS_INVERSE)),
              tk_update)
     tk.mainloop()
     return 0
Ejemplo n.º 7
0
 def motorOutput(self, v, w):
   if TELEPORT_PROB > 0:
     if random() < TELEPORT_PROB:
       newPose = TELEPORT_DIST.draw()
       print 'Teleporting to', newPose
       self.abspose.set(newPose)
   if CAP_ACC:
     (oldTrans, oldRot) = (self.v.get(), self.w.get())
     transDiff = clip(v-oldTrans,-TRANS_ACC, TRANS_ACC)
     rotDiff = clip(w-oldRot,-ROT_ACC,ROT_ACC)
     self.v.set(clip(oldTrans+transDiff, -MAX_TRANS, MAX_TRANS))
     self.w.set(clip(oldRot+rotDiff, -MAX_ROT, MAX_ROT))
   else:
     self.v.set(clip(v, -MAX_TRANS, MAX_TRANS))
     self.w.set(clip(w, -MAX_ROT, MAX_ROT))
Ejemplo n.º 8
0
 def motorOutput(self, v, w):
     if TELEPORT_PROB > 0:
         if random() < TELEPORT_PROB:
             newPose = TELEPORT_DIST.draw()
             print 'Teleporting to', newPose
             self.abspose.set(newPose)
     if CAP_ACC:
         (oldTrans, oldRot) = (self.v.get(), self.w.get())
         transDiff = clip(v - oldTrans, -TRANS_ACC, TRANS_ACC)
         rotDiff = clip(w - oldRot, -ROT_ACC, ROT_ACC)
         self.v.set(clip(oldTrans + transDiff, -MAX_TRANS, MAX_TRANS))
         self.w.set(clip(oldRot + rotDiff, -MAX_ROT, MAX_ROT))
     else:
         self.v.set(clip(v, -MAX_TRANS, MAX_TRANS))
         self.w.set(clip(w, -MAX_ROT, MAX_ROT))
Ejemplo n.º 9
0
 def analogOutput(self, v):
     self.analogOut.set(clip(v, 0.0, 10.0))
Ejemplo n.º 10
0
 def analogOutput(self, v):
   self.analogOut.set(clip(v, 0.0, 10.0))