Skip to content
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 @@
v4.0.5
v4.2.1
13 changes: 8 additions & 5 deletions mavsdk/action_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ class ActionServer(AsyncBase):
"""
Provide vehicle actions (as a server) such as arming, taking off, and landing.

The flight mode API is deprecated, use the ModesServer plugin instead. Once
ModesServer has modes set, mode change requests are left to it.

Generated by dcsdkgen - MAVSDK ActionServer API
"""

Expand Down Expand Up @@ -570,7 +573,7 @@ async def arm_disarm(self):

async def flight_mode_change(self):
"""
Subscribe to DO_SET_MODE
Subscribe to DO_SET_MODE (deprecated, use the ModesServer plugin instead)

Yields
-------
Expand Down Expand Up @@ -880,7 +883,7 @@ async def set_disarmable(self, disarmable, force_disarmable):

async def set_allowable_flight_modes(self, flight_modes):
"""
Set which modes the vehicle can transition to (Manual always allowed)
Set which modes the vehicle can transition to (Manual always allowed) (deprecated, use the ModesServer plugin instead)

Parameters
----------
Expand All @@ -907,7 +910,7 @@ async def set_allowable_flight_modes(self, flight_modes):

async def get_allowable_flight_modes(self):
"""
Get which modes the vehicle can transition to (Manual always allowed)
Get which modes the vehicle can transition to (Manual always allowed) (deprecated, use the ModesServer plugin instead)

Returns
-------
Expand Down Expand Up @@ -947,7 +950,7 @@ async def set_armed_state(self, is_armed):

async def set_flight_mode(self, flight_mode):
"""
Set/override the flight mode of the vehicle directly, and notify subscribers
Set/override the flight mode of the vehicle directly, and notify subscribers (deprecated, use the ModesServer plugin instead)

Parameters
----------
Expand All @@ -973,7 +976,7 @@ async def set_flight_mode(self, flight_mode):

async def set_flight_mode_internal(self, flight_mode):
"""
Set/override the flight mode of the vehicle directly, and *do not* notify subscribers
Set/override the flight mode of the vehicle directly, and *do not* notify subscribers (deprecated, use the ModesServer plugin instead)

Parameters
----------
Expand Down
14 changes: 7 additions & 7 deletions mavsdk/action_server_pb2.py

Large diffs are not rendered by default.

28 changes: 20 additions & 8 deletions mavsdk/action_server_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@


class ActionServerServiceStub(object):
"""Provide vehicle actions (as a server) such as arming, taking off, and landing."""
"""Provide vehicle actions (as a server) such as arming, taking off, and landing.

The flight mode API is deprecated, use the ModesServer plugin instead. Once
ModesServer has modes set, mode change requests are left to it.
"""

def __init__(self, channel):
"""Constructor.
Expand Down Expand Up @@ -131,7 +135,11 @@ def __init__(self, channel):


class ActionServerServiceServicer(object):
"""Provide vehicle actions (as a server) such as arming, taking off, and landing."""
"""Provide vehicle actions (as a server) such as arming, taking off, and landing.

The flight mode API is deprecated, use the ModesServer plugin instead. Once
ModesServer has modes set, mode change requests are left to it.
"""

def SubscribeArmDisarm(self, request, context):
"""Subscribe to ARM/DISARM commands"""
Expand All @@ -140,7 +148,7 @@ def SubscribeArmDisarm(self, request, context):
raise NotImplementedError("Method not implemented!")

def SubscribeFlightModeChange(self, request, context):
"""Subscribe to DO_SET_MODE"""
"""Subscribe to DO_SET_MODE (deprecated, use the ModesServer plugin instead)"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
Expand Down Expand Up @@ -194,13 +202,13 @@ def SetDisarmable(self, request, context):
raise NotImplementedError("Method not implemented!")

def SetAllowableFlightModes(self, request, context):
"""Set which modes the vehicle can transition to (Manual always allowed)"""
"""Set which modes the vehicle can transition to (Manual always allowed) (deprecated, use the ModesServer plugin instead)"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")

def GetAllowableFlightModes(self, request, context):
"""Get which modes the vehicle can transition to (Manual always allowed)"""
"""Get which modes the vehicle can transition to (Manual always allowed) (deprecated, use the ModesServer plugin instead)"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
Expand All @@ -212,13 +220,13 @@ def SetArmedState(self, request, context):
raise NotImplementedError("Method not implemented!")

def SetFlightMode(self, request, context):
"""Set/override the flight mode of the vehicle directly, and notify subscribers"""
"""Set/override the flight mode of the vehicle directly, and notify subscribers (deprecated, use the ModesServer plugin instead)"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")

