diff --git a/server/apps/uav.py b/server/apps/uav.py index 8ed9131a..35d6f46c 100644 --- a/server/apps/uav.py +++ b/server/apps/uav.py @@ -112,6 +112,7 @@ def uav_view_commands_file(): return send_file("handlers/uav/uav_mission.txt") +<<<<<<< HEAD:server/apps/uav.py <<<<<<< HEAD:server/apps/uav.py @uav_commands.route("/export") def uav_export_commands_file(): @@ -135,8 +136,20 @@ def uav_export_commands_file(): return {"waypoints": waypoints} -======= ->>>>>>> bffcf3d (Update backend command routes and add route to generate mission file):server/app/uav.py +@uav_commands.route("/export") +def uav_export_commands_file(): + waypoints = [] + with open("handlers/uav/uav_mission.txt", "w") as f: + for line in f.readlines(): + spl = line.split("\t") + waypoints.append({ + "lat": float(spl[8]), + "lon": float(spl[9]), + "alt": float(spl[10]) + }) + return {"waypoints": waypoints} + + @uav_commands.route("/generate", methods=["POST"]) def uav_generate_commands_file(): f = request.json