Skip to content

Commit

Permalink
Add route for exporting mission file
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnans2006 authored and pizzalemon committed Dec 10, 2022
1 parent 511c228 commit 716a870
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions server/apps/uav.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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
Expand Down

0 comments on commit 716a870

Please sign in to comment.