def SetFlightModeInternal(self, request, context):
"""Set/override the flight mode of the vehicle directly, and *do not* notify subscribers"""
"""Set/override the flight mode of the vehicle directly, and *do not* notify subscribers (deprecated, use the ModesServer plugin instead)"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")
Expand Down Expand Up @@ -313,7 +321,11 @@ def add_ActionServerServiceServicer_to_server(servicer, server):

# This class is part of an EXPERIMENTAL API.
class ActionServerService(object):
"""Provide vehicle actions (as a server) such as arming, taking off, and landing."""
"""Provide vehicle actions (as a server) such as arming, taking off, and landing.

The flight mode API is deprecated, use the ModesServer plugin instead. Once
ModesServer has modes set, mode change requests are left to it.
"""

@staticmethod
def SubscribeArmDisarm(
Expand Down
64 changes: 64 additions & 0 deletions mavsdk/failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ class FailureUnit(Enum):
SYSTEM_MAVLINK_SIGNAL
MAVLink signal

SYSTEM_ESC
ESC telemetry

SYSTEM_TRAFFIC_AVOIDANCE
Traffic avoidance system like ADS-B or FLARM

DATALINK_LTE
Data link over a cellular (LTE) connection

DATALINK_WIFI
Data link over a Wi-Fi connection

DATALINK_TELEM_RADIO
Data link over a telemetry radio, e.g. a SiK radio

BUS_CAN
CAN bus, instance is the bus number, e.g. 1 for CAN1

BUS_I2C
I2C bus, instance is the bus number, e.g. 1 for I2C1

"""

SENSOR_GYRO = 0
Expand All @@ -74,6 +95,13 @@ class FailureUnit(Enum):
SYSTEM_AVOIDANCE = 12
SYSTEM_RC_SIGNAL = 13
SYSTEM_MAVLINK_SIGNAL = 14
SYSTEM_ESC = 15
SYSTEM_TRAFFIC_AVOIDANCE = 16
DATALINK_LTE = 17
DATALINK_WIFI = 18
DATALINK_TELEM_RADIO = 19
BUS_CAN = 20
BUS_I2C = 21

def translate_to_rpc(self):
if self == FailureUnit.SENSOR_GYRO:
Expand Down Expand Up @@ -106,6 +134,20 @@ def translate_to_rpc(self):
return failure_pb2.FAILURE_UNIT_SYSTEM_RC_SIGNAL
if self == FailureUnit.SYSTEM_MAVLINK_SIGNAL:
return failure_pb2.FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL
if self == FailureUnit.SYSTEM_ESC:
return failure_pb2.FAILURE_UNIT_SYSTEM_ESC
if self == FailureUnit.SYSTEM_TRAFFIC_AVOIDANCE:
return failure_pb2.FAILURE_UNIT_SYSTEM_TRAFFIC_AVOIDANCE
if self == FailureUnit.DATALINK_LTE:
return failure_pb2.FAILURE_UNIT_DATALINK_LTE
if self == FailureUnit.DATALINK_WIFI:
return failure_pb2.FAILURE_UNIT_DATALINK_WIFI
if self == FailureUnit.DATALINK_TELEM_RADIO:
return failure_pb2.FAILURE_UNIT_DATALINK_TELEM_RADIO
if self == FailureUnit.BUS_CAN:
return failure_pb2.FAILURE_UNIT_BUS_CAN
if self == FailureUnit.BUS_I2C:
return failure_pb2.FAILURE_UNIT_BUS_I2C

@staticmethod
def translate_from_rpc(rpc_enum_value):
Expand Down Expand Up @@ -140,6 +182,20 @@ def translate_from_rpc(rpc_enum_value):
return FailureUnit.SYSTEM_RC_SIGNAL
if rpc_enum_value == failure_pb2.FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL:
return FailureUnit.SYSTEM_MAVLINK_SIGNAL
if rpc_enum_value == failure_pb2.FAILURE_UNIT_SYSTEM_ESC:
return FailureUnit.SYSTEM_ESC
if rpc_enum_value == failure_pb2.FAILURE_UNIT_SYSTEM_TRAFFIC_AVOIDANCE:
return FailureUnit.SYSTEM_TRAFFIC_AVOIDANCE
if rpc_enum_value == failure_pb2.FAILURE_UNIT_DATALINK_LTE:
return FailureUnit.DATALINK_LTE
if rpc_enum_value == failure_pb2.FAILURE_UNIT_DATALINK_WIFI:
return FailureUnit.DATALINK_WIFI
if rpc_enum_value == failure_pb2.FAILURE_UNIT_DATALINK_TELEM_RADIO:
return FailureUnit.DATALINK_TELEM_RADIO
if rpc_enum_value == failure_pb2.FAILURE_UNIT_BUS_CAN:
return FailureUnit.BUS_CAN
if rpc_enum_value == failure_pb2.FAILURE_UNIT_BUS_I2C:
return FailureUnit.BUS_I2C

