Skip to content

Commit 2903da1

Browse files
julianoescclauss
andcommitted
Various improvements
Co-authored-by: Christian Clauss <[email protected]>
1 parent 174bee7 commit 2903da1

File tree

4 files changed

+31
-27
lines changed

4 files changed

+31
-27
lines changed

examples/camera_params.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ async def run():
2424
drone = System()
2525
await drone.connect(system_address="udpin://0.0.0.0:14540")
2626

27-
tasks = []
28-
tasks.append(asyncio.create_task(observe_current_settings(drone)))
29-
tasks.append(asyncio.create_task(observe_camera_mode(drone)))
30-
tasks.append(asyncio.create_task(observe_possible_setting_options(drone)))
27+
tasks = [
28+
asyncio.create_task(observe_current_settings(drone)),
29+
asyncio.create_task(observe_camera_mode(drone)),
30+
asyncio.create_task(observe_possible_setting_options(drone)),
31+
]
3132

3233
while True:
3334
entered_input = await ainput(usage_str)

examples/offboard_from_csv/offboard_from_csv.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,25 @@ async def run():
147147
await drone.action.disarm()
148148
return
149149

150-
waypoints = []
151-
152150
# Read data from the CSV file
153151
async with await anyio.open_file("active.csv", "r", newline="") as csvfile:
154152
content = await csvfile.read()
155-
reader = csv.DictReader(io.StringIO(content))
156-
for row in reader:
157-
waypoints.append((float(row["t"]),
158-
float(row["px"]),
159-
float(row["py"]),
160-
float(row["pz"]),
161-
float(row["vx"]),
162-
float(row["vy"]),
163-
float(row["vz"]),
164-
float(row["ax"]),
165-
float(row["ay"]),
166-
float(row["az"]),
167-
int(row["mode"])))
153+
waypoints = [
154+
(
155+
float(row["t"]),
156+
float(row["px"]),
157+
float(row["py"]),
158+
float(row["pz"]),
159+
float(row["vx"]),
160+
float(row["vy"]),
161+
float(row["vz"]),
162+
float(row["ax"]),
163+
float(row["ay"]),
164+
float(row["az"]),
165+
int(row["mode"]),
166+
)
167+
for row in csv.DictReader(io.StringIO(content))
168+
]
168169

169170
print("-- Performing trajectory")
170171
total_duration = waypoints[-1][0]

examples/rtk_base_ublox.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ async def run():
9696
await drone.connect()
9797

9898
# Start the tasks
99-
tasks = []
100-
tasks.append(asyncio.create_task(print_gps_info(drone)))
101-
tasks.append(asyncio.create_task(send_rtcm(drone)))
99+
tasks = [
100+
asyncio.create_task(print_gps_info(drone)),
101+
asyncio.create_task(send_rtcm(drone)),
102+
]
102103

103104
# Keep the program running indefinitely
104105
exit_event = asyncio.Event()

examples/telemetry.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ async def run():
1515
await drone.connect(system_address="udpin://0.0.0.0:14540")
1616

1717
# Start the tasks
18-
tasks = []
19-
tasks.append(asyncio.create_task(print_battery(drone)))
20-
tasks.append(asyncio.create_task(print_gps_info(drone)))
21-
tasks.append(asyncio.create_task(print_in_air(drone)))
22-
tasks.append(asyncio.create_task(print_position(drone)))
18+
tasks = [
19+
asyncio.create_task(print_battery(drone)),
20+
asyncio.create_task(print_gps_info(drone)),
21+
asyncio.create_task(print_in_air(drone)),
22+
asyncio.create_task(print_position(drone)),
23+
]
2324

2425
# Keep the program running indefinitely
2526
exit_event = asyncio.Event()

0 commit comments

Comments
 (0)