Skip to content

Commit 0a2890d

Browse files
authored
Merge pull request mavlink#542 from mavlink/pr-update-mavsdk-server
Update mavsdk_server version, bump to Python 3.7+
2 parents c493e52 + 87a7aef commit 0a2890d

35 files changed

+77
-179
lines changed

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.4.4
1+
v1.4.10

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Python wrapper is based on a gRPC client communicating with the gRPC server
99

1010
## Important Notes
1111

12-
- Python 3.6+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
12+
- Python 3.7+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
1313
- You may need to run `pip3` instead of `pip` and `python3` instead of `python`, depending of your system defaults.
1414
- Auterion has a [Getting started with MAVSDK-Python](https://auterion.com/getting-started-with-mavsdk-python/) guide if you're a beginner and not sure where to start.
1515

examples/calibration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ async def run():
3131

3232

3333
if __name__ == "__main__":
34-
loop = asyncio.get_event_loop()
35-
loop.run_until_complete(run())
34+
# Run the asyncio loop
35+
asyncio.run(run())

examples/camera.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ async def print_status(drone):
5656

5757

5858
if __name__ == "__main__":
59-
loop = asyncio.get_event_loop()
60-
loop.run_until_complete(run())
59+
# Run the asyncio loop
60+
asyncio.run(run())

examples/camera_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ async def make_user_choose_option_range(possible_options):
185185

186186

187187
if __name__ == "__main__":
188-
loop = asyncio.get_event_loop()
189-
loop.run_until_complete(run())
188+
# Run the asyncio loop
189+
asyncio.run(run())

examples/failure_injection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ async def run():
5959
await drone.param.set_param_int('SYS_FAILURE_EN', 0)
6060

6161
if __name__ == "__main__":
62-
loop = asyncio.get_event_loop()
63-
loop.run_until_complete(run())
62+
# Run the asyncio loop
63+
asyncio.run(run())

examples/firmware_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ async def run():
1919

2020

2121
if __name__ == "__main__":
22-
loop = asyncio.get_event_loop()
23-
loop.run_until_complete(run())
22+
# Run the asyncio loop
23+
asyncio.run(run())

examples/follow_me_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ async def fly_drone():
6464
await drone.action.land()
6565

6666
if __name__ == "__main__":
67-
loop = asyncio.get_event_loop()
68-
loop.run_until_complete(fly_drone())
67+
# Run the asyncio loop
68+
asyncio.run(run())

examples/geofence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88
This example shows how to use the geofence plugin.
99
10-
Note: The behavior when your vehicle hits the geofence is NOT configured in this example.
10+
Note: The behavior when your vehicle hits the geofence is NOT configured in this example.
1111
1212
"""
1313

@@ -51,5 +51,5 @@ async def run():
5151

5252

5353
if __name__ == "__main__":
54-
loop = asyncio.get_event_loop()
55-
loop.run_until_complete(run())
54+
# Run the asyncio loop
55+
asyncio.run(run())

examples/gimbal.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,5 @@ async def print_gimbal_position(drone):
8383

8484

8585
if __name__ == "__main__":
86-
# Start the main function
87-
loop = asyncio.get_event_loop()
88-
loop.run_until_complete(run())
86+
# Run the asyncio loop
87+
asyncio.run(run())

examples/goto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ async def run():
4343

4444

4545
if __name__ == "__main__":
46-
loop = asyncio.get_event_loop()
47-
loop.run_until_complete(run())
46+
# Run the asyncio loop
47+
asyncio.run(run())

examples/logfile_download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ async def get_entries(drone):
4242

4343

4444
if __name__ == "__main__":
45-
asyncio.get_event_loop().run_until_complete(run())
45+
# Run the asyncio loop
46+
asyncio.run(run())

examples/manual_control.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,5 @@ async def manual_controls():
9191

9292

9393
if __name__ == "__main__":
94-
95-
loop = asyncio.get_event_loop()
96-
loop.run_until_complete(manual_controls())
94+
# Run the asyncio loop
95+
asyncio.run(run())

examples/mission.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ async def observe_is_in_air(drone, running_tasks):
116116

117117

118118
if __name__ == "__main__":
119-
loop = asyncio.get_event_loop()
120-
loop.run_until_complete(run())
119+
# Run the asyncio loop
120+
asyncio.run(run())

examples/mission_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ async def run():
2424

2525

2626
if __name__ == "__main__":
27-
loop = asyncio.get_event_loop()
28-
loop.run_until_complete(run())
27+
# Run the asyncio loop
28+
asyncio.run(run())

examples/offboard_attitude.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ async def run():
7272

7373

7474
if __name__ == "__main__":
75-
loop = asyncio.get_event_loop()
76-
loop.run_until_complete(run())
75+
# Run the asyncio loop
76+
asyncio.run(run())

examples/offboard_position_ned.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ async def run():
7171

7272

7373
if __name__ == "__main__":
74-
loop = asyncio.get_event_loop()
75-
loop.run_until_complete(run())
74+
# Run the asyncio loop
75+
asyncio.run(run())

examples/offboard_position_velocity_ned.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ async def print_z_velocity(drone):
6464

6565

6666
if __name__ == "__main__":
67-
loop = asyncio.get_event_loop()
68-
loop.run_until_complete(run())
67+
# Run the asyncio loop
68+
asyncio.run(run())

examples/offboard_velocity_body.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@ async def run():
8686

8787

8888
if __name__ == "__main__":
89-
loop = asyncio.get_event_loop()
90-
loop.run_until_complete(run())
89+
# Run the asyncio loop
90+
asyncio.run(run())

examples/offboard_velocity_ned.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ async def run():
7979

8080

8181
if __name__ == "__main__":
82-
loop = asyncio.get_event_loop()
83-
loop.run_until_complete(run())
82+
# Run the asyncio loop
83+
asyncio.run(run())

examples/send_status_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ async def run():
2929
break
3030

3131
if __name__ == "__main__":
32-
loop = asyncio.get_event_loop()
33-
loop.run_until_complete(run())
32+
# Run the asyncio loop
33+
asyncio.run(run())

examples/takeoff_and_land.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ async def print_status_text(drone):
4747

4848

4949
if __name__ == "__main__":
50-
loop = asyncio.get_event_loop()
51-
loop.run_until_complete(run())
50+
# Run the asyncio loop
51+
asyncio.run(run())

examples/takeoff_and_land_keyboard_control.py

100644100755
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Author: @woosal1337
3-
"""
1+
#!/usr/bin/env python3
42

53
import asyncio
64
import pygame
@@ -148,6 +146,7 @@ async def print_position(drone=drone):
148146

149147
if __name__ == "__main__":
150148

149+
# TODO: use new asyncio methods
151150
loop = asyncio.get_event_loop()
152151
loop.run_until_complete(setup())
153152
loop.run_until_complete(main())

examples/telemetry.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,5 @@ async def print_position(drone):
3636

3737

3838
if __name__ == "__main__":
39-
# Start the main function
40-
asyncio.ensure_future(run())
41-
42-
# Runs the event loop until the program is canceled with e.g. CTRL-C
43-
asyncio.get_event_loop().run_forever()
39+
# Run the asyncio loop
40+
asyncio.run(run())

examples/telemetry_flight_mode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ async def print_flight_mode():
1919

2020

2121
if __name__ == "__main__":
22-
loop = asyncio.get_event_loop()
23-
loop.run_until_complete(print_flight_mode())
22+
# Run the asyncio loop
23+
asyncio.run(run())

examples/telemetry_is_armed_is_in_air.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ async def print_is_in_air(drone):
2323

2424

2525
if __name__ == "__main__":
26-
# Start the main function
27-
asyncio.ensure_future(run())
28-
29-
# Runs the event loop until the program is canceled with e.g. CTRL-C
30-
asyncio.get_event_loop().run_forever()
26+
# Run the asyncio loop
27+
asyncio.run(run())

examples/telemetry_takeoff_and_land.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,5 @@ async def observe_is_in_air(drone, running_tasks):
108108

109109

110110
if __name__ == "__main__":
111-
asyncio.get_event_loop().run_until_complete(run())
111+
# Run the asyncio loop
112+
asyncio.run(run())

examples/transponder.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async def run():
99
drone = System()
1010
#await drone.connect(system_address="udp://:14540")
1111
await drone.connect()
12-
12+
1313
# Start the tasks
1414
asyncio.ensure_future(print_transponders(drone))
1515

@@ -19,8 +19,5 @@ async def print_transponders(drone):
1919

2020

2121
if __name__ == "__main__":
22-
# Start the main function
23-
asyncio.ensure_future(run())
24-
25-
# Runs the event loop until the program is canceled with e.g. CTRL-C
26-
asyncio.get_event_loop().run_forever()
22+
# Run the asyncio loop
23+
asyncio.run(run())

examples/tune.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ async def run():
6464
print("Tune played")
6565

6666
if __name__ == "__main__":
67-
loop = asyncio.get_event_loop()
68-
loop.run_until_complete(run())
67+
# Run the asyncio loop
68+
asyncio.run(run())

mavsdk/log_files.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -431,52 +431,6 @@ async def download_log_file(self, entry, path):
431431
finally:
432432
download_log_file_stream.cancel()
433433

434-
async def download_log_file(self, entry, path):
435-
"""
436-
Download log file synchronously.
437-
438-
Parameters
439-
----------
440-
entry : Entry
441-
Entry of the log file to download.
442-
443-
path : std::string
444-
Path of where to download log file to.
445-
446-
Returns
447-
-------
448-
progress : ProgressData
449-
Progress if result is progress
450-
451-
Raises
452-
------
453-
LogFilesError
454-
If the request fails. The error contains the reason for the failure.
455-
"""
456-
457-
request = log_files_pb2.DownloadLogFileRequest()
458-
459-
460-
461-
entry.translate_to_rpc(request.entry)
462-
463-
464-
465-
466-
request.path = path
467-
468-
response = await self._stub.DownloadLogFile(request)
469-
470-
471-
result = self._extract_result(response)
472-
473-
if result.result != LogFilesResult.Result.SUCCESS:
474-
raise LogFilesError(result, "download_log_file()", entry, path)
475-
476-
477-
return ProgressData.translate_from_rpc(response.progress)
478-
479-
480434
async def erase_all_log_files(self):
481435
"""
482436
Erase all log files.

mavsdk/log_files_pb2.py

Lines changed: 15 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)