Merge branch 'main' into 'OpenCV'

# Conflicts:
#   src/Python/flask/web/app.py
#   src/Python/flask/web/static/script.js
This commit is contained in:
2024-12-12 13:48:21 +01:00
7 changed files with 98 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ import paho.mqtt.client as mqtt
app = Flask(__name__)
kobuki_message = "empty"
def on_message(client, userdata, message):
global kobuki_message, latest_image
if message.topic == "kobuki/data":
@@ -10,11 +11,10 @@ def on_message(client, userdata, message):
elif message.topic == "kobuki/cam":
latest_image = message.payload
# Create an MQTT client instance
mqtt_client = mqtt.Client()
mqtt_client.username_pw_set("server", "serverwachtwoordofzo")
mqtt_client.connect("localhost", 1884, 60)
mqtt_client.connect("localhost", 80, 60)
mqtt_client.loop_start()
mqtt_client.subscribe("kobuki/data")
mqtt_client.subscribe("kobuki/cam")
@@ -49,6 +49,7 @@ def move():
def data():
return kobuki_message
@app.route('/image')
def image():
global latest_image
@@ -58,6 +59,13 @@ def image():
return "No image available", 404
@app.route('/phpmyadmin/<path:path>')
def phpmyadmin_passthrough(path):
# Laat Apache deze route direct afhandelen
return "", 404
if __name__ == '__main__':
app.run(debug=True, port=5000)