コード例 #1
0
 def __init__(self):
     CarMove.__init__(self)
     CarUltrasound.__init__(self)
     CarInfrared.__init__(self)
     CarCamera.__init__(self)
     CarDetect.__init__(self)
     self.state = CarState.stop
コード例 #2
0
 def AllStop(self):
     CarMove.MotorStop(self)
     CarCamera.CameraCleanup(self)
     GPIO.cleanup()
コード例 #3
0
 def __init__(self):
     CarMove.__init__(self)
     CarUltrasound.__init__(self)
     CarInfrared.__init__(self)
     CarCamera.__init__(self)
コード例 #4
0
 def AllStop(self):
     self.state = CarState.stop
     CarMove.MotorStop(self)
     CarCamera.CameraCleanup(self)
     GPIO.cleanup()
コード例 #5
0
    # def write_message(self, message, binary=False):
    #     if self.ws_connection is None:
    #         raise WebSocketClosedError()
    #     if isinstance(message, dict):
    #         message = tornado.escape.json_encode(message)
    #     self.ws_connection.write_message(message, binary=binary)

    # 主动关闭连接
    def close(self, code=None, reason=None):
        # if self.ws_connection:
        #     self.ws_connection.close(code, reason)
        #     self.ws_connection = None
        pass


if __name__ == '__main__':
    tornado.options.parse_command_line()
    app = tornado.web.Application([
        (r"/", IndexHandler),
        (r"/chat", ChatSocketHandler),
    ],
                                  static_path=os.path.join(
                                      os.path.dirname(__file__), "static"),
                                  debug=True)
    http_server = tornado.httpserver.HTTPServer(app)
    http_server.listen(options.port)
    camera = CarCamera(ws_tasks)
    camera.start()
    print('start')
    loop = tornado.ioloop.IOLoop.current().start()