Ejemplo n.º 1
0
 def on_right(self, params):
     if params.get("status") == "active":
         func_id = FC.getIOStream().addCommandToQueue("goRight")
         params["id"] = func_id
     else:
         for output in FC.getIOStream().getAllCommandOutputsInQueue():
             if output["commandName"] == "goRight":
                 FC.getIOStream().removeCommandFromQueue(output['id'])
                 # break
                 # FC.getIOStream().removeCommandFromQueue(1)
     self.emit('alert', params)
Ejemplo n.º 2
0
 def processTime(self, dt):
     """
     executes the current command for dt seconds
     :param dt: int telling how many ms the current command should run
     :return: None
     """
     #  print "processing time"
     while dt > 0:
         # print "isUpdated: ", car.isUpdated
         if self.currentCommand is not None:
             dt = self.processCommand(dt)
         else:
             self.executeCommand(functionCaller.getIOStream().pushCommand())
             #  print self.currentCommand, "current command"
             if self.currentCommand is None:  # geen commands in queue
                 time.sleep(0.1)
                 dt -= 0.1
Ejemplo n.º 3
0
 def update_route_description(self):
     self.broadcast_event('update_route_description', *FC.getIOStream().getAllCommandOutputsInQueue())
Ejemplo n.º 4
0
 def on_ask_update(self):
     self.emit("update_route_description", *FC.getIOStream().getAllCommandOutputsInQueue())
Ejemplo n.º 5
0
 def on_cancel_id(self, params):
     func_id = int(params["id"])
     FC.getIOStream().removeCommandFromQueue(func_id)
     self.update_route_description()
Ejemplo n.º 6
0
 def on_left(self, params):
     func_id = FC.getIOStream().addCommandToQueue("left", **params)
     params["id"] = func_id
     self.emit('alert', params)
     self.update_route_description()
Ejemplo n.º 7
0
 def update_route_description(self):
     if beeldverwerking is not None:
         beeldverwerking.update_route_description()
     else:
         print "beeldverwerking was None"
     self.broadcast_event('updateRouteDescription', *FC.getIOStream().getAllCommandOutputsInQueue())
Ejemplo n.º 8
0
 def on_line(self, data):
     func_id = FC.getIOStream().addCommandToQueue('makeLine')
     data['id'] = func_id
     self.emit('alert', data)
Ejemplo n.º 9
0
                    mimetype='multipart/x-mixed-replace; boundary=frame')


"""
this file is intended to run as imported module, if it runs as main,
debug options are on.
If this file is not run on the raspbery pi, a stream emulated will be used.
Otherwise the real camera is used.
"""
if system() == 'Linux':
    camera = cameraPi.Camera()
    #camera.initialize()
    # make shure you don't have to wait once stream starts, but also start consuming battery (250mA)
else:
    camera = cameraPi.ECamera()

if __name__ == '__main__':
    lol = FC.getIOStream()
    server = SocketIOServer(
        ('0.0.0.0', 4848),
        SharedDataMiddleware(app, {}),
        namespace="socket.io",
        policy_server=False)
    server.serve_forever()
    # socket.run(app, host='127.0.0.1',port=5000)

"""
om je eigen ip adress te vinden gebruik je in command prompt ipconfig (ifconfig voor linux)
en je neetm iPv4.
"""