def __str__(self):
return self.name
Expand Down Expand Up @@ -175,6 +231,9 @@ class FailureType(Enum):
INTERMITTENT
Unit is sometimes working, sometimes not

DRIFT
Unit is publishing plausible values but drifting away from true values

"""

OK = 0
Expand All @@ -185,6 +244,7 @@ class FailureType(Enum):
SLOW = 5
DELAYED = 6
INTERMITTENT = 7
DRIFT = 8

def translate_to_rpc(self):
if self == FailureType.OK:
Expand All @@ -203,6 +263,8 @@ def translate_to_rpc(self):
return failure_pb2.FAILURE_TYPE_DELAYED
if self == FailureType.INTERMITTENT:
return failure_pb2.FAILURE_TYPE_INTERMITTENT
if self == FailureType.DRIFT:
return failure_pb2.FAILURE_TYPE_DRIFT

@staticmethod
def translate_from_rpc(rpc_enum_value):
Expand All @@ -223,6 +285,8 @@ def translate_from_rpc(rpc_enum_value):
return FailureType.DELAYED
if rpc_enum_value == failure_pb2.FAILURE_TYPE_INTERMITTENT:
return FailureType.INTERMITTENT
if rpc_enum_value == failure_pb2.FAILURE_TYPE_DRIFT:
return FailureType.DRIFT

def __str__(self):
return self.name
Expand Down
12 changes: 6 additions & 6 deletions mavsdk/failure_pb2.py

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

30 changes: 30 additions & 0 deletions mavsdk/log_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class Result(Enum):
NO_SYSTEM
No system is connected

CANCELLED
Download was cancelled

"""

UNKNOWN = 0
Expand All @@ -166,6 +169,7 @@ class Result(Enum):
INVALID_ARGUMENT = 5
FILE_OPEN_FAILED = 6
NO_SYSTEM = 7
CANCELLED = 8

def translate_to_rpc(self):
if self == LogFilesResult.Result.UNKNOWN:
Expand All @@ -184,6 +188,8 @@ def translate_to_rpc(self):
return log_files_pb2.LogFilesResult.RESULT_FILE_OPEN_FAILED
if self == LogFilesResult.Result.NO_SYSTEM:
return log_files_pb2.LogFilesResult.RESULT_NO_SYSTEM
if self == LogFilesResult.Result.CANCELLED:
return log_files_pb2.LogFilesResult.RESULT_CANCELLED

@staticmethod
def translate_from_rpc(rpc_enum_value):
Expand All @@ -204,6 +210,8 @@ def translate_from_rpc(rpc_enum_value):
return LogFilesResult.Result.FILE_OPEN_FAILED
if rpc_enum_value == log_files_pb2.LogFilesResult.RESULT_NO_SYSTEM:
return LogFilesResult.Result.NO_SYSTEM
if rpc_enum_value == log_files_pb2.LogFilesResult.RESULT_CANCELLED:
return LogFilesResult.Result.CANCELLED

def __str__(self):
return self.name
Expand Down Expand Up @@ -356,6 +364,28 @@ async def download_log_file(self, entry, path):
finally:
download_log_file_stream.cancel()

async def cancel_download_log_file(self):
"""
Cancel an ongoing log file download.

Returns Success, also if no download is in progress (a warning is logged).
The callback of the ongoing download is called once with Cancelled,
the vehicle is told to stop sending, and the partially downloaded file is deleted.

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

request = log_files_pb2.CancelDownloadLogFileRequest()
response = await self._stub.CancelDownloadLogFile(request)

result = self._extract_result(response)

if result.result != LogFilesResult.Result.SUCCESS:
raise LogFilesError(result, "cancel_download_log_file()")

async def erase_all_log_files(self):
"""
Erase all log files.
Expand Down
Loading
Loading