示例#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()
示例#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()
示例#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]
示例#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]
示例#5
0
文件: main.py 项目: Cynary/distro6.01
 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
示例#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
示例#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))
示例#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))
示例#9
0
 def analogOutput(self, v):
     self.analogOut.set(clip(v, 0.0, 10.0))
示例#10
0
 def analogOutput(self, v):
   self.analogOut.set(clip(v, 0.0, 10.0))