feat: initial commit
This commit is contained in:
37
app.py
Normal file
37
app.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from control.camera import Camera
|
||||
from control.walle import WallE
|
||||
from flask import Flask, jsonify, send_file, Response
|
||||
from flask_socketio import SocketIO
|
||||
|
||||
# DEBUG = True
|
||||
|
||||
boundary = 'lkajflkasdjlkfaj'
|
||||
|
||||
app = Flask(__name__, static_url_path='', static_folder='client/dist')
|
||||
app.config.from_object(__name__)
|
||||
sio = SocketIO(app)
|
||||
|
||||
walle = WallE()
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return send_file('client/dist/index.html')
|
||||
|
||||
|
||||
@app.route('/imagestream.mjpg')
|
||||
def image_stream():
|
||||
# cam = Camera()
|
||||
# return Response(cam.mjpeg_stream(boundary.encode()),
|
||||
# mimetype='multipart/x-mixed-replace; boundary=lkajflkasdjlkfaj')
|
||||
return ""
|
||||
|
||||
|
||||
@sio.on("move")
|
||||
def message(directions):
|
||||
walle.set_movement(directions['angle'], directions['distance'])
|
||||
print(f"Moving in direction {directions['angle']:f} with velocity {directions['distance']}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sio.run(app, host='0.0.0.0')
|
||||
Reference in New Issue
Block a user