Skip to content

Update mavsdk_server version, bump to Python 3.7+ #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MAVSDK_SERVER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4.4
v1.4.10
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Python wrapper is based on a gRPC client communicating with the gRPC server

## Important Notes

- Python 3.6+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
- Python 3.7+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
- You may need to run `pip3` instead of `pip` and `python3` instead of `python`, depending of your system defaults.
- 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.

Expand Down
4 changes: 2 additions & 2 deletions examples/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ async def print_status(drone):


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/camera_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ async def make_user_choose_option_range(possible_options):


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/failure_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ async def run():
await drone.param.set_param_int('SYS_FAILURE_EN', 0)

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/firmware_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/follow_me_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async def fly_drone():
await drone.action.land()

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(fly_drone())
# Run the asyncio loop
asyncio.run(run())
6 changes: 3 additions & 3 deletions examples/geofence.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
This example shows how to use the geofence plugin.

Note: The behavior when your vehicle hits the geofence is NOT configured in this example.
Note: The behavior when your vehicle hits the geofence is NOT configured in this example.

"""

Expand Down Expand Up @@ -51,5 +51,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
5 changes: 2 additions & 3 deletions examples/gimbal.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,5 @@ async def print_gimbal_position(drone):


if __name__ == "__main__":
# Start the main function
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/goto.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
3 changes: 2 additions & 1 deletion examples/logfile_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ async def get_entries(drone):


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
5 changes: 2 additions & 3 deletions examples/manual_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@ async def manual_controls():


if __name__ == "__main__":

loop = asyncio.get_event_loop()
loop.run_until_complete(manual_controls())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ async def observe_is_in_air(drone, running_tasks):


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/mission_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/offboard_attitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/offboard_position_ned.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/offboard_position_velocity_ned.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async def print_z_velocity(drone):


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/offboard_velocity_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/offboard_velocity_ned.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ async def run():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/send_status_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ async def run():
break

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/takeoff_and_land.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ async def print_status_text(drone):


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
5 changes: 2 additions & 3 deletions examples/takeoff_and_land_keyboard_control.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Author: @woosal1337
"""
#!/usr/bin/env python3

import asyncio
import pygame
Expand Down Expand Up @@ -148,6 +146,7 @@ async def print_position(drone=drone):

if __name__ == "__main__":

# TODO: use new asyncio methods
loop = asyncio.get_event_loop()
loop.run_until_complete(setup())
loop.run_until_complete(main())
Expand Down
7 changes: 2 additions & 5 deletions examples/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,5 @@ async def print_position(drone):


if __name__ == "__main__":
# Start the main function
asyncio.ensure_future(run())

# Runs the event loop until the program is canceled with e.g. CTRL-C
asyncio.get_event_loop().run_forever()
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/telemetry_flight_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ async def print_flight_mode():


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(print_flight_mode())
# Run the asyncio loop
asyncio.run(run())
7 changes: 2 additions & 5 deletions examples/telemetry_is_armed_is_in_air.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ async def print_is_in_air(drone):


if __name__ == "__main__":
# Start the main function
asyncio.ensure_future(run())

# Runs the event loop until the program is canceled with e.g. CTRL-C
asyncio.get_event_loop().run_forever()
# Run the asyncio loop
asyncio.run(run())
3 changes: 2 additions & 1 deletion examples/telemetry_takeoff_and_land.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@ async def observe_is_in_air(drone, running_tasks):


if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
9 changes: 3 additions & 6 deletions examples/transponder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async def run():
drone = System()
#await drone.connect(system_address="udp://:14540")
await drone.connect()

# Start the tasks
asyncio.ensure_future(print_transponders(drone))

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


if __name__ == "__main__":
# Start the main function
asyncio.ensure_future(run())

# Runs the event loop until the program is canceled with e.g. CTRL-C
asyncio.get_event_loop().run_forever()
# Run the asyncio loop
asyncio.run(run())
4 changes: 2 additions & 2 deletions examples/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async def run():
print("Tune played")

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
# Run the asyncio loop
asyncio.run(run())
46 changes: 0 additions & 46 deletions mavsdk/log_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,52 +431,6 @@ async def download_log_file(self, entry, path):
finally:
download_log_file_stream.cancel()

async def download_log_file(self, entry, path):
"""
Download log file synchronously.

Parameters
----------
entry : Entry
Entry of the log file to download.

path : std::string
Path of where to download log file to.

Returns
-------
progress : ProgressData
Progress if result is progress

Raises
------
LogFilesError
If the request fails. The error contains the reason for the failure.
"""

request = log_files_pb2.DownloadLogFileRequest()



entry.translate_to_rpc(request.entry)




request.path = path

response = await self._stub.DownloadLogFile(request)


result = self._extract_result(response)

if result.result != LogFilesResult.Result.SUCCESS:
raise LogFilesError(result, "download_log_file()", entry, path)


return ProgressData.translate_from_rpc(response.progress)


async def erase_all_log_files(self):
"""
Erase all log files.
Expand Down
42 changes: 15 additions & 27 deletions mavsdk/log_files_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading