Skip to content

Commit 808c3d9

Browse files
Pradip-pspwoodcock
authored andcommitted
feat: update support for DJJ air 3 drones
1 parent f152810 commit 808c3d9

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/backend/app/models/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class HTTPStatus(IntEnum):
131131

132132

133133
class DroneType(IntEnum):
134-
DJI_MINI_4_PRO = 1
134+
DJI_MINI_4_PRO = "DJI_MINI_4_PRO"
135+
DJI_AIR_3 = "DJI_MINI_4_PRO"
135136

136137

137138
class UserRole(int, Enum):

src/backend/app/waypoints/waypoint_routes.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222

2323
from app.config import settings
2424
from app.db import database
25-
from app.models.enums import FlightMode, HTTPStatus
25+
from app.models.enums import FlightMode, HTTPStatus, DroneType
2626
from app.projects import project_deps
2727
from app.s3 import get_file_from_bucket
2828
from app.tasks.task_logic import (
2929
get_take_off_point_from_db,
3030
get_task_geojson,
3131
update_take_off_point_in_db,
3232
)
33-
from app.utils import merge_multipolygon
33+
from app.utils import merge_multipolygon, calculate_flight_time_from_placemarks
3434
from app.waypoints import waypoint_schemas
3535
from app.waypoints.waypoint_logic import (
3636
check_point_within_buffer,
@@ -56,6 +56,7 @@ async def get_task_waypoint(
5656
download: bool = True,
5757
mode: FlightMode = FlightMode.waylines,
5858
rotation_angle: float = 0,
59+
drone_type: DroneType = DroneType.DJI_MINI_4_PRO,
5960
take_off_point: waypoint_schemas.PointField = None,
6061
):
6162
"""Retrieve task waypoints and download a flight plan.
@@ -115,6 +116,7 @@ async def get_task_waypoint(
115116
altitude,
116117
gsd,
117118
2, # Image Interval is set to 2
119+
drone_type,
118120
)
119121

120122
# Common parameters for create_waypoint
@@ -127,6 +129,7 @@ async def get_task_waypoint(
127129
"rotation_angle": rotation_angle,
128130
"generate_3d": generate_3d,
129131
"take_off_point": take_off_point,
132+
"drone_type": drone_type,
130133
}
131134

132135
if project.is_terrain_follow:
@@ -175,7 +178,10 @@ async def get_task_waypoint(
175178
media_type="application/vnd.google-earth.kmz",
176179
filename=f"{task_id}_flight_plan.kmz",
177180
)
178-
return {"results": placemarks}
181+
flight_data = calculate_flight_time_from_placemarks(placemarks)
182+
183+
drones = list(DroneType.__members__.keys())
184+
return {"results": placemarks, "flight_data": flight_data, "drones": drones}
179185

180186

181187
@router.post("/")
@@ -221,6 +227,7 @@ async def generate_kmz(
221227
description="The Digital Elevation Model (DEM) file that will be used to generate the terrain follow flight plan. This file should be in GeoTIFF format",
222228
),
223229
take_off_point: waypoint_schemas.PointField = None,
230+
drone_type: DroneType = DroneType.DJI_MINI_4_PRO,
224231
):
225232
if not (altitude or gsd):
226233
raise HTTPException(
@@ -264,6 +271,7 @@ async def generate_kmz(
264271
generate_each_points=generate_each_points,
265272
generate_3d=generate_3d,
266273
take_off_point=take_off_point,
274+
drone_type=drone_type,
267275
)
268276
return geojson.loads(points)
269277
else:
@@ -277,6 +285,7 @@ async def generate_kmz(
277285
dem=dem_path if dem else None,
278286
outfile=f"/tmp/{uuid.uuid4()}",
279287
take_off_point=take_off_point,
288+
drone_type=drone_type,
280289
)
281290

282291
return FileResponse(

0 commit comments

Comments
 (0)