Skip to content
Snippets Groups Projects
Commit da9aa07f authored by Sagun Pokhrel's avatar Sagun Pokhrel
Browse files

Upload New File

parent 47601a7d
Branches
No related tags found
Loading
import json
from flask import Flask, render_template, request, jsonify
import pickle
app = Flask(__name__)
# float64 num = 0.10;
# testknoten = [{"x": 0.50, "y": 0.0, "mapid": "p1"}, {"x": 0.50, "y": 0.50, "mapid": "p1"}]
@app.route("/")
def home():
return "HI, Das hier ist der ROBOMASTER"
# der Ursprungspunkt des AGV beim Start
@app.route("/Ursprung", methods=["GET"])
def test():
if request.method == "GET":
return jsonify({"x": 0.0, "y": 0.0, "mapid": "Startpunkt"})
@app.route("/start", methods=["GET", "POST"])
def start():
if request.method == "GET":
global beginn
beginn = [
{"x": 5.0, "y": 0.0, "mapid": "p1"},
{"x": 5.0, "y": 5.0, "mapid": "p2"},
{"x": 0.0, "y": 5.0, "mapid": "p3"},
{"x": -5.0, "y": 5.0, "mapid": "p4"},
{"x": -5.0, "y": -5.0, "mapid": "p5"}
]
return jsonify(beginn)
# beim aufruf soll irgendwie x und y übergeben werden können
# die koordinaten werden dann in dem array abgespeichert und an emil gesendet
@app.route("/Punkt")
def func():
x_s = request.args["x"]
y_s = request.args["y"]
x = float(x_s)
y = float(y_s)
erg = jsonify({"x": x, "y": y, "theta": 0.0, "mapid": "knoten", "mapDescription": "infos"})
return erg
# ziel ist es irgedwie einzelne knoten von außen zu bekommen,
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=False)
# emil hat ebenfalls in seiner implemntation eine variante knoten zu deklarieren
# bei einer weitern implementierung kann von unserer seite der vda-mechnismus laufen:
# Leon schick koordinaten, und emil bekommt vda-knoten
# diese werden dann in der ros-implemntation abgespielt
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment