mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
intergrated everything and added simple endpoint for mqtt data
This commit is contained in:
@@ -27,9 +27,11 @@ int main()
|
||||
setup();
|
||||
std::thread safety([&]() { robot.robotSafety(&message); });
|
||||
std::thread sendMqtt([&]() { sendKobukiData(robot.parser.data); });
|
||||
|
||||
while(true){
|
||||
parseMQTT(readMQTT());
|
||||
}
|
||||
sendMqtt.join();
|
||||
safety.join();
|
||||
return 0;
|
||||
}
|
||||
|
@@ -23,6 +23,13 @@ def move():
|
||||
mqtt_client.publish("home/commands", direction) # Het topic kan aangepast worden
|
||||
|
||||
return jsonify({"status": "success", "direction": direction})
|
||||
# Run the Flask application in debug mode
|
||||
|
||||
|
||||
@app.route('/data', methods=['GET'])
|
||||
def data():
|
||||
data = mqtt_client.subscribe("kobuki/data")
|
||||
if data:
|
||||
return jsonify({data})
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
Reference in New Issue
Block a user