Ejemplo n.º 1
0
 def SetCamera (self):    
   if self.bCam.text == 'Camera off': 
     pilot.send ("CAM OFF")
     self.bVid.state = 'normal'
     self.VideoPlayerButton (self)
     self.log.info (u"Camera off requested")
   else:  
     pilot.send ("CAM RES " + self.bCam.text) 
     self.bVid.state = 'normal'
     self.VideoPlayerButton (self)
     self.bVid.state = 'down'
     Clock.schedule_once(self.VideoPlayerButton, 4)
     self.log.info (u"Camera requested with {} resolution".format(self.bCam.text))
Ejemplo n.º 2
0
    def gsensor_init(self):
        pilot.send ("GSENSOR ON")
        self.renderer = Renderer(shader_file="3d/simple.glsl")
        scene = Scene()
        # load obj file
        loader = OBJLoader()
        obj = loader.load("3d/k9.obj")
        self.k9obj = obj.children[0]

        scene.add(*obj.children)
        camera = PerspectiveCamera(15, 1, 1, 1000)

        self.renderer.size_hint = (None,None)
        self.renderer.pos_hint = {'right' : .99, 'y': 0.4}
        self.renderer.render(scene, camera)
        self.renderer.size = (300,300)

        self.add_widget(self.renderer)
        Clock.schedule_interval(self.gsensor_3d_update, 1. / 20)
        self.renderer.bind(size=self.gsensor_3d_adjust_aspect)
Ejemplo n.º 3
0
 def ConsoleCmd (self, data):
     data = unicode (data,'utf-8');
     if data == "" : return False
     self.log.debug (u"Console input {}".format(data))
     request = data.split(' ');
     cmd = request.pop(0).lower() 
     cmd = cmd.strip("\n")
     if (data[0:1] == '-'):
         pilot.send ("SAY "+pickle.dumps(data[1:]))
         self.log.info (u"Pronouncing {}".format(data[1:])) 
     elif cmd == 'q' or cmd == 'quit':
         App.get_running_app().stop()
     elif cmd == 'send':
         pkt = ' '.join(request)
         pilot.send (pkt)
         self.log.info (u"Sent: {}".format(pkt))
     elif cmd == '?' or cmd == 'eval':
         cmd = " ".join(request)
         try:
             output = eval("pprint.pformat({})".format(cmd))
             self.log.info (u"{} = {}".format(cmd, output))
         except Exception, e:
             self.log.error(u"eval \"{}\" raised {} Exception: {}".format(cmd,type(e).__name__ ,e))
Ejemplo n.º 4
0
 def gsensor_stop(self):
     pilot.send ("GSENSOR OFF")
     self.remove_widget(self.renderer)
     self.renderer = None
     pass
Ejemplo n.º 5
0
 def SetServo2 (self, smth=""): 
     pilot.send ("SERVO 2 %0d" % self.servo2.value)
Ejemplo n.º 6
0
 def SetServo1 (self, smth=""): 
     pilot.send ("SERVO 1 %0d" % (180 - int(self.servo1.value)))
Ejemplo n.º 7
0
 def TracksStop (self):
     pilot.send ("TRACKS 0 0")
Ejemplo n.º 8
0
 def TracksMove (self, pos, *args):
     pilot.send ("TRACKS %0.2f %0.2f" % (pos[0],pos[1]))       
Ejemplo n.º 9
0
            try:
                output = eval("pprint.pformat({})".format(cmd))
                self.log.info (u"{} = {}".format(cmd, output))
            except Exception, e:
                self.log.error(u"eval \"{}\" raised {} Exception: {}".format(cmd,type(e).__name__ ,e))
        elif cmd == '!' or cmd == 'exec':
            cmd = " ".join(request)
            try:
                exec(cmd)
                self.log.info (u"Executed: {}".format(cmd))
            except Exception, e:
                self.log.error(u"exec \"{}\" raised {} Exception: {}".format(cmd,type(e).__name__ ,e))

        elif cmd == '??' or cmd == 'reval':
            pkt = ' '.join(request)
            pilot.send ("EVAL {}".format(pkt))

        else:
            self.log.info (u"Unknown command '{}'".format(cmd.encode('unicode_escape')))

        return True

    def TracksMove (self, pos, *args):
        pilot.send ("TRACKS %0.2f %0.2f" % (pos[0],pos[1]))       

    def TracksStop (self):
        pilot.send ("TRACKS 0 0")

    def SetServo1 (self, smth=""): 
        pilot.send ("SERVO 1 %0d" % (180 - int(self.servo1.value)))
#        self.servo1label.text = "Head ^%03dv" % self.servo1.value