diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index e5d4cf33..85c71c86 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1 +1 @@ -v4.0.5 +v4.2.1 diff --git a/mavsdk/action_pb2.py b/mavsdk/action_pb2.py index 97c5a7e0..48a25e78 100644 --- a/mavsdk/action_pb2.py +++ b/mavsdk/action_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: action/action.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "action/action.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "action/action.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/action_pb2_grpc.py b/mavsdk/action_pb2_grpc.py index 600e1aa2..6642a2f7 100644 --- a/mavsdk/action_pb2_grpc.py +++ b/mavsdk/action_pb2_grpc.py @@ -6,7 +6,7 @@ from . import action_pb2 as action_dot_action__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in action/action_pb2_grpc.py depends on" + + " but the generated code in action/action_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ActionServiceStub(object): +class ActionServiceStub: """Enable simple actions such as arming, taking off, and landing.""" def __init__(self, channel): @@ -190,7 +190,7 @@ def __init__(self, channel): ) -class ActionServiceServicer(object): +class ActionServiceServicer: """Enable simple actions such as arming, taking off, and landing.""" def Arm(self, request, context): @@ -607,7 +607,7 @@ def add_ActionServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ActionService(object): +class ActionService: """Enable simple actions such as arming, taking off, and landing.""" @staticmethod diff --git a/mavsdk/action_server.py b/mavsdk/action_server.py index 67b05471..fc7e4269 100644 --- a/mavsdk/action_server.py +++ b/mavsdk/action_server.py @@ -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 """ @@ -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 ------- @@ -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 ---------- @@ -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 ------- @@ -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 ---------- @@ -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 ---------- diff --git a/mavsdk/action_server_pb2.py b/mavsdk/action_server_pb2.py index 8fda7e27..88d2d5ec 100644 --- a/mavsdk/action_server_pb2.py +++ b/mavsdk/action_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: action_server/action_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "action_server/action_server.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "action_server/action_server.proto" ) # @@protoc_insertion_point(imports) @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n!action_server/action_server.proto\x12\x18mavsdk.rpc.action_server\x1a\x14mavsdk_options.proto"/\n\x16SetAllowTakeoffRequest\x12\x15\n\rallow_takeoff\x18\x01 \x01(\x08";\n\x11SetArmableRequest\x12\x0f\n\x07\x61rmable\x18\x01 \x01(\x08\x12\x15\n\rforce_armable\x18\x02 \x01(\x08"D\n\x14SetDisarmableRequest\x12\x12\n\ndisarmable\x18\x01 \x01(\x08\x12\x18\n\x10\x66orce_disarmable\x18\x02 \x01(\x08"f\n\x1eSetAllowableFlightModesRequest\x12\x44\n\x0c\x66light_modes\x18\x01 \x01(\x0b\x32..mavsdk.rpc.action_server.AllowableFlightModes"(\n\x14SetArmedStateRequest\x12\x10\n\x08is_armed\x18\x01 \x01(\x08"Q\n\x14SetFlightModeRequest\x12\x39\n\x0b\x66light_mode\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode"Y\n\x1cSetFlightModeInternalRequest\x12\x39\n\x0b\x66light_mode\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode" \n\x1eGetAllowableFlightModesRequest"\x1b\n\x19SubscribeArmDisarmRequest""\n SubscribeFlightModeChangeRequest"\x19\n\x17SubscribeTakeoffRequest"\x16\n\x14SubscribeLandRequest"\x18\n\x16SubscribeRebootRequest"\x1a\n\x18SubscribeShutdownRequest"\x1b\n\x19SubscribeTerminateRequest"\x91\x01\n\x11\x41rmDisarmResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x30\n\x03\x61rm\x18\x02 \x01(\x0b\x32#.mavsdk.rpc.action_server.ArmDisarm"\xa1\x01\n\x18\x46lightModeChangeResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x39\n\x0b\x66light_mode\x18\x02 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode"n\n\x0fTakeoffResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0f\n\x07takeoff\x18\x02 \x01(\x08"h\n\x0cLandResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0c\n\x04land\x18\x02 \x01(\x08"l\n\x0eRebootResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0e\n\x06reboot\x18\x02 \x01(\x08"p\n\x10ShutdownResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x10\n\x08shutdown\x18\x02 \x01(\x08"r\n\x11TerminateResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x11\n\tterminate\x18\x02 \x01(\x08"`\n\x12SetArmableResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"c\n\x15SetDisarmableResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"m\n\x1fSetAllowableFlightModesResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"e\n\x17SetAllowTakeoffResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"g\n\x1fGetAllowableFlightModesResponse\x12\x44\n\x0c\x66light_modes\x18\x01 \x01(\x0b\x32..mavsdk.rpc.action_server.AllowableFlightModes"c\n\x15SetArmedStateResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"c\n\x15SetFlightModeResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"k\n\x1dSetFlightModeInternalResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"\xd6\x01\n\x14\x41llowableFlightModes\x12\x15\n\rcan_auto_mode\x18\x01 \x01(\x08\x12\x17\n\x0f\x63\x61n_guided_mode\x18\x02 \x01(\x08\x12\x1a\n\x12\x63\x61n_stabilize_mode\x18\x03 \x01(\x08\x12\x19\n\x11\x63\x61n_auto_rtl_mode\x18\x04 \x01(\x08\x12\x1d\n\x15\x63\x61n_auto_takeoff_mode\x18\x05 \x01(\x08\x12\x1a\n\x12\x63\x61n_auto_land_mode\x18\x06 \x01(\x08\x12\x1c\n\x14\x63\x61n_auto_loiter_mode\x18\x07 \x01(\x08"\'\n\tArmDisarm\x12\x0b\n\x03\x61rm\x18\x01 \x01(\x08\x12\r\n\x05\x66orce\x18\x02 \x01(\x08"\xe9\x03\n\x12\x41\x63tionServerResult\x12\x43\n\x06result\x18\x01 \x01(\x0e\x32\x33.mavsdk.rpc.action_server.ActionServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xf9\x02\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x0f\n\x0bRESULT_BUSY\x10\x04\x12\x19\n\x15RESULT_COMMAND_DENIED\x10\x05\x12.\n*RESULT_COMMAND_DENIED_LANDED_STATE_UNKNOWN\x10\x06\x12$\n RESULT_COMMAND_DENIED_NOT_LANDED\x10\x07\x12\x12\n\x0eRESULT_TIMEOUT\x10\x08\x12*\n&RESULT_VTOL_TRANSITION_SUPPORT_UNKNOWN\x10\t\x12%\n!RESULT_NO_VTOL_TRANSITION_SUPPORT\x10\n\x12\x1a\n\x16RESULT_PARAMETER_ERROR\x10\x0b\x12\x0f\n\x0bRESULT_NEXT\x10\x0c*\xeb\x02\n\nFlightMode\x12\x17\n\x13\x46LIGHT_MODE_UNKNOWN\x10\x00\x12\x15\n\x11\x46LIGHT_MODE_READY\x10\x01\x12\x17\n\x13\x46LIGHT_MODE_TAKEOFF\x10\x02\x12\x14\n\x10\x46LIGHT_MODE_HOLD\x10\x03\x12\x17\n\x13\x46LIGHT_MODE_MISSION\x10\x04\x12 \n\x1c\x46LIGHT_MODE_RETURN_TO_LAUNCH\x10\x05\x12\x14\n\x10\x46LIGHT_MODE_LAND\x10\x06\x12\x18\n\x14\x46LIGHT_MODE_OFFBOARD\x10\x07\x12\x19\n\x15\x46LIGHT_MODE_FOLLOW_ME\x10\x08\x12\x16\n\x12\x46LIGHT_MODE_MANUAL\x10\t\x12\x16\n\x12\x46LIGHT_MODE_ALTCTL\x10\n\x12\x16\n\x12\x46LIGHT_MODE_POSCTL\x10\x0b\x12\x14\n\x10\x46LIGHT_MODE_ACRO\x10\x0c\x12\x1a\n\x16\x46LIGHT_MODE_STABILIZED\x10\r2\x9e\x0f\n\x13\x41\x63tionServerService\x12~\n\x12SubscribeArmDisarm\x12\x33.mavsdk.rpc.action_server.SubscribeArmDisarmRequest\x1a+.mavsdk.rpc.action_server.ArmDisarmResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x93\x01\n\x19SubscribeFlightModeChange\x12:.mavsdk.rpc.action_server.SubscribeFlightModeChangeRequest\x1a\x32.mavsdk.rpc.action_server.FlightModeChangeResponse"\x04\x80\xb5\x18\x00\x30\x01\x12x\n\x10SubscribeTakeoff\x12\x31.mavsdk.rpc.action_server.SubscribeTakeoffRequest\x1a).mavsdk.rpc.action_server.TakeoffResponse"\x04\x80\xb5\x18\x00\x30\x01\x12o\n\rSubscribeLand\x12..mavsdk.rpc.action_server.SubscribeLandRequest\x1a&.mavsdk.rpc.action_server.LandResponse"\x04\x80\xb5\x18\x00\x30\x01\x12u\n\x0fSubscribeReboot\x12\x30.mavsdk.rpc.action_server.SubscribeRebootRequest\x1a(.mavsdk.rpc.action_server.RebootResponse"\x04\x80\xb5\x18\x00\x30\x01\x12{\n\x11SubscribeShutdown\x12\x32.mavsdk.rpc.action_server.SubscribeShutdownRequest\x1a*.mavsdk.rpc.action_server.ShutdownResponse"\x04\x80\xb5\x18\x00\x30\x01\x12~\n\x12SubscribeTerminate\x12\x33.mavsdk.rpc.action_server.SubscribeTerminateRequest\x1a+.mavsdk.rpc.action_server.TerminateResponse"\x04\x80\xb5\x18\x00\x30\x01\x12|\n\x0fSetAllowTakeoff\x12\x30.mavsdk.rpc.action_server.SetAllowTakeoffRequest\x1a\x31.mavsdk.rpc.action_server.SetAllowTakeoffResponse"\x04\x80\xb5\x18\x01\x12m\n\nSetArmable\x12+.mavsdk.rpc.action_server.SetArmableRequest\x1a,.mavsdk.rpc.action_server.SetArmableResponse"\x04\x80\xb5\x18\x01\x12v\n\rSetDisarmable\x12..mavsdk.rpc.action_server.SetDisarmableRequest\x1a/.mavsdk.rpc.action_server.SetDisarmableResponse"\x04\x80\xb5\x18\x01\x12\x94\x01\n\x17SetAllowableFlightModes\x12\x38.mavsdk.rpc.action_server.SetAllowableFlightModesRequest\x1a\x39.mavsdk.rpc.action_server.SetAllowableFlightModesResponse"\x04\x80\xb5\x18\x01\x12\x94\x01\n\x17GetAllowableFlightModes\x12\x38.mavsdk.rpc.action_server.GetAllowableFlightModesRequest\x1a\x39.mavsdk.rpc.action_server.GetAllowableFlightModesResponse"\x04\x80\xb5\x18\x01\x12v\n\rSetArmedState\x12..mavsdk.rpc.action_server.SetArmedStateRequest\x1a/.mavsdk.rpc.action_server.SetArmedStateResponse"\x04\x80\xb5\x18\x01\x12v\n\rSetFlightMode\x12..mavsdk.rpc.action_server.SetFlightModeRequest\x1a/.mavsdk.rpc.action_server.SetFlightModeResponse"\x04\x80\xb5\x18\x01\x12\x8e\x01\n\x15SetFlightModeInternal\x12\x36.mavsdk.rpc.action_server.SetFlightModeInternalRequest\x1a\x37.mavsdk.rpc.action_server.SetFlightModeInternalResponse"\x04\x80\xb5\x18\x01\x42,\n\x17io.mavsdk.action_serverB\x11\x41\x63tionServerProtob\x06proto3' + b'\n!action_server/action_server.proto\x12\x18mavsdk.rpc.action_server\x1a\x14mavsdk_options.proto"/\n\x16SetAllowTakeoffRequest\x12\x15\n\rallow_takeoff\x18\x01 \x01(\x08";\n\x11SetArmableRequest\x12\x0f\n\x07\x61rmable\x18\x01 \x01(\x08\x12\x15\n\rforce_armable\x18\x02 \x01(\x08"D\n\x14SetDisarmableRequest\x12\x12\n\ndisarmable\x18\x01 \x01(\x08\x12\x18\n\x10\x66orce_disarmable\x18\x02 \x01(\x08"f\n\x1eSetAllowableFlightModesRequest\x12\x44\n\x0c\x66light_modes\x18\x01 \x01(\x0b\x32..mavsdk.rpc.action_server.AllowableFlightModes"(\n\x14SetArmedStateRequest\x12\x10\n\x08is_armed\x18\x01 \x01(\x08"Q\n\x14SetFlightModeRequest\x12\x39\n\x0b\x66light_mode\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode"Y\n\x1cSetFlightModeInternalRequest\x12\x39\n\x0b\x66light_mode\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode" \n\x1eGetAllowableFlightModesRequest"\x1b\n\x19SubscribeArmDisarmRequest""\n SubscribeFlightModeChangeRequest"\x19\n\x17SubscribeTakeoffRequest"\x16\n\x14SubscribeLandRequest"\x18\n\x16SubscribeRebootRequest"\x1a\n\x18SubscribeShutdownRequest"\x1b\n\x19SubscribeTerminateRequest"\x91\x01\n\x11\x41rmDisarmResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x30\n\x03\x61rm\x18\x02 \x01(\x0b\x32#.mavsdk.rpc.action_server.ArmDisarm"\xa1\x01\n\x18\x46lightModeChangeResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x39\n\x0b\x66light_mode\x18\x02 \x01(\x0e\x32$.mavsdk.rpc.action_server.FlightMode"n\n\x0fTakeoffResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0f\n\x07takeoff\x18\x02 \x01(\x08"h\n\x0cLandResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0c\n\x04land\x18\x02 \x01(\x08"l\n\x0eRebootResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x0e\n\x06reboot\x18\x02 \x01(\x08"p\n\x10ShutdownResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x10\n\x08shutdown\x18\x02 \x01(\x08"r\n\x11TerminateResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult\x12\x11\n\tterminate\x18\x02 \x01(\x08"`\n\x12SetArmableResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"c\n\x15SetDisarmableResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"m\n\x1fSetAllowableFlightModesResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"e\n\x17SetAllowTakeoffResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"g\n\x1fGetAllowableFlightModesResponse\x12\x44\n\x0c\x66light_modes\x18\x01 \x01(\x0b\x32..mavsdk.rpc.action_server.AllowableFlightModes"c\n\x15SetArmedStateResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"c\n\x15SetFlightModeResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"k\n\x1dSetFlightModeInternalResponse\x12J\n\x14\x61\x63tion_server_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.action_server.ActionServerResult"\xd6\x01\n\x14\x41llowableFlightModes\x12\x15\n\rcan_auto_mode\x18\x01 \x01(\x08\x12\x17\n\x0f\x63\x61n_guided_mode\x18\x02 \x01(\x08\x12\x1a\n\x12\x63\x61n_stabilize_mode\x18\x03 \x01(\x08\x12\x19\n\x11\x63\x61n_auto_rtl_mode\x18\x04 \x01(\x08\x12\x1d\n\x15\x63\x61n_auto_takeoff_mode\x18\x05 \x01(\x08\x12\x1a\n\x12\x63\x61n_auto_land_mode\x18\x06 \x01(\x08\x12\x1c\n\x14\x63\x61n_auto_loiter_mode\x18\x07 \x01(\x08"\'\n\tArmDisarm\x12\x0b\n\x03\x61rm\x18\x01 \x01(\x08\x12\r\n\x05\x66orce\x18\x02 \x01(\x08"\xe9\x03\n\x12\x41\x63tionServerResult\x12\x43\n\x06result\x18\x01 \x01(\x0e\x32\x33.mavsdk.rpc.action_server.ActionServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xf9\x02\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x0f\n\x0bRESULT_BUSY\x10\x04\x12\x19\n\x15RESULT_COMMAND_DENIED\x10\x05\x12.\n*RESULT_COMMAND_DENIED_LANDED_STATE_UNKNOWN\x10\x06\x12$\n RESULT_COMMAND_DENIED_NOT_LANDED\x10\x07\x12\x12\n\x0eRESULT_TIMEOUT\x10\x08\x12*\n&RESULT_VTOL_TRANSITION_SUPPORT_UNKNOWN\x10\t\x12%\n!RESULT_NO_VTOL_TRANSITION_SUPPORT\x10\n\x12\x1a\n\x16RESULT_PARAMETER_ERROR\x10\x0b\x12\x0f\n\x0bRESULT_NEXT\x10\x0c*\xeb\x02\n\nFlightMode\x12\x17\n\x13\x46LIGHT_MODE_UNKNOWN\x10\x00\x12\x15\n\x11\x46LIGHT_MODE_READY\x10\x01\x12\x17\n\x13\x46LIGHT_MODE_TAKEOFF\x10\x02\x12\x14\n\x10\x46LIGHT_MODE_HOLD\x10\x03\x12\x17\n\x13\x46LIGHT_MODE_MISSION\x10\x04\x12 \n\x1c\x46LIGHT_MODE_RETURN_TO_LAUNCH\x10\x05\x12\x14\n\x10\x46LIGHT_MODE_LAND\x10\x06\x12\x18\n\x14\x46LIGHT_MODE_OFFBOARD\x10\x07\x12\x19\n\x15\x46LIGHT_MODE_FOLLOW_ME\x10\x08\x12\x16\n\x12\x46LIGHT_MODE_MANUAL\x10\t\x12\x16\n\x12\x46LIGHT_MODE_ALTCTL\x10\n\x12\x16\n\x12\x46LIGHT_MODE_POSCTL\x10\x0b\x12\x14\n\x10\x46LIGHT_MODE_ACRO\x10\x0c\x12\x1a\n\x16\x46LIGHT_MODE_STABILIZED\x10\r2\xad\x0f\n\x13\x41\x63tionServerService\x12~\n\x12SubscribeArmDisarm\x12\x33.mavsdk.rpc.action_server.SubscribeArmDisarmRequest\x1a+.mavsdk.rpc.action_server.ArmDisarmResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x96\x01\n\x19SubscribeFlightModeChange\x12:.mavsdk.rpc.action_server.SubscribeFlightModeChangeRequest\x1a\x32.mavsdk.rpc.action_server.FlightModeChangeResponse"\x07\x88\x02\x01\x80\xb5\x18\x00\x30\x01\x12x\n\x10SubscribeTakeoff\x12\x31.mavsdk.rpc.action_server.SubscribeTakeoffRequest\x1a).mavsdk.rpc.action_server.TakeoffResponse"\x04\x80\xb5\x18\x00\x30\x01\x12o\n\rSubscribeLand\x12..mavsdk.rpc.action_server.SubscribeLandRequest\x1a&.mavsdk.rpc.action_server.LandResponse"\x04\x80\xb5\x18\x00\x30\x01\x12u\n\x0fSubscribeReboot\x12\x30.mavsdk.rpc.action_server.SubscribeRebootRequest\x1a(.mavsdk.rpc.action_server.RebootResponse"\x04\x80\xb5\x18\x00\x30\x01\x12{\n\x11SubscribeShutdown\x12\x32.mavsdk.rpc.action_server.SubscribeShutdownRequest\x1a*.mavsdk.rpc.action_server.ShutdownResponse"\x04\x80\xb5\x18\x00\x30\x01\x12~\n\x12SubscribeTerminate\x12\x33.mavsdk.rpc.action_server.SubscribeTerminateRequest\x1a+.mavsdk.rpc.action_server.TerminateResponse"\x04\x80\xb5\x18\x00\x30\x01\x12|\n\x0fSetAllowTakeoff\x12\x30.mavsdk.rpc.action_server.SetAllowTakeoffRequest\x1a\x31.mavsdk.rpc.action_server.SetAllowTakeoffResponse"\x04\x80\xb5\x18\x01\x12m\n\nSetArmable\x12+.mavsdk.rpc.action_server.SetArmableRequest\x1a,.mavsdk.rpc.action_server.SetArmableResponse"\x04\x80\xb5\x18\x01\x12v\n\rSetDisarmable\x12..mavsdk.rpc.action_server.SetDisarmableRequest\x1a/.mavsdk.rpc.action_server.SetDisarmableResponse"\x04\x80\xb5\x18\x01\x12\x97\x01\n\x17SetAllowableFlightModes\x12\x38.mavsdk.rpc.action_server.SetAllowableFlightModesRequest\x1a\x39.mavsdk.rpc.action_server.SetAllowableFlightModesResponse"\x07\x88\x02\x01\x80\xb5\x18\x01\x12\x97\x01\n\x17GetAllowableFlightModes\x12\x38.mavsdk.rpc.action_server.GetAllowableFlightModesRequest\x1a\x39.mavsdk.rpc.action_server.GetAllowableFlightModesResponse"\x07\x88\x02\x01\x80\xb5\x18\x01\x12v\n\rSetArmedState\x12..mavsdk.rpc.action_server.SetArmedStateRequest\x1a/.mavsdk.rpc.action_server.SetArmedStateResponse"\x04\x80\xb5\x18\x01\x12y\n\rSetFlightMode\x12..mavsdk.rpc.action_server.SetFlightModeRequest\x1a/.mavsdk.rpc.action_server.SetFlightModeResponse"\x07\x88\x02\x01\x80\xb5\x18\x01\x12\x91\x01\n\x15SetFlightModeInternal\x12\x36.mavsdk.rpc.action_server.SetFlightModeInternalRequest\x1a\x37.mavsdk.rpc.action_server.SetFlightModeInternalResponse"\x07\x88\x02\x01\x80\xb5\x18\x01\x42,\n\x17io.mavsdk.action_serverB\x11\x41\x63tionServerProtob\x06proto3' ) _globals = globals() @@ -47,7 +47,7 @@ ]._loaded_options = None _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SubscribeFlightModeChange" - ]._serialized_options = b"\200\265\030\000" + ]._serialized_options = b"\210\002\001\200\265\030\000" _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SubscribeTakeoff" ]._loaded_options = None @@ -101,13 +101,13 @@ ]._loaded_options = None _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetAllowableFlightModes" - ]._serialized_options = b"\200\265\030\001" + ]._serialized_options = b"\210\002\001\200\265\030\001" _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "GetAllowableFlightModes" ]._loaded_options = None _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "GetAllowableFlightModes" - ]._serialized_options = b"\200\265\030\001" + ]._serialized_options = b"\210\002\001\200\265\030\001" _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetArmedState" ]._loaded_options = None @@ -119,13 +119,13 @@ ]._loaded_options = None _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetFlightMode" - ]._serialized_options = b"\200\265\030\001" + ]._serialized_options = b"\210\002\001\200\265\030\001" _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetFlightModeInternal" ]._loaded_options = None _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetFlightModeInternal" - ]._serialized_options = b"\200\265\030\001" + ]._serialized_options = b"\210\002\001\200\265\030\001" _globals["_FLIGHTMODE"]._serialized_start = 3268 _globals["_FLIGHTMODE"]._serialized_end = 3631 _globals["_SETALLOWTAKEOFFREQUEST"]._serialized_start = 85 @@ -197,5 +197,5 @@ _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_start = 2888 _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_end = 3265 _globals["_ACTIONSERVERSERVICE"]._serialized_start = 3634 - _globals["_ACTIONSERVERSERVICE"]._serialized_end = 5584 + _globals["_ACTIONSERVERSERVICE"]._serialized_end = 5599 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/action_server_pb2_grpc.py b/mavsdk/action_server_pb2_grpc.py index fc1b7662..53eeed72 100644 --- a/mavsdk/action_server_pb2_grpc.py +++ b/mavsdk/action_server_pb2_grpc.py @@ -6,7 +6,7 @@ from . import action_server_pb2 as action__server_dot_action__server__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,15 +22,19 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in action_server/action_server_pb2_grpc.py depends on" + + " but the generated code in action_server/action_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ActionServerServiceStub(object): - """Provide vehicle actions (as a server) such as arming, taking off, and landing.""" +class ActionServerServiceStub: + """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. @@ -130,8 +134,12 @@ def __init__(self, channel): ) -class ActionServerServiceServicer(object): - """Provide vehicle actions (as a server) such as arming, taking off, and landing.""" +class ActionServerServiceServicer: + """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""" @@ -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!") @@ -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!") @@ -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!") @@ -312,8 +320,12 @@ 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.""" +class ActionServerService: + """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( diff --git a/mavsdk/arm_authorizer_server_pb2.py b/mavsdk/arm_authorizer_server_pb2.py index eb202308..08eb6b55 100644 --- a/mavsdk/arm_authorizer_server_pb2.py +++ b/mavsdk/arm_authorizer_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: arm_authorizer_server/arm_authorizer_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "arm_authorizer_server/arm_authorizer_server.proto", diff --git a/mavsdk/arm_authorizer_server_pb2_grpc.py b/mavsdk/arm_authorizer_server_pb2_grpc.py index 7ac20768..2db8a9a9 100644 --- a/mavsdk/arm_authorizer_server_pb2_grpc.py +++ b/mavsdk/arm_authorizer_server_pb2_grpc.py @@ -8,7 +8,7 @@ arm_authorizer_server_pb2 as arm__authorizer__server_dot_arm__authorizer__server__pb2, ) -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -24,14 +24,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in arm_authorizer_server/arm_authorizer_server_pb2_grpc.py depends on" + + " but the generated code in arm_authorizer_server/arm_authorizer_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ArmAuthorizerServerServiceStub(object): +class ArmAuthorizerServerServiceStub: """Use arm authorization.""" def __init__(self, channel): @@ -60,7 +60,7 @@ def __init__(self, channel): ) -class ArmAuthorizerServerServiceServicer(object): +class ArmAuthorizerServerServiceServicer: """Use arm authorization.""" def SubscribeArmAuthorization(self, request, context): @@ -112,7 +112,7 @@ def add_ArmAuthorizerServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ArmAuthorizerServerService(object): +class ArmAuthorizerServerService: """Use arm authorization.""" @staticmethod diff --git a/mavsdk/calibration_pb2.py b/mavsdk/calibration_pb2.py index 2732aa24..44992369 100644 --- a/mavsdk/calibration_pb2.py +++ b/mavsdk/calibration_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: calibration/calibration.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "calibration/calibration.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "calibration/calibration.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/calibration_pb2_grpc.py b/mavsdk/calibration_pb2_grpc.py index ff7b1e8b..77d6b9ec 100644 --- a/mavsdk/calibration_pb2_grpc.py +++ b/mavsdk/calibration_pb2_grpc.py @@ -6,7 +6,7 @@ from . import calibration_pb2 as calibration_dot_calibration__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in calibration/calibration_pb2_grpc.py depends on" + + " but the generated code in calibration/calibration_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class CalibrationServiceStub(object): +class CalibrationServiceStub: """Enable to calibrate sensors of a drone such as gyro, accelerometer, and magnetometer.""" def __init__(self, channel): @@ -76,7 +76,7 @@ def __init__(self, channel): ) -class CalibrationServiceServicer(object): +class CalibrationServiceServicer: """Enable to calibrate sensors of a drone such as gyro, accelerometer, and magnetometer.""" def SubscribeCalibrateGyro(self, request, context): @@ -159,7 +159,7 @@ def add_CalibrationServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class CalibrationService(object): +class CalibrationService: """Enable to calibrate sensors of a drone such as gyro, accelerometer, and magnetometer.""" @staticmethod diff --git a/mavsdk/camera_pb2.py b/mavsdk/camera_pb2.py index a1d6e298..7f82b1e2 100644 --- a/mavsdk/camera_pb2.py +++ b/mavsdk/camera_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: camera/camera.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "camera/camera.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "camera/camera.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/camera_pb2_grpc.py b/mavsdk/camera_pb2_grpc.py index 777ca531..a1e9578c 100644 --- a/mavsdk/camera_pb2_grpc.py +++ b/mavsdk/camera_pb2_grpc.py @@ -6,7 +6,7 @@ from . import camera_pb2 as camera_dot_camera__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in camera/camera_pb2_grpc.py depends on" + + " but the generated code in camera/camera_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class CameraServiceStub(object): +class CameraServiceStub: """ Can be used to manage cameras that implement the MAVLink Camera Protocol: https://mavlink.io/en/services/camera.html. @@ -300,7 +300,7 @@ def __init__(self, channel): ) -class CameraServiceServicer(object): +class CameraServiceServicer: """ Can be used to manage cameras that implement the MAVLink Camera Protocol: https://mavlink.io/en/services/camera.html. @@ -889,7 +889,7 @@ def add_CameraServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class CameraService(object): +class CameraService: """ Can be used to manage cameras that implement the MAVLink Camera Protocol: https://mavlink.io/en/services/camera.html. diff --git a/mavsdk/camera_server_pb2.py b/mavsdk/camera_server_pb2.py index bd22fdd4..5b70523b 100644 --- a/mavsdk/camera_server_pb2.py +++ b/mavsdk/camera_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: camera_server/camera_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "camera_server/camera_server.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "camera_server/camera_server.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/camera_server_pb2_grpc.py b/mavsdk/camera_server_pb2_grpc.py index fb48dfd2..2b6c9f3e 100644 --- a/mavsdk/camera_server_pb2_grpc.py +++ b/mavsdk/camera_server_pb2_grpc.py @@ -6,7 +6,7 @@ from . import camera_server_pb2 as camera__server_dot_camera__server__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in camera_server/camera_server_pb2_grpc.py depends on" + + " but the generated code in camera_server/camera_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class CameraServerServiceStub(object): +class CameraServerServiceStub: """Provides handling of camera interface""" def __init__(self, channel): @@ -418,7 +418,7 @@ def __init__(self, channel): ) -class CameraServerServiceServicer(object): +class CameraServerServiceServicer: """Provides handling of camera interface""" def SetInformation(self, request, context): @@ -1128,7 +1128,7 @@ def add_CameraServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class CameraServerService(object): +class CameraServerService: """Provides handling of camera interface""" @staticmethod diff --git a/mavsdk/component_metadata_pb2.py b/mavsdk/component_metadata_pb2.py index ea7feb71..755ce668 100644 --- a/mavsdk/component_metadata_pb2.py +++ b/mavsdk/component_metadata_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: component_metadata/component_metadata.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "component_metadata/component_metadata.proto", diff --git a/mavsdk/component_metadata_pb2_grpc.py b/mavsdk/component_metadata_pb2_grpc.py index a8b6e234..1cd8777b 100644 --- a/mavsdk/component_metadata_pb2_grpc.py +++ b/mavsdk/component_metadata_pb2_grpc.py @@ -6,7 +6,7 @@ from . import component_metadata_pb2 as component__metadata_dot_component__metadata__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in component_metadata/component_metadata_pb2_grpc.py depends on" + + " but the generated code in component_metadata/component_metadata_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ComponentMetadataServiceStub(object): +class ComponentMetadataServiceStub: """Access component metadata json definitions, such as parameters.""" def __init__(self, channel): @@ -64,7 +64,7 @@ def __init__(self, channel): ) -class ComponentMetadataServiceServicer(object): +class ComponentMetadataServiceServicer: """Access component metadata json definitions, such as parameters.""" def RequestComponent(self, request, context): @@ -136,7 +136,7 @@ def add_ComponentMetadataServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ComponentMetadataService(object): +class ComponentMetadataService: """Access component metadata json definitions, such as parameters.""" @staticmethod diff --git a/mavsdk/component_metadata_server_pb2.py b/mavsdk/component_metadata_server_pb2.py index 6a6fa627..49adaa56 100644 --- a/mavsdk/component_metadata_server_pb2.py +++ b/mavsdk/component_metadata_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: component_metadata_server/component_metadata_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "component_metadata_server/component_metadata_server.proto", diff --git a/mavsdk/component_metadata_server_pb2_grpc.py b/mavsdk/component_metadata_server_pb2_grpc.py index 887f5914..a9da3cc7 100644 --- a/mavsdk/component_metadata_server_pb2_grpc.py +++ b/mavsdk/component_metadata_server_pb2_grpc.py @@ -8,7 +8,7 @@ component_metadata_server_pb2 as component__metadata__server_dot_component__metadata__server__pb2, ) -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -24,14 +24,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in component_metadata_server/component_metadata_server_pb2_grpc.py depends on" + + " but the generated code in component_metadata_server/component_metadata_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ComponentMetadataServerServiceStub(object): +class ComponentMetadataServerServiceStub: """Provide component metadata json definitions, such as parameters.""" def __init__(self, channel): @@ -48,7 +48,7 @@ def __init__(self, channel): ) -class ComponentMetadataServerServiceServicer(object): +class ComponentMetadataServerServiceServicer: """Provide component metadata json definitions, such as parameters.""" def SetMetadata(self, request, context): @@ -80,7 +80,7 @@ def add_ComponentMetadataServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ComponentMetadataServerService(object): +class ComponentMetadataServerService: """Provide component metadata json definitions, such as parameters.""" @staticmethod diff --git a/mavsdk/core_pb2.py b/mavsdk/core_pb2.py index 6a837645..b8bd3302 100644 --- a/mavsdk/core_pb2.py +++ b/mavsdk/core_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: core/core.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "core/core.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "core/core.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/core_pb2_grpc.py b/mavsdk/core_pb2_grpc.py index a06a58ec..47c2b437 100644 --- a/mavsdk/core_pb2_grpc.py +++ b/mavsdk/core_pb2_grpc.py @@ -6,7 +6,7 @@ from . import core_pb2 as core_dot_core__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in core/core_pb2_grpc.py depends on" + + " but the generated code in core/core_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class CoreServiceStub(object): +class CoreServiceStub: """Access to the connection state and core configurations""" def __init__(self, channel): @@ -64,7 +64,7 @@ def __init__(self, channel): ) -class CoreServiceServicer(object): +class CoreServiceServicer: """Access to the connection state and core configurations""" def SubscribeConnectionState(self, request, context): @@ -170,7 +170,7 @@ def add_CoreServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class CoreService(object): +class CoreService: """Access to the connection state and core configurations""" @staticmethod diff --git a/mavsdk/events_pb2.py b/mavsdk/events_pb2.py index 16c8db90..39be08c0 100644 --- a/mavsdk/events_pb2.py +++ b/mavsdk/events_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: events/events.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "events/events.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "events/events.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/events_pb2_grpc.py b/mavsdk/events_pb2_grpc.py index a82a6189..42d5ef6d 100644 --- a/mavsdk/events_pb2_grpc.py +++ b/mavsdk/events_pb2_grpc.py @@ -6,7 +6,7 @@ from . import events_pb2 as events_dot_events__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in events/events_pb2_grpc.py depends on" + + " but the generated code in events/events_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class EventsServiceStub(object): +class EventsServiceStub: """Get event notifications, such as takeoff, or arming checks""" def __init__(self, channel): @@ -58,7 +58,7 @@ def __init__(self, channel): ) -class EventsServiceServicer(object): +class EventsServiceServicer: """Get event notifications, such as takeoff, or arming checks""" def SubscribeEvents(self, request, context): @@ -114,7 +114,7 @@ def add_EventsServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class EventsService(object): +class EventsService: """Get event notifications, such as takeoff, or arming checks""" @staticmethod diff --git a/mavsdk/failure.py b/mavsdk/failure.py index d764b00b..c4301bb0 100644 --- a/mavsdk/failure.py +++ b/mavsdk/failure.py @@ -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 @@ -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: @@ -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): @@ -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 @@ -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 @@ -185,6 +244,7 @@ class FailureType(Enum): SLOW = 5 DELAYED = 6 INTERMITTENT = 7 + DRIFT = 8 def translate_to_rpc(self): if self == FailureType.OK: @@ -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): @@ -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 diff --git a/mavsdk/failure_pb2.py b/mavsdk/failure_pb2.py index ab38eca7..074a1c19 100644 --- a/mavsdk/failure_pb2.py +++ b/mavsdk/failure_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: failure/failure.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "failure/failure.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "failure/failure.proto" ) # @@protoc_insertion_point(imports) @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x15\x66\x61ilure/failure.proto\x12\x12mavsdk.rpc.failure\x1a\x14mavsdk_options.proto"\x8f\x01\n\rInjectRequest\x12\x35\n\x0c\x66\x61ilure_unit\x18\x01 \x01(\x0e\x32\x1f.mavsdk.rpc.failure.FailureUnit\x12\x35\n\x0c\x66\x61ilure_type\x18\x02 \x01(\x0e\x32\x1f.mavsdk.rpc.failure.FailureType\x12\x10\n\x08instance\x18\x03 \x01(\x05"K\n\x0eInjectResponse\x12\x39\n\x0e\x66\x61ilure_result\x18\x01 \x01(\x0b\x32!.mavsdk.rpc.failure.FailureResult"\x97\x02\n\rFailureResult\x12\x38\n\x06result\x18\x01 \x01(\x0e\x32(.mavsdk.rpc.failure.FailureResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xb7\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x16\n\x12RESULT_UNSUPPORTED\x10\x04\x12\x11\n\rRESULT_DENIED\x10\x05\x12\x13\n\x0fRESULT_DISABLED\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07*\xfd\x03\n\x0b\x46\x61ilureUnit\x12\x1c\n\x18\x46\x41ILURE_UNIT_SENSOR_GYRO\x10\x00\x12\x1d\n\x19\x46\x41ILURE_UNIT_SENSOR_ACCEL\x10\x01\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_MAG\x10\x02\x12\x1c\n\x18\x46\x41ILURE_UNIT_SENSOR_BARO\x10\x03\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_GPS\x10\x04\x12$\n FAILURE_UNIT_SENSOR_OPTICAL_FLOW\x10\x05\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_VIO\x10\x06\x12\'\n#FAILURE_UNIT_SENSOR_DISTANCE_SENSOR\x10\x07\x12 \n\x1c\x46\x41ILURE_UNIT_SENSOR_AIRSPEED\x10\x08\x12\x1f\n\x1b\x46\x41ILURE_UNIT_SYSTEM_BATTERY\x10\x64\x12\x1d\n\x19\x46\x41ILURE_UNIT_SYSTEM_MOTOR\x10\x65\x12\x1d\n\x19\x46\x41ILURE_UNIT_SYSTEM_SERVO\x10\x66\x12!\n\x1d\x46\x41ILURE_UNIT_SYSTEM_AVOIDANCE\x10g\x12!\n\x1d\x46\x41ILURE_UNIT_SYSTEM_RC_SIGNAL\x10h\x12&\n"FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL\x10i*\xd2\x01\n\x0b\x46\x61ilureType\x12\x13\n\x0f\x46\x41ILURE_TYPE_OK\x10\x00\x12\x14\n\x10\x46\x41ILURE_TYPE_OFF\x10\x01\x12\x16\n\x12\x46\x41ILURE_TYPE_STUCK\x10\x02\x12\x18\n\x14\x46\x41ILURE_TYPE_GARBAGE\x10\x03\x12\x16\n\x12\x46\x41ILURE_TYPE_WRONG\x10\x04\x12\x15\n\x11\x46\x41ILURE_TYPE_SLOW\x10\x05\x12\x18\n\x14\x46\x41ILURE_TYPE_DELAYED\x10\x06\x12\x1d\n\x19\x46\x41ILURE_TYPE_INTERMITTENT\x10\x07\x32g\n\x0e\x46\x61ilureService\x12U\n\x06Inject\x12!.mavsdk.rpc.failure.InjectRequest\x1a".mavsdk.rpc.failure.InjectResponse"\x04\x80\xb5\x18\x01\x42!\n\x11io.mavsdk.failureB\x0c\x46\x61ilureProtob\x06proto3' + b'\n\x15\x66\x61ilure/failure.proto\x12\x12mavsdk.rpc.failure\x1a\x14mavsdk_options.proto"\x8f\x01\n\rInjectRequest\x12\x35\n\x0c\x66\x61ilure_unit\x18\x01 \x01(\x0e\x32\x1f.mavsdk.rpc.failure.FailureUnit\x12\x35\n\x0c\x66\x61ilure_type\x18\x02 \x01(\x0e\x32\x1f.mavsdk.rpc.failure.FailureType\x12\x10\n\x08instance\x18\x03 \x01(\x05"K\n\x0eInjectResponse\x12\x39\n\x0e\x66\x61ilure_result\x18\x01 \x01(\x0b\x32!.mavsdk.rpc.failure.FailureResult"\x97\x02\n\rFailureResult\x12\x38\n\x06result\x18\x01 \x01(\x0e\x32(.mavsdk.rpc.failure.FailureResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xb7\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x16\n\x12RESULT_UNSUPPORTED\x10\x04\x12\x11\n\rRESULT_DENIED\x10\x05\x12\x13\n\x0fRESULT_DISABLED\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07*\xe4\x05\n\x0b\x46\x61ilureUnit\x12\x1c\n\x18\x46\x41ILURE_UNIT_SENSOR_GYRO\x10\x00\x12\x1d\n\x19\x46\x41ILURE_UNIT_SENSOR_ACCEL\x10\x01\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_MAG\x10\x02\x12\x1c\n\x18\x46\x41ILURE_UNIT_SENSOR_BARO\x10\x03\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_GPS\x10\x04\x12$\n FAILURE_UNIT_SENSOR_OPTICAL_FLOW\x10\x05\x12\x1b\n\x17\x46\x41ILURE_UNIT_SENSOR_VIO\x10\x06\x12\'\n#FAILURE_UNIT_SENSOR_DISTANCE_SENSOR\x10\x07\x12 \n\x1c\x46\x41ILURE_UNIT_SENSOR_AIRSPEED\x10\x08\x12\x1f\n\x1b\x46\x41ILURE_UNIT_SYSTEM_BATTERY\x10\x64\x12\x1d\n\x19\x46\x41ILURE_UNIT_SYSTEM_MOTOR\x10\x65\x12\x1d\n\x19\x46\x41ILURE_UNIT_SYSTEM_SERVO\x10\x66\x12!\n\x1d\x46\x41ILURE_UNIT_SYSTEM_AVOIDANCE\x10g\x12!\n\x1d\x46\x41ILURE_UNIT_SYSTEM_RC_SIGNAL\x10h\x12&\n"FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL\x10i\x12\x1b\n\x17\x46\x41ILURE_UNIT_SYSTEM_ESC\x10j\x12)\n%FAILURE_UNIT_SYSTEM_TRAFFIC_AVOIDANCE\x10k\x12\x1e\n\x19\x46\x41ILURE_UNIT_DATALINK_LTE\x10\x96\x01\x12\x1f\n\x1a\x46\x41ILURE_UNIT_DATALINK_WIFI\x10\x97\x01\x12&\n!FAILURE_UNIT_DATALINK_TELEM_RADIO\x10\x98\x01\x12\x19\n\x14\x46\x41ILURE_UNIT_BUS_CAN\x10\xc8\x01\x12\x19\n\x14\x46\x41ILURE_UNIT_BUS_I2C\x10\xc9\x01*\xea\x01\n\x0b\x46\x61ilureType\x12\x13\n\x0f\x46\x41ILURE_TYPE_OK\x10\x00\x12\x14\n\x10\x46\x41ILURE_TYPE_OFF\x10\x01\x12\x16\n\x12\x46\x41ILURE_TYPE_STUCK\x10\x02\x12\x18\n\x14\x46\x41ILURE_TYPE_GARBAGE\x10\x03\x12\x16\n\x12\x46\x41ILURE_TYPE_WRONG\x10\x04\x12\x15\n\x11\x46\x41ILURE_TYPE_SLOW\x10\x05\x12\x18\n\x14\x46\x41ILURE_TYPE_DELAYED\x10\x06\x12\x1d\n\x19\x46\x41ILURE_TYPE_INTERMITTENT\x10\x07\x12\x16\n\x12\x46\x41ILURE_TYPE_DRIFT\x10\x08\x32g\n\x0e\x46\x61ilureService\x12U\n\x06Inject\x12!.mavsdk.rpc.failure.InjectRequest\x1a".mavsdk.rpc.failure.InjectResponse"\x04\x80\xb5\x18\x01\x42!\n\x11io.mavsdk.failureB\x0c\x46\x61ilureProtob\x06proto3' ) _globals = globals() @@ -39,9 +39,9 @@ "Inject" ]._serialized_options = b"\200\265\030\001" _globals["_FAILUREUNIT"]._serialized_start = 573 - _globals["_FAILUREUNIT"]._serialized_end = 1082 - _globals["_FAILURETYPE"]._serialized_start = 1085 - _globals["_FAILURETYPE"]._serialized_end = 1295 + _globals["_FAILUREUNIT"]._serialized_end = 1313 + _globals["_FAILURETYPE"]._serialized_start = 1316 + _globals["_FAILURETYPE"]._serialized_end = 1550 _globals["_INJECTREQUEST"]._serialized_start = 68 _globals["_INJECTREQUEST"]._serialized_end = 211 _globals["_INJECTRESPONSE"]._serialized_start = 213 @@ -50,6 +50,6 @@ _globals["_FAILURERESULT"]._serialized_end = 570 _globals["_FAILURERESULT_RESULT"]._serialized_start = 387 _globals["_FAILURERESULT_RESULT"]._serialized_end = 570 - _globals["_FAILURESERVICE"]._serialized_start = 1297 - _globals["_FAILURESERVICE"]._serialized_end = 1400 + _globals["_FAILURESERVICE"]._serialized_start = 1552 + _globals["_FAILURESERVICE"]._serialized_end = 1655 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/failure_pb2_grpc.py b/mavsdk/failure_pb2_grpc.py index ee69a2ea..9fd87ba7 100644 --- a/mavsdk/failure_pb2_grpc.py +++ b/mavsdk/failure_pb2_grpc.py @@ -6,7 +6,7 @@ from . import failure_pb2 as failure_dot_failure__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in failure/failure_pb2_grpc.py depends on" + + " but the generated code in failure/failure_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class FailureServiceStub(object): +class FailureServiceStub: """Inject failures into system to test failsafes.""" def __init__(self, channel): @@ -46,7 +46,7 @@ def __init__(self, channel): ) -class FailureServiceServicer(object): +class FailureServiceServicer: """Inject failures into system to test failsafes.""" def Inject(self, request, context): @@ -74,7 +74,7 @@ def add_FailureServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class FailureService(object): +class FailureService: """Inject failures into system to test failsafes.""" @staticmethod diff --git a/mavsdk/follow_me_pb2.py b/mavsdk/follow_me_pb2.py index 99766ffc..f226f765 100644 --- a/mavsdk/follow_me_pb2.py +++ b/mavsdk/follow_me_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: follow_me/follow_me.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "follow_me/follow_me.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "follow_me/follow_me.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/follow_me_pb2_grpc.py b/mavsdk/follow_me_pb2_grpc.py index 34cd61d8..3b1a3acb 100644 --- a/mavsdk/follow_me_pb2_grpc.py +++ b/mavsdk/follow_me_pb2_grpc.py @@ -6,7 +6,7 @@ from . import follow_me_pb2 as follow__me_dot_follow__me__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in follow_me/follow_me_pb2_grpc.py depends on" + + " but the generated code in follow_me/follow_me_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class FollowMeServiceStub(object): +class FollowMeServiceStub: """ Allow users to command the vehicle to follow a specific target. The target is provided as a GPS coordinate and altitude. @@ -85,7 +85,7 @@ def __init__(self, channel): ) -class FollowMeServiceServicer(object): +class FollowMeServiceServicer: """ Allow users to command the vehicle to follow a specific target. The target is provided as a GPS coordinate and altitude. @@ -182,7 +182,7 @@ def add_FollowMeServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class FollowMeService(object): +class FollowMeService: """ Allow users to command the vehicle to follow a specific target. The target is provided as a GPS coordinate and altitude. diff --git a/mavsdk/ftp_pb2.py b/mavsdk/ftp_pb2.py index 839be783..657444f0 100644 --- a/mavsdk/ftp_pb2.py +++ b/mavsdk/ftp_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: ftp/ftp.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "ftp/ftp.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "ftp/ftp.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/ftp_pb2_grpc.py b/mavsdk/ftp_pb2_grpc.py index 3294293b..9913271c 100644 --- a/mavsdk/ftp_pb2_grpc.py +++ b/mavsdk/ftp_pb2_grpc.py @@ -6,7 +6,7 @@ from . import ftp_pb2 as ftp_dot_ftp__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in ftp/ftp_pb2_grpc.py depends on" + + " but the generated code in ftp/ftp_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class FtpServiceStub(object): +class FtpServiceStub: """ Implements file transfer functionality using MAVLink FTP. """ @@ -96,7 +96,7 @@ def __init__(self, channel): ) -class FtpServiceServicer(object): +class FtpServiceServicer: """ Implements file transfer functionality using MAVLink FTP. """ @@ -232,7 +232,7 @@ def add_FtpServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class FtpService(object): +class FtpService: """ Implements file transfer functionality using MAVLink FTP. """ diff --git a/mavsdk/ftp_server_pb2.py b/mavsdk/ftp_server_pb2.py index 06782fa2..cadab96f 100644 --- a/mavsdk/ftp_server_pb2.py +++ b/mavsdk/ftp_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: ftp_server/ftp_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "ftp_server/ftp_server.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "ftp_server/ftp_server.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/ftp_server_pb2_grpc.py b/mavsdk/ftp_server_pb2_grpc.py index 30263c7d..c745078f 100644 --- a/mavsdk/ftp_server_pb2_grpc.py +++ b/mavsdk/ftp_server_pb2_grpc.py @@ -6,7 +6,7 @@ from . import ftp_server_pb2 as ftp__server_dot_ftp__server__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in ftp_server/ftp_server_pb2_grpc.py depends on" + + " but the generated code in ftp_server/ftp_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class FtpServerServiceStub(object): +class FtpServerServiceStub: """Provide files or directories to transfer.""" def __init__(self, channel): @@ -46,7 +46,7 @@ def __init__(self, channel): ) -class FtpServerServiceServicer(object): +class FtpServerServiceServicer: """Provide files or directories to transfer.""" def SetRootDir(self, request, context): @@ -85,7 +85,7 @@ def add_FtpServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class FtpServerService(object): +class FtpServerService: """Provide files or directories to transfer.""" @staticmethod diff --git a/mavsdk/geofence_pb2.py b/mavsdk/geofence_pb2.py index 146e77b4..1e1ce52d 100644 --- a/mavsdk/geofence_pb2.py +++ b/mavsdk/geofence_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: geofence/geofence.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "geofence/geofence.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "geofence/geofence.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/geofence_pb2_grpc.py b/mavsdk/geofence_pb2_grpc.py index 5f7d1c04..9f357105 100644 --- a/mavsdk/geofence_pb2_grpc.py +++ b/mavsdk/geofence_pb2_grpc.py @@ -6,7 +6,7 @@ from . import geofence_pb2 as geofence_dot_geofence__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in geofence/geofence_pb2_grpc.py depends on" + + " but the generated code in geofence/geofence_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class GeofenceServiceStub(object): +class GeofenceServiceStub: """Enable setting a geofence.""" def __init__(self, channel): @@ -58,7 +58,7 @@ def __init__(self, channel): ) -class GeofenceServiceServicer(object): +class GeofenceServiceServicer: """Enable setting a geofence.""" def UploadGeofence(self, request, context): @@ -119,7 +119,7 @@ def add_GeofenceServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class GeofenceService(object): +class GeofenceService: """Enable setting a geofence.""" @staticmethod diff --git a/mavsdk/gimbal_pb2.py b/mavsdk/gimbal_pb2.py index db08675b..6aad066c 100644 --- a/mavsdk/gimbal_pb2.py +++ b/mavsdk/gimbal_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: gimbal/gimbal.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "gimbal/gimbal.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "gimbal/gimbal.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/gimbal_pb2_grpc.py b/mavsdk/gimbal_pb2_grpc.py index 88d39f02..bfefc8d5 100644 --- a/mavsdk/gimbal_pb2_grpc.py +++ b/mavsdk/gimbal_pb2_grpc.py @@ -6,7 +6,7 @@ from . import gimbal_pb2 as gimbal_dot_gimbal__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in gimbal/gimbal_pb2_grpc.py depends on" + + " but the generated code in gimbal/gimbal_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class GimbalServiceStub(object): +class GimbalServiceStub: """ Provide control over a gimbal within the MAVLink Gimbal Protocol: https://mavlink.io/en/services/gimbal_v2.html @@ -103,7 +103,7 @@ def __init__(self, channel): ) -class GimbalServiceServicer(object): +class GimbalServiceServicer: """ Provide control over a gimbal within the MAVLink Gimbal Protocol: https://mavlink.io/en/services/gimbal_v2.html @@ -290,7 +290,7 @@ def add_GimbalServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class GimbalService(object): +class GimbalService: """ Provide control over a gimbal within the MAVLink Gimbal Protocol: https://mavlink.io/en/services/gimbal_v2.html diff --git a/mavsdk/gripper_pb2.py b/mavsdk/gripper_pb2.py index ceb75f9a..47ea57c5 100644 --- a/mavsdk/gripper_pb2.py +++ b/mavsdk/gripper_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: gripper/gripper.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "gripper/gripper.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "gripper/gripper.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/gripper_pb2_grpc.py b/mavsdk/gripper_pb2_grpc.py index 0502aeb0..fe5f4c68 100644 --- a/mavsdk/gripper_pb2_grpc.py +++ b/mavsdk/gripper_pb2_grpc.py @@ -6,7 +6,7 @@ from . import gripper_pb2 as gripper_dot_gripper__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in gripper/gripper_pb2_grpc.py depends on" + + " but the generated code in gripper/gripper_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class GripperServiceStub(object): +class GripperServiceStub: """ Allows users to send gripper actions. """ @@ -54,7 +54,7 @@ def __init__(self, channel): ) -class GripperServiceServicer(object): +class GripperServiceServicer: """ Allows users to send gripper actions. """ @@ -99,7 +99,7 @@ def add_GripperServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class GripperService(object): +class GripperService: """ Allows users to send gripper actions. """ diff --git a/mavsdk/info_pb2.py b/mavsdk/info_pb2.py index 4a2399d6..c34ff937 100644 --- a/mavsdk/info_pb2.py +++ b/mavsdk/info_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: info/info.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "info/info.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "info/info.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/info_pb2_grpc.py b/mavsdk/info_pb2_grpc.py index 80315448..f2ce9685 100644 --- a/mavsdk/info_pb2_grpc.py +++ b/mavsdk/info_pb2_grpc.py @@ -6,7 +6,7 @@ from . import info_pb2 as info_dot_info__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in info/info_pb2_grpc.py depends on" + + " but the generated code in info/info_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class InfoServiceStub(object): +class InfoServiceStub: """Provide information about the hardware and/or software of a system.""" def __init__(self, channel): @@ -70,7 +70,7 @@ def __init__(self, channel): ) -class InfoServiceServicer(object): +class InfoServiceServicer: """Provide information about the hardware and/or software of a system.""" def GetIdentification(self, request, context): @@ -142,7 +142,7 @@ def add_InfoServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class InfoService(object): +class InfoService: """Provide information about the hardware and/or software of a system.""" @staticmethod diff --git a/mavsdk/log_files.py b/mavsdk/log_files.py index e5054213..2ac846a4 100644 --- a/mavsdk/log_files.py +++ b/mavsdk/log_files.py @@ -156,6 +156,9 @@ class Result(Enum): NO_SYSTEM No system is connected + CANCELLED + Download was cancelled + """ UNKNOWN = 0 @@ -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: @@ -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): @@ -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 @@ -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. diff --git a/mavsdk/log_files_pb2.py b/mavsdk/log_files_pb2.py index a352d8c5..08cb9e45 100644 --- a/mavsdk/log_files_pb2.py +++ b/mavsdk/log_files_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: log_files/log_files.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "log_files/log_files.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "log_files/log_files.proto" ) # @@protoc_insertion_point(imports) @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x19log_files/log_files.proto\x12\x14mavsdk.rpc.log_files\x1a\x14mavsdk_options.proto"\x13\n\x11GetEntriesRequest"\x82\x01\n\x12GetEntriesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12,\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry"[\n\x1fSubscribeDownloadLogFileRequest\x12*\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry\x12\x0c\n\x04path\x18\x02 \x01(\t"\x8f\x01\n\x17\x44ownloadLogFileResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12\x34\n\x08progress\x18\x02 \x01(\x0b\x32".mavsdk.rpc.log_files.ProgressData"\x19\n\x17\x45raseAllLogFilesRequest"Z\n\x18\x45raseAllLogFilesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult")\n\x0cProgressData\x12\x19\n\x08progress\x18\x01 \x01(\x02\x42\x07\x82\xb5\x18\x03NaN"5\n\x05\x45ntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04\x64\x61te\x18\x02 \x01(\t\x12\x12\n\nsize_bytes\x18\x03 \x01(\r"\xa1\x02\n\x0eLogFilesResult\x12;\n\x06result\x18\x01 \x01(\x0e\x32+.mavsdk.rpc.log_files.LogFilesResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbd\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x0f\n\x0bRESULT_NEXT\x10\x02\x12\x16\n\x12RESULT_NO_LOGFILES\x10\x03\x12\x12\n\x0eRESULT_TIMEOUT\x10\x04\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x05\x12\x1b\n\x17RESULT_FILE_OPEN_FAILED\x10\x06\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x07\x32\xfc\x02\n\x0fLogFilesService\x12\x61\n\nGetEntries\x12\'.mavsdk.rpc.log_files.GetEntriesRequest\x1a(.mavsdk.rpc.log_files.GetEntriesResponse"\x00\x12\x8c\x01\n\x18SubscribeDownloadLogFile\x12\x35.mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest\x1a-.mavsdk.rpc.log_files.DownloadLogFileResponse"\x08\x80\xb5\x18\x00\x88\xb5\x18\x01\x30\x01\x12w\n\x10\x45raseAllLogFiles\x12-.mavsdk.rpc.log_files.EraseAllLogFilesRequest\x1a..mavsdk.rpc.log_files.EraseAllLogFilesResponse"\x04\x80\xb5\x18\x01\x42$\n\x13io.mavsdk.log_filesB\rLogFilesProtob\x06proto3' + b'\n\x19log_files/log_files.proto\x12\x14mavsdk.rpc.log_files\x1a\x14mavsdk_options.proto"\x13\n\x11GetEntriesRequest"\x82\x01\n\x12GetEntriesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12,\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry"[\n\x1fSubscribeDownloadLogFileRequest\x12*\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry\x12\x0c\n\x04path\x18\x02 \x01(\t"\x8f\x01\n\x17\x44ownloadLogFileResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12\x34\n\x08progress\x18\x02 \x01(\x0b\x32".mavsdk.rpc.log_files.ProgressData"\x1e\n\x1c\x43\x61ncelDownloadLogFileRequest"_\n\x1d\x43\x61ncelDownloadLogFileResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult"\x19\n\x17\x45raseAllLogFilesRequest"Z\n\x18\x45raseAllLogFilesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult")\n\x0cProgressData\x12\x19\n\x08progress\x18\x01 \x01(\x02\x42\x07\x82\xb5\x18\x03NaN"5\n\x05\x45ntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04\x64\x61te\x18\x02 \x01(\t\x12\x12\n\nsize_bytes\x18\x03 \x01(\r"\xb7\x02\n\x0eLogFilesResult\x12;\n\x06result\x18\x01 \x01(\x0e\x32+.mavsdk.rpc.log_files.LogFilesResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xd3\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x0f\n\x0bRESULT_NEXT\x10\x02\x12\x16\n\x12RESULT_NO_LOGFILES\x10\x03\x12\x12\n\x0eRESULT_TIMEOUT\x10\x04\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x05\x12\x1b\n\x17RESULT_FILE_OPEN_FAILED\x10\x06\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x07\x12\x14\n\x10RESULT_CANCELLED\x10\x08\x32\x85\x04\n\x0fLogFilesService\x12\x61\n\nGetEntries\x12\'.mavsdk.rpc.log_files.GetEntriesRequest\x1a(.mavsdk.rpc.log_files.GetEntriesResponse"\x00\x12\x8c\x01\n\x18SubscribeDownloadLogFile\x12\x35.mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest\x1a-.mavsdk.rpc.log_files.DownloadLogFileResponse"\x08\x80\xb5\x18\x00\x88\xb5\x18\x01\x30\x01\x12\x86\x01\n\x15\x43\x61ncelDownloadLogFile\x12\x32.mavsdk.rpc.log_files.CancelDownloadLogFileRequest\x1a\x33.mavsdk.rpc.log_files.CancelDownloadLogFileResponse"\x04\x80\xb5\x18\x01\x12w\n\x10\x45raseAllLogFiles\x12-.mavsdk.rpc.log_files.EraseAllLogFilesRequest\x1a..mavsdk.rpc.log_files.EraseAllLogFilesResponse"\x04\x80\xb5\x18\x01\x42$\n\x13io.mavsdk.log_filesB\rLogFilesProtob\x06proto3' ) _globals = globals() @@ -44,6 +44,12 @@ _globals["_LOGFILESSERVICE"].methods_by_name[ "SubscribeDownloadLogFile" ]._serialized_options = b"\200\265\030\000\210\265\030\001" + _globals["_LOGFILESSERVICE"].methods_by_name[ + "CancelDownloadLogFile" + ]._loaded_options = None + _globals["_LOGFILESSERVICE"].methods_by_name[ + "CancelDownloadLogFile" + ]._serialized_options = b"\200\265\030\001" _globals["_LOGFILESSERVICE"].methods_by_name[ "EraseAllLogFiles" ]._loaded_options = None @@ -58,18 +64,22 @@ _globals["_SUBSCRIBEDOWNLOADLOGFILEREQUEST"]._serialized_end = 318 _globals["_DOWNLOADLOGFILERESPONSE"]._serialized_start = 321 _globals["_DOWNLOADLOGFILERESPONSE"]._serialized_end = 464 - _globals["_ERASEALLLOGFILESREQUEST"]._serialized_start = 466 - _globals["_ERASEALLLOGFILESREQUEST"]._serialized_end = 491 - _globals["_ERASEALLLOGFILESRESPONSE"]._serialized_start = 493 - _globals["_ERASEALLLOGFILESRESPONSE"]._serialized_end = 583 - _globals["_PROGRESSDATA"]._serialized_start = 585 - _globals["_PROGRESSDATA"]._serialized_end = 626 - _globals["_ENTRY"]._serialized_start = 628 - _globals["_ENTRY"]._serialized_end = 681 - _globals["_LOGFILESRESULT"]._serialized_start = 684 - _globals["_LOGFILESRESULT"]._serialized_end = 973 - _globals["_LOGFILESRESULT_RESULT"]._serialized_start = 784 - _globals["_LOGFILESRESULT_RESULT"]._serialized_end = 973 - _globals["_LOGFILESSERVICE"]._serialized_start = 976 - _globals["_LOGFILESSERVICE"]._serialized_end = 1356 + _globals["_CANCELDOWNLOADLOGFILEREQUEST"]._serialized_start = 466 + _globals["_CANCELDOWNLOADLOGFILEREQUEST"]._serialized_end = 496 + _globals["_CANCELDOWNLOADLOGFILERESPONSE"]._serialized_start = 498 + _globals["_CANCELDOWNLOADLOGFILERESPONSE"]._serialized_end = 593 + _globals["_ERASEALLLOGFILESREQUEST"]._serialized_start = 595 + _globals["_ERASEALLLOGFILESREQUEST"]._serialized_end = 620 + _globals["_ERASEALLLOGFILESRESPONSE"]._serialized_start = 622 + _globals["_ERASEALLLOGFILESRESPONSE"]._serialized_end = 712 + _globals["_PROGRESSDATA"]._serialized_start = 714 + _globals["_PROGRESSDATA"]._serialized_end = 755 + _globals["_ENTRY"]._serialized_start = 757 + _globals["_ENTRY"]._serialized_end = 810 + _globals["_LOGFILESRESULT"]._serialized_start = 813 + _globals["_LOGFILESRESULT"]._serialized_end = 1124 + _globals["_LOGFILESRESULT_RESULT"]._serialized_start = 913 + _globals["_LOGFILESRESULT_RESULT"]._serialized_end = 1124 + _globals["_LOGFILESSERVICE"]._serialized_start = 1127 + _globals["_LOGFILESSERVICE"]._serialized_end = 1644 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/log_files_pb2_grpc.py b/mavsdk/log_files_pb2_grpc.py index 35c2f39f..277e0f12 100644 --- a/mavsdk/log_files_pb2_grpc.py +++ b/mavsdk/log_files_pb2_grpc.py @@ -6,7 +6,7 @@ from . import log_files_pb2 as log__files_dot_log__files__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in log_files/log_files_pb2_grpc.py depends on" + + " but the generated code in log_files/log_files_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class LogFilesServiceStub(object): +class LogFilesServiceStub: """Allow to download log files from the vehicle after a flight is complete. For log streaming during flight check the logging plugin. """ @@ -52,6 +52,12 @@ def __init__(self, channel): response_deserializer=log__files_dot_log__files__pb2.DownloadLogFileResponse.FromString, _registered_method=True, ) + self.CancelDownloadLogFile = channel.unary_unary( + "/mavsdk.rpc.log_files.LogFilesService/CancelDownloadLogFile", + request_serializer=log__files_dot_log__files__pb2.CancelDownloadLogFileRequest.SerializeToString, + response_deserializer=log__files_dot_log__files__pb2.CancelDownloadLogFileResponse.FromString, + _registered_method=True, + ) self.EraseAllLogFiles = channel.unary_unary( "/mavsdk.rpc.log_files.LogFilesService/EraseAllLogFiles", request_serializer=log__files_dot_log__files__pb2.EraseAllLogFilesRequest.SerializeToString, @@ -60,7 +66,7 @@ def __init__(self, channel): ) -class LogFilesServiceServicer(object): +class LogFilesServiceServicer: """Allow to download log files from the vehicle after a flight is complete. For log streaming during flight check the logging plugin. """ @@ -77,6 +83,18 @@ def SubscribeDownloadLogFile(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def CancelDownloadLogFile(self, request, context): + """ + 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. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def EraseAllLogFiles(self, request, context): """Erase all log files.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -96,6 +114,11 @@ def add_LogFilesServiceServicer_to_server(servicer, server): request_deserializer=log__files_dot_log__files__pb2.SubscribeDownloadLogFileRequest.FromString, response_serializer=log__files_dot_log__files__pb2.DownloadLogFileResponse.SerializeToString, ), + "CancelDownloadLogFile": grpc.unary_unary_rpc_method_handler( + servicer.CancelDownloadLogFile, + request_deserializer=log__files_dot_log__files__pb2.CancelDownloadLogFileRequest.FromString, + response_serializer=log__files_dot_log__files__pb2.CancelDownloadLogFileResponse.SerializeToString, + ), "EraseAllLogFiles": grpc.unary_unary_rpc_method_handler( servicer.EraseAllLogFiles, request_deserializer=log__files_dot_log__files__pb2.EraseAllLogFilesRequest.FromString, @@ -112,7 +135,7 @@ def add_LogFilesServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class LogFilesService(object): +class LogFilesService: """Allow to download log files from the vehicle after a flight is complete. For log streaming during flight check the logging plugin. """ @@ -177,6 +200,36 @@ def SubscribeDownloadLogFile( _registered_method=True, ) + @staticmethod + def CancelDownloadLogFile( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.log_files.LogFilesService/CancelDownloadLogFile", + log__files_dot_log__files__pb2.CancelDownloadLogFileRequest.SerializeToString, + log__files_dot_log__files__pb2.CancelDownloadLogFileResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + @staticmethod def EraseAllLogFiles( request, diff --git a/mavsdk/log_streaming_pb2.py b/mavsdk/log_streaming_pb2.py index 75ecebeb..c8107231 100644 --- a/mavsdk/log_streaming_pb2.py +++ b/mavsdk/log_streaming_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: log_streaming/log_streaming.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "log_streaming/log_streaming.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "log_streaming/log_streaming.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/log_streaming_pb2_grpc.py b/mavsdk/log_streaming_pb2_grpc.py index cf192d61..781fe568 100644 --- a/mavsdk/log_streaming_pb2_grpc.py +++ b/mavsdk/log_streaming_pb2_grpc.py @@ -6,7 +6,7 @@ from . import log_streaming_pb2 as log__streaming_dot_log__streaming__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in log_streaming/log_streaming_pb2_grpc.py depends on" + + " but the generated code in log_streaming/log_streaming_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class LogStreamingServiceStub(object): +class LogStreamingServiceStub: """Provide log streaming data.""" def __init__(self, channel): @@ -58,7 +58,7 @@ def __init__(self, channel): ) -class LogStreamingServiceServicer(object): +class LogStreamingServiceServicer: """Provide log streaming data.""" def StartLogStreaming(self, request, context): @@ -108,7 +108,7 @@ def add_LogStreamingServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class LogStreamingService(object): +class LogStreamingService: """Provide log streaming data.""" @staticmethod diff --git a/mavsdk/manual_control_pb2.py b/mavsdk/manual_control_pb2.py index 7bafa8a4..a0d1b2d5 100644 --- a/mavsdk/manual_control_pb2.py +++ b/mavsdk/manual_control_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: manual_control/manual_control.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "manual_control/manual_control.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "manual_control/manual_control.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/manual_control_pb2_grpc.py b/mavsdk/manual_control_pb2_grpc.py index e12b062f..dd255a8d 100644 --- a/mavsdk/manual_control_pb2_grpc.py +++ b/mavsdk/manual_control_pb2_grpc.py @@ -6,7 +6,7 @@ from . import manual_control_pb2 as manual__control_dot_manual__control__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in manual_control/manual_control_pb2_grpc.py depends on" + + " but the generated code in manual_control/manual_control_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ManualControlServiceStub(object): +class ManualControlServiceStub: """Enable manual control using e.g. a joystick or gamepad.""" def __init__(self, channel): @@ -58,7 +58,7 @@ def __init__(self, channel): ) -class ManualControlServiceServicer(object): +class ManualControlServiceServicer: """Enable manual control using e.g. a joystick or gamepad.""" def StartPositionControl(self, request, context): @@ -123,7 +123,7 @@ def add_ManualControlServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ManualControlService(object): +class ManualControlService: """Enable manual control using e.g. a joystick or gamepad.""" @staticmethod diff --git a/mavsdk/mavlink_direct.py b/mavsdk/mavlink_direct.py index 91a9c441..380ea6d9 100644 --- a/mavsdk/mavlink_direct.py +++ b/mavsdk/mavlink_direct.py @@ -375,3 +375,49 @@ async def load_custom_xml(self, xml_content): if result.result != MavlinkDirectResult.Result.SUCCESS: raise MavlinkDirectError(result, "load_custom_xml()", xml_content) + + async def send_command(self, command): + """ + Send a command and wait for its final COMMAND_ACK. + + The command is a COMMAND_LONG or COMMAND_INT message with its fields as JSON, + e.g. message_name "COMMAND_LONG" and fields_json + {"target_system":1,"target_component":1,"command":400,"param1":1,...}. + + The command is retransmitted if no ack arrives. MAV_RESULT_IN_PROGRESS acks + are handled internally: the command is not retransmitted after one, and the + call keeps waiting for the final ack. + + RESULT_SUCCESS only means that a final COMMAND_ACK was received. Whether the + command was accepted is in the "result" field of the returned ack (MAV_RESULT, + e.g. 0 for MAV_RESULT_ACCEPTED, 2 for MAV_RESULT_DENIED). Any other result means + no final ack was received and the returned ack is empty. + + Parameters + ---------- + command : MavlinkMessage + COMMAND_LONG or COMMAND_INT message to send + + Returns + ------- + ack : MavlinkMessage + The final COMMAND_ACK, check its "result" field (MAV_RESULT); only set on RESULT_SUCCESS + + Raises + ------ + MavlinkDirectError + If the request fails. The error contains the reason for the failure. + """ + + request = mavlink_direct_pb2.SendCommandRequest() + + command.translate_to_rpc(request.command) + + response = await self._stub.SendCommand(request) + + result = self._extract_result(response) + + if result.result != MavlinkDirectResult.Result.SUCCESS: + raise MavlinkDirectError(result, "send_command()", command) + + return MavlinkMessage.translate_from_rpc(response.ack) diff --git a/mavsdk/mavlink_direct_pb2.py b/mavsdk/mavlink_direct_pb2.py index 6ea7c783..5f8c729c 100644 --- a/mavsdk/mavlink_direct_pb2.py +++ b/mavsdk/mavlink_direct_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mavlink_direct/mavlink_direct.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "mavlink_direct/mavlink_direct.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "mavlink_direct/mavlink_direct.proto" ) # @@protoc_insertion_point(imports) @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n#mavlink_direct/mavlink_direct.proto\x12\x19mavsdk.rpc.mavlink_direct\x1a\x14mavsdk_options.proto"P\n\x12SendMessageRequest\x12:\n\x07message\x18\x01 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"d\n\x13SendMessageResponse\x12M\n\x15mavlink_direct_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.mavlink_direct.MavlinkDirectResult"/\n\x17SubscribeMessageRequest\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t"M\n\x0fMessageResponse\x12:\n\x07message\x18\x01 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"+\n\x14LoadCustomXmlRequest\x12\x13\n\x0bxml_content\x18\x01 \x01(\t"f\n\x15LoadCustomXmlResponse\x12M\n\x15mavlink_direct_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.mavlink_direct.MavlinkDirectResult"\x9b\x01\n\x0eMavlinkMessage\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t\x12\x11\n\tsystem_id\x18\x02 \x01(\r\x12\x14\n\x0c\x63omponent_id\x18\x03 \x01(\r\x12\x18\n\x10target_system_id\x18\x04 \x01(\r\x12\x1b\n\x13target_component_id\x18\x05 \x01(\r\x12\x13\n\x0b\x66ields_json\x18\x06 \x01(\t"\xb2\x02\n\x13MavlinkDirectResult\x12\x45\n\x06result\x18\x01 \x01(\x0e\x32\x35.mavsdk.rpc.mavlink_direct.MavlinkDirectResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbf\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x10\n\x0cRESULT_ERROR\x10\x02\x12\x1a\n\x16RESULT_INVALID_MESSAGE\x10\x03\x12\x18\n\x14RESULT_INVALID_FIELD\x10\x04\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07\x32\x80\x03\n\x14MavlinkDirectService\x12r\n\x0bSendMessage\x12-.mavsdk.rpc.mavlink_direct.SendMessageRequest\x1a..mavsdk.rpc.mavlink_direct.SendMessageResponse"\x04\x80\xb5\x18\x01\x12z\n\x10SubscribeMessage\x12\x32.mavsdk.rpc.mavlink_direct.SubscribeMessageRequest\x1a*.mavsdk.rpc.mavlink_direct.MessageResponse"\x04\x80\xb5\x18\x00\x30\x01\x12x\n\rLoadCustomXml\x12/.mavsdk.rpc.mavlink_direct.LoadCustomXmlRequest\x1a\x30.mavsdk.rpc.mavlink_direct.LoadCustomXmlResponse"\x04\x80\xb5\x18\x01\x42.\n\x18io.mavsdk.mavlink_directB\x12MavlinkDirectProtob\x06proto3' + b'\n#mavlink_direct/mavlink_direct.proto\x12\x19mavsdk.rpc.mavlink_direct\x1a\x14mavsdk_options.proto"P\n\x12SendMessageRequest\x12:\n\x07message\x18\x01 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"d\n\x13SendMessageResponse\x12M\n\x15mavlink_direct_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.mavlink_direct.MavlinkDirectResult"/\n\x17SubscribeMessageRequest\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t"M\n\x0fMessageResponse\x12:\n\x07message\x18\x01 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"+\n\x14LoadCustomXmlRequest\x12\x13\n\x0bxml_content\x18\x01 \x01(\t"f\n\x15LoadCustomXmlResponse\x12M\n\x15mavlink_direct_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.mavlink_direct.MavlinkDirectResult"P\n\x12SendCommandRequest\x12:\n\x07\x63ommand\x18\x01 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"\x9c\x01\n\x13SendCommandResponse\x12M\n\x15mavlink_direct_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.mavlink_direct.MavlinkDirectResult\x12\x36\n\x03\x61\x63k\x18\x02 \x01(\x0b\x32).mavsdk.rpc.mavlink_direct.MavlinkMessage"\x9b\x01\n\x0eMavlinkMessage\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t\x12\x11\n\tsystem_id\x18\x02 \x01(\r\x12\x14\n\x0c\x63omponent_id\x18\x03 \x01(\r\x12\x18\n\x10target_system_id\x18\x04 \x01(\r\x12\x1b\n\x13target_component_id\x18\x05 \x01(\r\x12\x13\n\x0b\x66ields_json\x18\x06 \x01(\t"\xb2\x02\n\x13MavlinkDirectResult\x12\x45\n\x06result\x18\x01 \x01(\x0e\x32\x35.mavsdk.rpc.mavlink_direct.MavlinkDirectResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbf\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x10\n\x0cRESULT_ERROR\x10\x02\x12\x1a\n\x16RESULT_INVALID_MESSAGE\x10\x03\x12\x18\n\x14RESULT_INVALID_FIELD\x10\x04\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07\x32\xf0\x03\n\x14MavlinkDirectService\x12r\n\x0bSendMessage\x12-.mavsdk.rpc.mavlink_direct.SendMessageRequest\x1a..mavsdk.rpc.mavlink_direct.SendMessageResponse"\x04\x80\xb5\x18\x01\x12z\n\x10SubscribeMessage\x12\x32.mavsdk.rpc.mavlink_direct.SubscribeMessageRequest\x1a*.mavsdk.rpc.mavlink_direct.MessageResponse"\x04\x80\xb5\x18\x00\x30\x01\x12x\n\rLoadCustomXml\x12/.mavsdk.rpc.mavlink_direct.LoadCustomXmlRequest\x1a\x30.mavsdk.rpc.mavlink_direct.LoadCustomXmlResponse"\x04\x80\xb5\x18\x01\x12n\n\x0bSendCommand\x12-.mavsdk.rpc.mavlink_direct.SendCommandRequest\x1a..mavsdk.rpc.mavlink_direct.SendCommandResponse"\x00\x42.\n\x18io.mavsdk.mavlink_directB\x12MavlinkDirectProtob\x06proto3' ) _globals = globals() @@ -66,12 +66,16 @@ _globals["_LOADCUSTOMXMLREQUEST"]._serialized_end = 443 _globals["_LOADCUSTOMXMLRESPONSE"]._serialized_start = 445 _globals["_LOADCUSTOMXMLRESPONSE"]._serialized_end = 547 - _globals["_MAVLINKMESSAGE"]._serialized_start = 550 - _globals["_MAVLINKMESSAGE"]._serialized_end = 705 - _globals["_MAVLINKDIRECTRESULT"]._serialized_start = 708 - _globals["_MAVLINKDIRECTRESULT"]._serialized_end = 1014 - _globals["_MAVLINKDIRECTRESULT_RESULT"]._serialized_start = 823 - _globals["_MAVLINKDIRECTRESULT_RESULT"]._serialized_end = 1014 - _globals["_MAVLINKDIRECTSERVICE"]._serialized_start = 1017 - _globals["_MAVLINKDIRECTSERVICE"]._serialized_end = 1401 + _globals["_SENDCOMMANDREQUEST"]._serialized_start = 549 + _globals["_SENDCOMMANDREQUEST"]._serialized_end = 629 + _globals["_SENDCOMMANDRESPONSE"]._serialized_start = 632 + _globals["_SENDCOMMANDRESPONSE"]._serialized_end = 788 + _globals["_MAVLINKMESSAGE"]._serialized_start = 791 + _globals["_MAVLINKMESSAGE"]._serialized_end = 946 + _globals["_MAVLINKDIRECTRESULT"]._serialized_start = 949 + _globals["_MAVLINKDIRECTRESULT"]._serialized_end = 1255 + _globals["_MAVLINKDIRECTRESULT_RESULT"]._serialized_start = 1064 + _globals["_MAVLINKDIRECTRESULT_RESULT"]._serialized_end = 1255 + _globals["_MAVLINKDIRECTSERVICE"]._serialized_start = 1258 + _globals["_MAVLINKDIRECTSERVICE"]._serialized_end = 1754 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/mavlink_direct_pb2_grpc.py b/mavsdk/mavlink_direct_pb2_grpc.py index f6966053..d9f8eab7 100644 --- a/mavsdk/mavlink_direct_pb2_grpc.py +++ b/mavsdk/mavlink_direct_pb2_grpc.py @@ -6,7 +6,7 @@ from . import mavlink_direct_pb2 as mavlink__direct_dot_mavlink__direct__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mavlink_direct/mavlink_direct_pb2_grpc.py depends on" + + " but the generated code in mavlink_direct/mavlink_direct_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MavlinkDirectServiceStub(object): +class MavlinkDirectServiceStub: """Enable direct MAVLink communication using libmav.""" def __init__(self, channel): @@ -56,9 +56,15 @@ def __init__(self, channel): response_deserializer=mavlink__direct_dot_mavlink__direct__pb2.LoadCustomXmlResponse.FromString, _registered_method=True, ) + self.SendCommand = channel.unary_unary( + "/mavsdk.rpc.mavlink_direct.MavlinkDirectService/SendCommand", + request_serializer=mavlink__direct_dot_mavlink__direct__pb2.SendCommandRequest.SerializeToString, + response_deserializer=mavlink__direct_dot_mavlink__direct__pb2.SendCommandResponse.FromString, + _registered_method=True, + ) -class MavlinkDirectServiceServicer(object): +class MavlinkDirectServiceServicer: """Enable direct MAVLink communication using libmav.""" def SendMessage(self, request, context): @@ -94,6 +100,27 @@ def LoadCustomXml(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def SendCommand(self, request, context): + """ + Send a command and wait for its final COMMAND_ACK. + + The command is a COMMAND_LONG or COMMAND_INT message with its fields as JSON, + e.g. message_name "COMMAND_LONG" and fields_json + {"target_system":1,"target_component":1,"command":400,"param1":1,...}. + + The command is retransmitted if no ack arrives. MAV_RESULT_IN_PROGRESS acks + are handled internally: the command is not retransmitted after one, and the + call keeps waiting for the final ack. + + RESULT_SUCCESS only means that a final COMMAND_ACK was received. Whether the + command was accepted is in the "result" field of the returned ack (MAV_RESULT, + e.g. 0 for MAV_RESULT_ACCEPTED, 2 for MAV_RESULT_DENIED). Any other result means + no final ack was received and the returned ack is empty. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_MavlinkDirectServiceServicer_to_server(servicer, server): rpc_method_handlers = { @@ -112,6 +139,11 @@ def add_MavlinkDirectServiceServicer_to_server(servicer, server): request_deserializer=mavlink__direct_dot_mavlink__direct__pb2.LoadCustomXmlRequest.FromString, response_serializer=mavlink__direct_dot_mavlink__direct__pb2.LoadCustomXmlResponse.SerializeToString, ), + "SendCommand": grpc.unary_unary_rpc_method_handler( + servicer.SendCommand, + request_deserializer=mavlink__direct_dot_mavlink__direct__pb2.SendCommandRequest.FromString, + response_serializer=mavlink__direct_dot_mavlink__direct__pb2.SendCommandResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "mavsdk.rpc.mavlink_direct.MavlinkDirectService", rpc_method_handlers @@ -123,7 +155,7 @@ def add_MavlinkDirectServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MavlinkDirectService(object): +class MavlinkDirectService: """Enable direct MAVLink communication using libmav.""" @staticmethod @@ -215,3 +247,33 @@ def LoadCustomXml( metadata, _registered_method=True, ) + + @staticmethod + def SendCommand( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.mavlink_direct.MavlinkDirectService/SendCommand", + mavlink__direct_dot_mavlink__direct__pb2.SendCommandRequest.SerializeToString, + mavlink__direct_dot_mavlink__direct__pb2.SendCommandResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/mavlink_direct_server.py b/mavsdk/mavlink_direct_server.py index 3f611f0d..3562a431 100644 --- a/mavsdk/mavlink_direct_server.py +++ b/mavsdk/mavlink_direct_server.py @@ -406,3 +406,44 @@ async def load_custom_xml(self, xml_content): if result.result != MavlinkDirectServerResult.Result.SUCCESS: raise MavlinkDirectServerError(result, "load_custom_xml()", xml_content) + + async def command(self, command): + """ + Subscribe to incoming commands with a given command ID. + + Delivers COMMAND_LONG and COMMAND_INT messages with this command ID that are + addressed to this server component; check message_name to see which one it is. + + While subscribed, MAVSDK does not ack the command itself, so every command + received must be answered by sending a COMMAND_ACK with SendMessage, addressed + to the sender (system_id/component_id of the received command) and with + "command" set to the command ID. For a command that takes a while, send acks + with MAV_RESULT_IN_PROGRESS and "progress" in percent (255 if unknown) about + once per second while it runs, so the sender knows it is still going, then + the final result. + + The sender may retransmit the command if the ack is lost, so the same command + can arrive more than once. + + Parameters + ---------- + command : uint32_t + MAV_CMD to subscribe to + + Yields + ------- + command : MavlinkMessage + The received COMMAND_LONG or COMMAND_INT + + + """ + + request = mavlink_direct_server_pb2.SubscribeCommandRequest() + request.command = command + command_stream = self._stub.SubscribeCommand(request) + + try: + async for response in command_stream: + yield MavlinkMessage.translate_from_rpc(response.command) + finally: + command_stream.cancel() diff --git a/mavsdk/mavlink_direct_server_pb2.py b/mavsdk/mavlink_direct_server_pb2.py index 667026d1..ab57effd 100644 --- a/mavsdk/mavlink_direct_server_pb2.py +++ b/mavsdk/mavlink_direct_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mavlink_direct_server/mavlink_direct_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "mavlink_direct_server/mavlink_direct_server.proto", @@ -28,7 +28,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n1mavlink_direct_server/mavlink_direct_server.proto\x12 mavsdk.rpc.mavlink_direct_server\x1a\x14mavsdk_options.proto"W\n\x12SendMessageRequest\x12\x41\n\x07message\x18\x01 \x01(\x0b\x32\x30.mavsdk.rpc.mavlink_direct_server.MavlinkMessage"x\n\x13SendMessageResponse\x12\x61\n\x1cmavlink_direct_server_result\x18\x01 \x01(\x0b\x32;.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult"/\n\x17SubscribeMessageRequest\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t"T\n\x0fMessageResponse\x12\x41\n\x07message\x18\x01 \x01(\x0b\x32\x30.mavsdk.rpc.mavlink_direct_server.MavlinkMessage"+\n\x14LoadCustomXmlRequest\x12\x13\n\x0bxml_content\x18\x01 \x01(\t"z\n\x15LoadCustomXmlResponse\x12\x61\n\x1cmavlink_direct_server_result\x18\x01 \x01(\x0b\x32;.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult"\x9b\x01\n\x0eMavlinkMessage\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t\x12\x11\n\tsystem_id\x18\x02 \x01(\r\x12\x14\n\x0c\x63omponent_id\x18\x03 \x01(\r\x12\x18\n\x10target_system_id\x18\x04 \x01(\r\x12\x1b\n\x13target_component_id\x18\x05 \x01(\r\x12\x13\n\x0b\x66ields_json\x18\x06 \x01(\t"\xc5\x02\n\x19MavlinkDirectServerResult\x12R\n\x06result\x18\x01 \x01(\x0e\x32\x42.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbf\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x10\n\x0cRESULT_ERROR\x10\x02\x12\x1a\n\x16RESULT_INVALID_MESSAGE\x10\x03\x12\x18\n\x14RESULT_INVALID_FIELD\x10\x04\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07\x32\xb3\x03\n\x1aMavlinkDirectServerService\x12\x80\x01\n\x0bSendMessage\x12\x34.mavsdk.rpc.mavlink_direct_server.SendMessageRequest\x1a\x35.mavsdk.rpc.mavlink_direct_server.SendMessageResponse"\x04\x80\xb5\x18\x01\x12\x88\x01\n\x10SubscribeMessage\x12\x39.mavsdk.rpc.mavlink_direct_server.SubscribeMessageRequest\x1a\x31.mavsdk.rpc.mavlink_direct_server.MessageResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x86\x01\n\rLoadCustomXml\x12\x36.mavsdk.rpc.mavlink_direct_server.LoadCustomXmlRequest\x1a\x37.mavsdk.rpc.mavlink_direct_server.LoadCustomXmlResponse"\x04\x80\xb5\x18\x01\x42;\n\x1fio.mavsdk.mavlink_direct_serverB\x18MavlinkDirectServerProtob\x06proto3' + b'\n1mavlink_direct_server/mavlink_direct_server.proto\x12 mavsdk.rpc.mavlink_direct_server\x1a\x14mavsdk_options.proto"W\n\x12SendMessageRequest\x12\x41\n\x07message\x18\x01 \x01(\x0b\x32\x30.mavsdk.rpc.mavlink_direct_server.MavlinkMessage"x\n\x13SendMessageResponse\x12\x61\n\x1cmavlink_direct_server_result\x18\x01 \x01(\x0b\x32;.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult"/\n\x17SubscribeMessageRequest\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t"T\n\x0fMessageResponse\x12\x41\n\x07message\x18\x01 \x01(\x0b\x32\x30.mavsdk.rpc.mavlink_direct_server.MavlinkMessage"+\n\x14LoadCustomXmlRequest\x12\x13\n\x0bxml_content\x18\x01 \x01(\t"z\n\x15LoadCustomXmlResponse\x12\x61\n\x1cmavlink_direct_server_result\x18\x01 \x01(\x0b\x32;.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult"*\n\x17SubscribeCommandRequest\x12\x0f\n\x07\x63ommand\x18\x01 \x01(\r"T\n\x0f\x43ommandResponse\x12\x41\n\x07\x63ommand\x18\x01 \x01(\x0b\x32\x30.mavsdk.rpc.mavlink_direct_server.MavlinkMessage"\x9b\x01\n\x0eMavlinkMessage\x12\x14\n\x0cmessage_name\x18\x01 \x01(\t\x12\x11\n\tsystem_id\x18\x02 \x01(\r\x12\x14\n\x0c\x63omponent_id\x18\x03 \x01(\r\x12\x18\n\x10target_system_id\x18\x04 \x01(\r\x12\x1b\n\x13target_component_id\x18\x05 \x01(\r\x12\x13\n\x0b\x66ields_json\x18\x06 \x01(\t"\xc5\x02\n\x19MavlinkDirectServerResult\x12R\n\x06result\x18\x01 \x01(\x0e\x32\x42.mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbf\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x10\n\x0cRESULT_ERROR\x10\x02\x12\x1a\n\x16RESULT_INVALID_MESSAGE\x10\x03\x12\x18\n\x14RESULT_INVALID_FIELD\x10\x04\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07\x32\xbe\x04\n\x1aMavlinkDirectServerService\x12\x80\x01\n\x0bSendMessage\x12\x34.mavsdk.rpc.mavlink_direct_server.SendMessageRequest\x1a\x35.mavsdk.rpc.mavlink_direct_server.SendMessageResponse"\x04\x80\xb5\x18\x01\x12\x88\x01\n\x10SubscribeMessage\x12\x39.mavsdk.rpc.mavlink_direct_server.SubscribeMessageRequest\x1a\x31.mavsdk.rpc.mavlink_direct_server.MessageResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x86\x01\n\rLoadCustomXml\x12\x36.mavsdk.rpc.mavlink_direct_server.LoadCustomXmlRequest\x1a\x37.mavsdk.rpc.mavlink_direct_server.LoadCustomXmlResponse"\x04\x80\xb5\x18\x01\x12\x88\x01\n\x10SubscribeCommand\x12\x39.mavsdk.rpc.mavlink_direct_server.SubscribeCommandRequest\x1a\x31.mavsdk.rpc.mavlink_direct_server.CommandResponse"\x04\x80\xb5\x18\x00\x30\x01\x42;\n\x1fio.mavsdk.mavlink_direct_serverB\x18MavlinkDirectServerProtob\x06proto3' ) _globals = globals() @@ -61,6 +61,12 @@ _globals["_MAVLINKDIRECTSERVERSERVICE"].methods_by_name[ "LoadCustomXml" ]._serialized_options = b"\200\265\030\001" + _globals["_MAVLINKDIRECTSERVERSERVICE"].methods_by_name[ + "SubscribeCommand" + ]._loaded_options = None + _globals["_MAVLINKDIRECTSERVERSERVICE"].methods_by_name[ + "SubscribeCommand" + ]._serialized_options = b"\200\265\030\000" _globals["_SENDMESSAGEREQUEST"]._serialized_start = 109 _globals["_SENDMESSAGEREQUEST"]._serialized_end = 196 _globals["_SENDMESSAGERESPONSE"]._serialized_start = 198 @@ -73,12 +79,16 @@ _globals["_LOADCUSTOMXMLREQUEST"]._serialized_end = 498 _globals["_LOADCUSTOMXMLRESPONSE"]._serialized_start = 500 _globals["_LOADCUSTOMXMLRESPONSE"]._serialized_end = 622 - _globals["_MAVLINKMESSAGE"]._serialized_start = 625 - _globals["_MAVLINKMESSAGE"]._serialized_end = 780 - _globals["_MAVLINKDIRECTSERVERRESULT"]._serialized_start = 783 - _globals["_MAVLINKDIRECTSERVERRESULT"]._serialized_end = 1108 - _globals["_MAVLINKDIRECTSERVERRESULT_RESULT"]._serialized_start = 917 - _globals["_MAVLINKDIRECTSERVERRESULT_RESULT"]._serialized_end = 1108 - _globals["_MAVLINKDIRECTSERVERSERVICE"]._serialized_start = 1111 - _globals["_MAVLINKDIRECTSERVERSERVICE"]._serialized_end = 1546 + _globals["_SUBSCRIBECOMMANDREQUEST"]._serialized_start = 624 + _globals["_SUBSCRIBECOMMANDREQUEST"]._serialized_end = 666 + _globals["_COMMANDRESPONSE"]._serialized_start = 668 + _globals["_COMMANDRESPONSE"]._serialized_end = 752 + _globals["_MAVLINKMESSAGE"]._serialized_start = 755 + _globals["_MAVLINKMESSAGE"]._serialized_end = 910 + _globals["_MAVLINKDIRECTSERVERRESULT"]._serialized_start = 913 + _globals["_MAVLINKDIRECTSERVERRESULT"]._serialized_end = 1238 + _globals["_MAVLINKDIRECTSERVERRESULT_RESULT"]._serialized_start = 1047 + _globals["_MAVLINKDIRECTSERVERRESULT_RESULT"]._serialized_end = 1238 + _globals["_MAVLINKDIRECTSERVERSERVICE"]._serialized_start = 1241 + _globals["_MAVLINKDIRECTSERVERSERVICE"]._serialized_end = 1815 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/mavlink_direct_server_pb2_grpc.py b/mavsdk/mavlink_direct_server_pb2_grpc.py index 52daa8b4..fc488858 100644 --- a/mavsdk/mavlink_direct_server_pb2_grpc.py +++ b/mavsdk/mavlink_direct_server_pb2_grpc.py @@ -8,7 +8,7 @@ mavlink_direct_server_pb2 as mavlink__direct__server_dot_mavlink__direct__server__pb2, ) -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -24,14 +24,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mavlink_direct_server/mavlink_direct_server_pb2_grpc.py depends on" + + " but the generated code in mavlink_direct_server/mavlink_direct_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MavlinkDirectServerServiceStub(object): +class MavlinkDirectServerServiceStub: """Enable direct MAVLink communication using libmav from a server component. Unlike MavlinkDirect, this does not require a discovered system: it sends from @@ -63,9 +63,15 @@ def __init__(self, channel): response_deserializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.LoadCustomXmlResponse.FromString, _registered_method=True, ) + self.SubscribeCommand = channel.unary_stream( + "/mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerService/SubscribeCommand", + request_serializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.SubscribeCommandRequest.SerializeToString, + response_deserializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.CommandResponse.FromString, + _registered_method=True, + ) -class MavlinkDirectServerServiceServicer(object): +class MavlinkDirectServerServiceServicer: """Enable direct MAVLink communication using libmav from a server component. Unlike MavlinkDirect, this does not require a discovered system: it sends from @@ -109,6 +115,28 @@ def LoadCustomXml(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def SubscribeCommand(self, request, context): + """ + Subscribe to incoming commands with a given command ID. + + Delivers COMMAND_LONG and COMMAND_INT messages with this command ID that are + addressed to this server component; check message_name to see which one it is. + + While subscribed, MAVSDK does not ack the command itself, so every command + received must be answered by sending a COMMAND_ACK with SendMessage, addressed + to the sender (system_id/component_id of the received command) and with + "command" set to the command ID. For a command that takes a while, send acks + with MAV_RESULT_IN_PROGRESS and "progress" in percent (255 if unknown) about + once per second while it runs, so the sender knows it is still going, then + the final result. + + The sender may retransmit the command if the ack is lost, so the same command + can arrive more than once. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_MavlinkDirectServerServiceServicer_to_server(servicer, server): rpc_method_handlers = { @@ -127,6 +155,11 @@ def add_MavlinkDirectServerServiceServicer_to_server(servicer, server): request_deserializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.LoadCustomXmlRequest.FromString, response_serializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.LoadCustomXmlResponse.SerializeToString, ), + "SubscribeCommand": grpc.unary_stream_rpc_method_handler( + servicer.SubscribeCommand, + request_deserializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.SubscribeCommandRequest.FromString, + response_serializer=mavlink__direct__server_dot_mavlink__direct__server__pb2.CommandResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerService", @@ -140,7 +173,7 @@ def add_MavlinkDirectServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MavlinkDirectServerService(object): +class MavlinkDirectServerService: """Enable direct MAVLink communication using libmav from a server component. Unlike MavlinkDirect, this does not require a discovered system: it sends from @@ -237,3 +270,33 @@ def LoadCustomXml( metadata, _registered_method=True, ) + + @staticmethod + def SubscribeCommand( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_stream( + request, + target, + "/mavsdk.rpc.mavlink_direct_server.MavlinkDirectServerService/SubscribeCommand", + mavlink__direct__server_dot_mavlink__direct__server__pb2.SubscribeCommandRequest.SerializeToString, + mavlink__direct__server_dot_mavlink__direct__server__pb2.CommandResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/mavsdk_options_pb2.py b/mavsdk/mavsdk_options_pb2.py index a07eef66..29b4854a 100644 --- a/mavsdk/mavsdk_options_pb2.py +++ b/mavsdk/mavsdk_options_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mavsdk_options.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "mavsdk_options.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "mavsdk_options.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/mavsdk_options_pb2_grpc.py b/mavsdk/mavsdk_options_pb2_grpc.py index 8adfc7e5..42d418ff 100644 --- a/mavsdk/mavsdk_options_pb2_grpc.py +++ b/mavsdk/mavsdk_options_pb2_grpc.py @@ -5,7 +5,7 @@ import warnings -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -21,7 +21,7 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mavsdk_options_pb2_grpc.py depends on" + + " but the generated code in mavsdk_options_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." diff --git a/mavsdk/mission_pb2.py b/mavsdk/mission_pb2.py index 3f7cd9c4..d1a92fd7 100644 --- a/mavsdk/mission_pb2.py +++ b/mavsdk/mission_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mission/mission.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "mission/mission.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "mission/mission.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/mission_pb2_grpc.py b/mavsdk/mission_pb2_grpc.py index 8f0ee7dc..972f9e32 100644 --- a/mavsdk/mission_pb2_grpc.py +++ b/mavsdk/mission_pb2_grpc.py @@ -6,7 +6,7 @@ from . import mission_pb2 as mission_dot_mission__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mission/mission_pb2_grpc.py depends on" + + " but the generated code in mission/mission_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MissionServiceStub(object): +class MissionServiceStub: """Enable waypoint missions.""" def __init__(self, channel): @@ -124,7 +124,7 @@ def __init__(self, channel): ) -class MissionServiceServicer(object): +class MissionServiceServicer: """Enable waypoint missions.""" def UploadMission(self, request, context): @@ -354,7 +354,7 @@ def add_MissionServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MissionService(object): +class MissionService: """Enable waypoint missions.""" @staticmethod diff --git a/mavsdk/mission_raw_pb2.py b/mavsdk/mission_raw_pb2.py index 05a9dd98..56cf8be1 100644 --- a/mavsdk/mission_raw_pb2.py +++ b/mavsdk/mission_raw_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mission_raw/mission_raw.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "mission_raw/mission_raw.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "mission_raw/mission_raw.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/mission_raw_pb2_grpc.py b/mavsdk/mission_raw_pb2_grpc.py index 0460c8ce..d5af70b3 100644 --- a/mavsdk/mission_raw_pb2_grpc.py +++ b/mavsdk/mission_raw_pb2_grpc.py @@ -6,7 +6,7 @@ from . import mission_raw_pb2 as mission__raw_dot_mission__raw__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mission_raw/mission_raw_pb2_grpc.py depends on" + + " but the generated code in mission_raw/mission_raw_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MissionRawServiceStub(object): +class MissionRawServiceStub: """Enable raw missions as exposed by MAVLink.""" def __init__(self, channel): @@ -160,7 +160,7 @@ def __init__(self, channel): ) -class MissionRawServiceServicer(object): +class MissionRawServiceServicer: """Enable raw missions as exposed by MAVLink.""" def UploadMission(self, request, context): @@ -477,7 +477,7 @@ def add_MissionRawServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MissionRawService(object): +class MissionRawService: """Enable raw missions as exposed by MAVLink.""" @staticmethod diff --git a/mavsdk/mission_raw_server_pb2.py b/mavsdk/mission_raw_server_pb2.py index 2fe03683..a2eead95 100644 --- a/mavsdk/mission_raw_server_pb2.py +++ b/mavsdk/mission_raw_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mission_raw_server/mission_raw_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "mission_raw_server/mission_raw_server.proto", diff --git a/mavsdk/mission_raw_server_pb2_grpc.py b/mavsdk/mission_raw_server_pb2_grpc.py index 0e475e84..755d3b54 100644 --- a/mavsdk/mission_raw_server_pb2_grpc.py +++ b/mavsdk/mission_raw_server_pb2_grpc.py @@ -8,7 +8,7 @@ mission_raw_server_pb2 as mission__raw__server_dot_mission__raw__server__pb2, ) -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -24,14 +24,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mission_raw_server/mission_raw_server_pb2_grpc.py depends on" + + " but the generated code in mission_raw_server/mission_raw_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MissionRawServerServiceStub(object): +class MissionRawServerServiceStub: """Acts as a vehicle and receives incoming missions from GCS (in raw MAVLINK format). Provides current mission item state, so the server can progress through missions. """ @@ -68,7 +68,7 @@ def __init__(self, channel): ) -class MissionRawServerServiceServicer(object): +class MissionRawServerServiceServicer: """Acts as a vehicle and receives incoming missions from GCS (in raw MAVLINK format). Provides current mission item state, so the server can progress through missions. """ @@ -139,7 +139,7 @@ def add_MissionRawServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MissionRawServerService(object): +class MissionRawServerService: """Acts as a vehicle and receives incoming missions from GCS (in raw MAVLINK format). Provides current mission item state, so the server can progress through missions. """ diff --git a/mavsdk/mocap_pb2.py b/mavsdk/mocap_pb2.py index de352f5a..be0f8732 100644 --- a/mavsdk/mocap_pb2.py +++ b/mavsdk/mocap_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: mocap/mocap.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "mocap/mocap.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "mocap/mocap.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/mocap_pb2_grpc.py b/mavsdk/mocap_pb2_grpc.py index 7be30500..849d1210 100644 --- a/mavsdk/mocap_pb2_grpc.py +++ b/mavsdk/mocap_pb2_grpc.py @@ -6,7 +6,7 @@ from . import mocap_pb2 as mocap_dot_mocap__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in mocap/mocap_pb2_grpc.py depends on" + + " but the generated code in mocap/mocap_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class MocapServiceStub(object): +class MocapServiceStub: """ Allows interfacing a vehicle with a motion capture system in order to allow navigation without global positioning sources available @@ -68,7 +68,7 @@ def __init__(self, channel): ) -class MocapServiceServicer(object): +class MocapServiceServicer: """ Allows interfacing a vehicle with a motion capture system in order to allow navigation without global positioning sources available @@ -133,7 +133,7 @@ def add_MocapServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class MocapService(object): +class MocapService: """ Allows interfacing a vehicle with a motion capture system in order to allow navigation without global positioning sources available diff --git a/mavsdk/modes.py b/mavsdk/modes.py new file mode 100644 index 00000000..b911d2bb --- /dev/null +++ b/mavsdk/modes.py @@ -0,0 +1,379 @@ +# -*- coding: utf-8 -*- +# DO NOT EDIT! This file is auto-generated from +# https://github.com/mavlink/MAVSDK-Python/tree/main/other/templates/py +from ._base import AsyncBase +from . import modes_pb2, modes_pb2_grpc +from enum import Enum + + +class Mode: + """ + Mode type. + + Parameters + ---------- + name : std::string + Name of the mode, e.g. "Position" or "Stabilize" + + custom_mode : uint32_t + Autopilot specific custom mode + + is_standard : bool + True if this is a MAVLink standard mode, e.g. "Position" or "Mission" + + is_user_selectable : bool + True if the mode can be set by the user + + is_advanced : bool + True if the mode is for advanced users only + + is_auto_mode : bool + True if the mode runs autonomously, e.g. Mission or Land + + """ + + def __init__( + self, + name, + custom_mode, + is_standard, + is_user_selectable, + is_advanced, + is_auto_mode, + ): + """Initializes the Mode object""" + self.name = name + self.custom_mode = custom_mode + self.is_standard = is_standard + self.is_user_selectable = is_user_selectable + self.is_advanced = is_advanced + self.is_auto_mode = is_auto_mode + + def __eq__(self, to_compare): + """Checks if two Mode are the same""" + try: + # Try to compare - this likely fails when it is compared to a non + # Mode object + return ( + (self.name == to_compare.name) + and (self.custom_mode == to_compare.custom_mode) + and (self.is_standard == to_compare.is_standard) + and (self.is_user_selectable == to_compare.is_user_selectable) + and (self.is_advanced == to_compare.is_advanced) + and (self.is_auto_mode == to_compare.is_auto_mode) + ) + + except AttributeError: + return False + + def __str__(self): + """Mode in string representation""" + struct_repr = ", ".join( + [ + "name: " + str(self.name), + "custom_mode: " + str(self.custom_mode), + "is_standard: " + str(self.is_standard), + "is_user_selectable: " + str(self.is_user_selectable), + "is_advanced: " + str(self.is_advanced), + "is_auto_mode: " + str(self.is_auto_mode), + ] + ) + + return f"Mode: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcMode): + """Translates a gRPC struct to the SDK equivalent""" + return Mode( + rpcMode.name, + rpcMode.custom_mode, + rpcMode.is_standard, + rpcMode.is_user_selectable, + rpcMode.is_advanced, + rpcMode.is_auto_mode, + ) + + def translate_to_rpc(self, rpcMode): + """Translates this SDK object into its gRPC equivalent""" + + rpcMode.name = self.name + + rpcMode.custom_mode = self.custom_mode + + rpcMode.is_standard = self.is_standard + + rpcMode.is_user_selectable = self.is_user_selectable + + rpcMode.is_advanced = self.is_advanced + + rpcMode.is_auto_mode = self.is_auto_mode + + +class ModesResult: + """ + Result type. + + Parameters + ---------- + result : Result + Result enum value + + result_str : std::string + Human-readable English string describing the result + + """ + + class Result(Enum): + """ + Possible results returned for mode requests. + + Values + ------ + UNKNOWN + Unknown result + + SUCCESS + Request was successful + + NO_SYSTEM + No system is connected + + CONNECTION_ERROR + Connection error + + BUSY + Vehicle is busy + + DENIED + Request was denied, e.g. because the mode can't be entered right now + + UNSUPPORTED + Mode or command is not supported + + TIMEOUT + Request timed out + + FAILED + Request failed + + MODE_NOT_FOUND + No available mode with this name + + MODES_NOT_KNOWN_YET + The available modes have not been received yet + + """ + + UNKNOWN = 0 + SUCCESS = 1 + NO_SYSTEM = 2 + CONNECTION_ERROR = 3 + BUSY = 4 + DENIED = 5 + UNSUPPORTED = 6 + TIMEOUT = 7 + FAILED = 8 + MODE_NOT_FOUND = 9 + MODES_NOT_KNOWN_YET = 10 + + def translate_to_rpc(self): + if self == ModesResult.Result.UNKNOWN: + return modes_pb2.ModesResult.RESULT_UNKNOWN + if self == ModesResult.Result.SUCCESS: + return modes_pb2.ModesResult.RESULT_SUCCESS + if self == ModesResult.Result.NO_SYSTEM: + return modes_pb2.ModesResult.RESULT_NO_SYSTEM + if self == ModesResult.Result.CONNECTION_ERROR: + return modes_pb2.ModesResult.RESULT_CONNECTION_ERROR + if self == ModesResult.Result.BUSY: + return modes_pb2.ModesResult.RESULT_BUSY + if self == ModesResult.Result.DENIED: + return modes_pb2.ModesResult.RESULT_DENIED + if self == ModesResult.Result.UNSUPPORTED: + return modes_pb2.ModesResult.RESULT_UNSUPPORTED + if self == ModesResult.Result.TIMEOUT: + return modes_pb2.ModesResult.RESULT_TIMEOUT + if self == ModesResult.Result.FAILED: + return modes_pb2.ModesResult.RESULT_FAILED + if self == ModesResult.Result.MODE_NOT_FOUND: + return modes_pb2.ModesResult.RESULT_MODE_NOT_FOUND + if self == ModesResult.Result.MODES_NOT_KNOWN_YET: + return modes_pb2.ModesResult.RESULT_MODES_NOT_KNOWN_YET + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """Parses a gRPC response""" + if rpc_enum_value == modes_pb2.ModesResult.RESULT_UNKNOWN: + return ModesResult.Result.UNKNOWN + if rpc_enum_value == modes_pb2.ModesResult.RESULT_SUCCESS: + return ModesResult.Result.SUCCESS + if rpc_enum_value == modes_pb2.ModesResult.RESULT_NO_SYSTEM: + return ModesResult.Result.NO_SYSTEM + if rpc_enum_value == modes_pb2.ModesResult.RESULT_CONNECTION_ERROR: + return ModesResult.Result.CONNECTION_ERROR + if rpc_enum_value == modes_pb2.ModesResult.RESULT_BUSY: + return ModesResult.Result.BUSY + if rpc_enum_value == modes_pb2.ModesResult.RESULT_DENIED: + return ModesResult.Result.DENIED + if rpc_enum_value == modes_pb2.ModesResult.RESULT_UNSUPPORTED: + return ModesResult.Result.UNSUPPORTED + if rpc_enum_value == modes_pb2.ModesResult.RESULT_TIMEOUT: + return ModesResult.Result.TIMEOUT + if rpc_enum_value == modes_pb2.ModesResult.RESULT_FAILED: + return ModesResult.Result.FAILED + if rpc_enum_value == modes_pb2.ModesResult.RESULT_MODE_NOT_FOUND: + return ModesResult.Result.MODE_NOT_FOUND + if rpc_enum_value == modes_pb2.ModesResult.RESULT_MODES_NOT_KNOWN_YET: + return ModesResult.Result.MODES_NOT_KNOWN_YET + + def __str__(self): + return self.name + + def __init__(self, result, result_str): + """Initializes the ModesResult object""" + self.result = result + self.result_str = result_str + + def __eq__(self, to_compare): + """Checks if two ModesResult are the same""" + try: + # Try to compare - this likely fails when it is compared to a non + # ModesResult object + return (self.result == to_compare.result) and ( + self.result_str == to_compare.result_str + ) + + except AttributeError: + return False + + def __str__(self): + """ModesResult in string representation""" + struct_repr = ", ".join( + ["result: " + str(self.result), "result_str: " + str(self.result_str)] + ) + + return f"ModesResult: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcModesResult): + """Translates a gRPC struct to the SDK equivalent""" + return ModesResult( + ModesResult.Result.translate_from_rpc(rpcModesResult.result), + rpcModesResult.result_str, + ) + + def translate_to_rpc(self, rpcModesResult): + """Translates this SDK object into its gRPC equivalent""" + + rpcModesResult.result = self.result.translate_to_rpc() + + rpcModesResult.result_str = self.result_str + + +class ModesError(Exception): + """Raised when a ModesResult is a fail code""" + + def __init__(self, result, origin, *params): + self._result = result + self._origin = origin + self._params = params + + def __str__(self): + return f"{self._result.result}: '{self._result.result_str}'; origin: {self._origin}; params: {self._params}" + + +class Modes(AsyncBase): + """ + Discover and set flight modes at runtime. + + The modes are queried from the vehicle using the MAVLink standard modes + protocol (AVAILABLE_MODES, CURRENT_MODE). For autopilots that don't + implement it, a list of known modes is used as a fallback. + + Modes are identified by name. Standard modes have a fixed name, e.g. + "Position" or "Mission", other modes use the name reported by the vehicle. + Setting a mode works the same way for both. + + Generated by dcsdkgen - MAVSDK Modes API + """ + + # Plugin name + name = "Modes" + + def _setup_stub(self, channel): + """Setups the api stub""" + self._stub = modes_pb2_grpc.ModesServiceStub(channel) + + def _extract_result(self, response): + """Returns the response status and description""" + return ModesResult.translate_from_rpc(response.modes_result) + + async def available_modes(self): + """ + Subscribe to the list of available modes. + + The list is updated whenever the vehicle reports that its modes have changed. + + Yields + ------- + modes : [Mode] + The available modes + + + """ + + request = modes_pb2.SubscribeAvailableModesRequest() + available_modes_stream = self._stub.SubscribeAvailableModes(request) + + try: + async for response in available_modes_stream: + yield [Mode.translate_from_rpc(x) for x in response.modes] + finally: + available_modes_stream.cancel() + + async def current_mode(self): + """ + Subscribe to the current mode. + + Yields + ------- + mode : Mode + The current mode + + + """ + + request = modes_pb2.SubscribeCurrentModeRequest() + current_mode_stream = self._stub.SubscribeCurrentMode(request) + + try: + async for response in current_mode_stream: + yield Mode.translate_from_rpc(response.mode) + finally: + current_mode_stream.cancel() + + async def set_mode(self, name): + """ + Set mode by name. + + The name needs to match exactly (case-sensitive) the name of one of the available modes. + + Parameters + ---------- + name : std::string + Name of the mode to set + + Raises + ------ + ModesError + If the request fails. The error contains the reason for the failure. + """ + + request = modes_pb2.SetModeRequest() + request.name = name + response = await self._stub.SetMode(request) + + result = self._extract_result(response) + + if result.result != ModesResult.Result.SUCCESS: + raise ModesError(result, "set_mode()", name) diff --git a/mavsdk/modes_pb2.py b/mavsdk/modes_pb2.py new file mode 100644 index 00000000..3058151f --- /dev/null +++ b/mavsdk/modes_pb2.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: modes/modes.proto +# Protobuf Python Version: 7.35.1 +"""Generated protocol buffer code.""" + +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "modes/modes.proto" +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x11modes/modes.proto\x12\x10mavsdk.rpc.modes" \n\x1eSubscribeAvailableModesRequest"?\n\x16\x41vailableModesResponse\x12%\n\x05modes\x18\x01 \x03(\x0b\x32\x16.mavsdk.rpc.modes.Mode"\x1d\n\x1bSubscribeCurrentModeRequest";\n\x13\x43urrentModeResponse\x12$\n\x04mode\x18\x01 \x01(\x0b\x32\x16.mavsdk.rpc.modes.Mode"\x1e\n\x0eSetModeRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"F\n\x0fSetModeResponse\x12\x33\n\x0cmodes_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.modes.ModesResult"\x85\x01\n\x04Mode\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x63ustom_mode\x18\x02 \x01(\r\x12\x13\n\x0bis_standard\x18\x03 \x01(\x08\x12\x1a\n\x12is_user_selectable\x18\x04 \x01(\x08\x12\x13\n\x0bis_advanced\x18\x05 \x01(\x08\x12\x14\n\x0cis_auto_mode\x18\x06 \x01(\x08"\xdb\x02\n\x0bModesResult\x12\x34\n\x06result\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.modes.ModesResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\x81\x02\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x0f\n\x0bRESULT_BUSY\x10\x04\x12\x11\n\rRESULT_DENIED\x10\x05\x12\x16\n\x12RESULT_UNSUPPORTED\x10\x06\x12\x12\n\x0eRESULT_TIMEOUT\x10\x07\x12\x11\n\rRESULT_FAILED\x10\x08\x12\x19\n\x15RESULT_MODE_NOT_FOUND\x10\t\x12\x1e\n\x1aRESULT_MODES_NOT_KNOWN_YET\x10\n2\xcd\x02\n\x0cModesService\x12y\n\x17SubscribeAvailableModes\x12\x30.mavsdk.rpc.modes.SubscribeAvailableModesRequest\x1a(.mavsdk.rpc.modes.AvailableModesResponse"\x00\x30\x01\x12p\n\x14SubscribeCurrentMode\x12-.mavsdk.rpc.modes.SubscribeCurrentModeRequest\x1a%.mavsdk.rpc.modes.CurrentModeResponse"\x00\x30\x01\x12P\n\x07SetMode\x12 .mavsdk.rpc.modes.SetModeRequest\x1a!.mavsdk.rpc.modes.SetModeResponse"\x00\x42\x1d\n\x0fio.mavsdk.modesB\nModesProtob\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "modes.modes_pb2", _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals["DESCRIPTOR"]._loaded_options = None + _globals["DESCRIPTOR"]._serialized_options = b"\n\017io.mavsdk.modesB\nModesProto" + _globals["_SUBSCRIBEAVAILABLEMODESREQUEST"]._serialized_start = 39 + _globals["_SUBSCRIBEAVAILABLEMODESREQUEST"]._serialized_end = 71 + _globals["_AVAILABLEMODESRESPONSE"]._serialized_start = 73 + _globals["_AVAILABLEMODESRESPONSE"]._serialized_end = 136 + _globals["_SUBSCRIBECURRENTMODEREQUEST"]._serialized_start = 138 + _globals["_SUBSCRIBECURRENTMODEREQUEST"]._serialized_end = 167 + _globals["_CURRENTMODERESPONSE"]._serialized_start = 169 + _globals["_CURRENTMODERESPONSE"]._serialized_end = 228 + _globals["_SETMODEREQUEST"]._serialized_start = 230 + _globals["_SETMODEREQUEST"]._serialized_end = 260 + _globals["_SETMODERESPONSE"]._serialized_start = 262 + _globals["_SETMODERESPONSE"]._serialized_end = 332 + _globals["_MODE"]._serialized_start = 335 + _globals["_MODE"]._serialized_end = 468 + _globals["_MODESRESULT"]._serialized_start = 471 + _globals["_MODESRESULT"]._serialized_end = 818 + _globals["_MODESRESULT_RESULT"]._serialized_start = 561 + _globals["_MODESRESULT_RESULT"]._serialized_end = 818 + _globals["_MODESSERVICE"]._serialized_start = 821 + _globals["_MODESSERVICE"]._serialized_end = 1154 +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/modes_pb2_grpc.py b/mavsdk/modes_pb2_grpc.py new file mode 100644 index 00000000..aa45f948 --- /dev/null +++ b/mavsdk/modes_pb2_grpc.py @@ -0,0 +1,242 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" + +import grpc +import warnings + +from . import modes_pb2 as modes_dot_modes__pb2 + +GRPC_GENERATED_VERSION = "1.85.3" +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f"The grpc package installed is at version {GRPC_VERSION}," + + " but the generated code in modes/modes_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + ) + + +class ModesServiceStub: + """ + Discover and set flight modes at runtime. + + The modes are queried from the vehicle using the MAVLink standard modes + protocol (AVAILABLE_MODES, CURRENT_MODE). For autopilots that don't + implement it, a list of known modes is used as a fallback. + + Modes are identified by name. Standard modes have a fixed name, e.g. + "Position" or "Mission", other modes use the name reported by the vehicle. + Setting a mode works the same way for both. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SubscribeAvailableModes = channel.unary_stream( + "/mavsdk.rpc.modes.ModesService/SubscribeAvailableModes", + request_serializer=modes_dot_modes__pb2.SubscribeAvailableModesRequest.SerializeToString, + response_deserializer=modes_dot_modes__pb2.AvailableModesResponse.FromString, + _registered_method=True, + ) + self.SubscribeCurrentMode = channel.unary_stream( + "/mavsdk.rpc.modes.ModesService/SubscribeCurrentMode", + request_serializer=modes_dot_modes__pb2.SubscribeCurrentModeRequest.SerializeToString, + response_deserializer=modes_dot_modes__pb2.CurrentModeResponse.FromString, + _registered_method=True, + ) + self.SetMode = channel.unary_unary( + "/mavsdk.rpc.modes.ModesService/SetMode", + request_serializer=modes_dot_modes__pb2.SetModeRequest.SerializeToString, + response_deserializer=modes_dot_modes__pb2.SetModeResponse.FromString, + _registered_method=True, + ) + + +class ModesServiceServicer: + """ + Discover and set flight modes at runtime. + + The modes are queried from the vehicle using the MAVLink standard modes + protocol (AVAILABLE_MODES, CURRENT_MODE). For autopilots that don't + implement it, a list of known modes is used as a fallback. + + Modes are identified by name. Standard modes have a fixed name, e.g. + "Position" or "Mission", other modes use the name reported by the vehicle. + Setting a mode works the same way for both. + """ + + def SubscribeAvailableModes(self, request, context): + """ + Subscribe to the list of available modes. + + The list is updated whenever the vehicle reports that its modes have changed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def SubscribeCurrentMode(self, request, context): + """ + Subscribe to the current mode. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def SetMode(self, request, context): + """ + Set mode by name. + + The name needs to match exactly (case-sensitive) the name of one of the available modes. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_ModesServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "SubscribeAvailableModes": grpc.unary_stream_rpc_method_handler( + servicer.SubscribeAvailableModes, + request_deserializer=modes_dot_modes__pb2.SubscribeAvailableModesRequest.FromString, + response_serializer=modes_dot_modes__pb2.AvailableModesResponse.SerializeToString, + ), + "SubscribeCurrentMode": grpc.unary_stream_rpc_method_handler( + servicer.SubscribeCurrentMode, + request_deserializer=modes_dot_modes__pb2.SubscribeCurrentModeRequest.FromString, + response_serializer=modes_dot_modes__pb2.CurrentModeResponse.SerializeToString, + ), + "SetMode": grpc.unary_unary_rpc_method_handler( + servicer.SetMode, + request_deserializer=modes_dot_modes__pb2.SetModeRequest.FromString, + response_serializer=modes_dot_modes__pb2.SetModeResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "mavsdk.rpc.modes.ModesService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers( + "mavsdk.rpc.modes.ModesService", rpc_method_handlers + ) + + +# This class is part of an EXPERIMENTAL API. +class ModesService: + """ + Discover and set flight modes at runtime. + + The modes are queried from the vehicle using the MAVLink standard modes + protocol (AVAILABLE_MODES, CURRENT_MODE). For autopilots that don't + implement it, a list of known modes is used as a fallback. + + Modes are identified by name. Standard modes have a fixed name, e.g. + "Position" or "Mission", other modes use the name reported by the vehicle. + Setting a mode works the same way for both. + """ + + @staticmethod + def SubscribeAvailableModes( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_stream( + request, + target, + "/mavsdk.rpc.modes.ModesService/SubscribeAvailableModes", + modes_dot_modes__pb2.SubscribeAvailableModesRequest.SerializeToString, + modes_dot_modes__pb2.AvailableModesResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def SubscribeCurrentMode( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_stream( + request, + target, + "/mavsdk.rpc.modes.ModesService/SubscribeCurrentMode", + modes_dot_modes__pb2.SubscribeCurrentModeRequest.SerializeToString, + modes_dot_modes__pb2.CurrentModeResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def SetMode( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.modes.ModesService/SetMode", + modes_dot_modes__pb2.SetModeRequest.SerializeToString, + modes_dot_modes__pb2.SetModeResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/modes_server.py b/mavsdk/modes_server.py new file mode 100644 index 00000000..8c47dd1e --- /dev/null +++ b/mavsdk/modes_server.py @@ -0,0 +1,450 @@ +# -*- coding: utf-8 -*- +# DO NOT EDIT! This file is auto-generated from +# https://github.com/mavlink/MAVSDK-Python/tree/main/other/templates/py +from ._base import AsyncBase +from . import modes_server_pb2, modes_server_pb2_grpc +from enum import Enum + + +class ModeFeedback(Enum): + """ + Possible answers to a mode change request. + + Values + ------ + UNKNOWN + Unknown + + ACCEPTED + The vehicle switches to the mode + + BUSY + The vehicle can't switch to the mode right now, e.g. it has no GPS + + DENIED + The vehicle doesn't allow switching to the mode + + FAILED + Switching to the mode failed + + """ + + UNKNOWN = 0 + ACCEPTED = 1 + BUSY = 2 + DENIED = 3 + FAILED = 4 + + def translate_to_rpc(self): + if self == ModeFeedback.UNKNOWN: + return modes_server_pb2.MODE_FEEDBACK_UNKNOWN + if self == ModeFeedback.ACCEPTED: + return modes_server_pb2.MODE_FEEDBACK_ACCEPTED + if self == ModeFeedback.BUSY: + return modes_server_pb2.MODE_FEEDBACK_BUSY + if self == ModeFeedback.DENIED: + return modes_server_pb2.MODE_FEEDBACK_DENIED + if self == ModeFeedback.FAILED: + return modes_server_pb2.MODE_FEEDBACK_FAILED + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """Parses a gRPC response""" + if rpc_enum_value == modes_server_pb2.MODE_FEEDBACK_UNKNOWN: + return ModeFeedback.UNKNOWN + if rpc_enum_value == modes_server_pb2.MODE_FEEDBACK_ACCEPTED: + return ModeFeedback.ACCEPTED + if rpc_enum_value == modes_server_pb2.MODE_FEEDBACK_BUSY: + return ModeFeedback.BUSY + if rpc_enum_value == modes_server_pb2.MODE_FEEDBACK_DENIED: + return ModeFeedback.DENIED + if rpc_enum_value == modes_server_pb2.MODE_FEEDBACK_FAILED: + return ModeFeedback.FAILED + + def __str__(self): + return self.name + + +class Mode: + """ + Mode type. + + Parameters + ---------- + name : std::string + Name of the mode, for a standard mode one of the standard names, e.g. "Position" or "Mission" + + custom_mode : uint32_t + Autopilot specific custom mode, needs to be unique + + is_standard : bool + True if this is a MAVLink standard mode + + is_user_selectable : bool + True if the mode can be set by the user + + is_advanced : bool + True if the mode is for advanced users only + + is_auto_mode : bool + True if the mode runs autonomously, e.g. Mission or Land + + """ + + def __init__( + self, + name, + custom_mode, + is_standard, + is_user_selectable, + is_advanced, + is_auto_mode, + ): + """Initializes the Mode object""" + self.name = name + self.custom_mode = custom_mode + self.is_standard = is_standard + self.is_user_selectable = is_user_selectable + self.is_advanced = is_advanced + self.is_auto_mode = is_auto_mode + + def __eq__(self, to_compare): + """Checks if two Mode are the same""" + try: + # Try to compare - this likely fails when it is compared to a non + # Mode object + return ( + (self.name == to_compare.name) + and (self.custom_mode == to_compare.custom_mode) + and (self.is_standard == to_compare.is_standard) + and (self.is_user_selectable == to_compare.is_user_selectable) + and (self.is_advanced == to_compare.is_advanced) + and (self.is_auto_mode == to_compare.is_auto_mode) + ) + + except AttributeError: + return False + + def __str__(self): + """Mode in string representation""" + struct_repr = ", ".join( + [ + "name: " + str(self.name), + "custom_mode: " + str(self.custom_mode), + "is_standard: " + str(self.is_standard), + "is_user_selectable: " + str(self.is_user_selectable), + "is_advanced: " + str(self.is_advanced), + "is_auto_mode: " + str(self.is_auto_mode), + ] + ) + + return f"Mode: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcMode): + """Translates a gRPC struct to the SDK equivalent""" + return Mode( + rpcMode.name, + rpcMode.custom_mode, + rpcMode.is_standard, + rpcMode.is_user_selectable, + rpcMode.is_advanced, + rpcMode.is_auto_mode, + ) + + def translate_to_rpc(self, rpcMode): + """Translates this SDK object into its gRPC equivalent""" + + rpcMode.name = self.name + + rpcMode.custom_mode = self.custom_mode + + rpcMode.is_standard = self.is_standard + + rpcMode.is_user_selectable = self.is_user_selectable + + rpcMode.is_advanced = self.is_advanced + + rpcMode.is_auto_mode = self.is_auto_mode + + +class ModesServerResult: + """ + Result type. + + Parameters + ---------- + result : Result + Result enum value + + result_str : std::string + Human-readable English string describing the result + + """ + + class Result(Enum): + """ + Possible results returned for mode requests. + + Values + ------ + UNKNOWN + Unknown result + + SUCCESS + Request was successful + + INVALID_MODES + Modes are invalid, e.g. none are given, a name or custom mode is used twice, or a standard mode name is unknown + + MODE_NOT_FOUND + No available mode with this name + + NO_REQUEST + There is no mode change request to respond to + + INVALID_FEEDBACK + The feedback is unknown + + """ + + UNKNOWN = 0 + SUCCESS = 1 + INVALID_MODES = 2 + MODE_NOT_FOUND = 3 + NO_REQUEST = 4 + INVALID_FEEDBACK = 5 + + def translate_to_rpc(self): + if self == ModesServerResult.Result.UNKNOWN: + return modes_server_pb2.ModesServerResult.RESULT_UNKNOWN + if self == ModesServerResult.Result.SUCCESS: + return modes_server_pb2.ModesServerResult.RESULT_SUCCESS + if self == ModesServerResult.Result.INVALID_MODES: + return modes_server_pb2.ModesServerResult.RESULT_INVALID_MODES + if self == ModesServerResult.Result.MODE_NOT_FOUND: + return modes_server_pb2.ModesServerResult.RESULT_MODE_NOT_FOUND + if self == ModesServerResult.Result.NO_REQUEST: + return modes_server_pb2.ModesServerResult.RESULT_NO_REQUEST + if self == ModesServerResult.Result.INVALID_FEEDBACK: + return modes_server_pb2.ModesServerResult.RESULT_INVALID_FEEDBACK + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """Parses a gRPC response""" + if rpc_enum_value == modes_server_pb2.ModesServerResult.RESULT_UNKNOWN: + return ModesServerResult.Result.UNKNOWN + if rpc_enum_value == modes_server_pb2.ModesServerResult.RESULT_SUCCESS: + return ModesServerResult.Result.SUCCESS + if ( + rpc_enum_value + == modes_server_pb2.ModesServerResult.RESULT_INVALID_MODES + ): + return ModesServerResult.Result.INVALID_MODES + if ( + rpc_enum_value + == modes_server_pb2.ModesServerResult.RESULT_MODE_NOT_FOUND + ): + return ModesServerResult.Result.MODE_NOT_FOUND + if rpc_enum_value == modes_server_pb2.ModesServerResult.RESULT_NO_REQUEST: + return ModesServerResult.Result.NO_REQUEST + if ( + rpc_enum_value + == modes_server_pb2.ModesServerResult.RESULT_INVALID_FEEDBACK + ): + return ModesServerResult.Result.INVALID_FEEDBACK + + def __str__(self): + return self.name + + def __init__(self, result, result_str): + """Initializes the ModesServerResult object""" + self.result = result + self.result_str = result_str + + def __eq__(self, to_compare): + """Checks if two ModesServerResult are the same""" + try: + # Try to compare - this likely fails when it is compared to a non + # ModesServerResult object + return (self.result == to_compare.result) and ( + self.result_str == to_compare.result_str + ) + + except AttributeError: + return False + + def __str__(self): + """ModesServerResult in string representation""" + struct_repr = ", ".join( + ["result: " + str(self.result), "result_str: " + str(self.result_str)] + ) + + return f"ModesServerResult: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcModesServerResult): + """Translates a gRPC struct to the SDK equivalent""" + return ModesServerResult( + ModesServerResult.Result.translate_from_rpc(rpcModesServerResult.result), + rpcModesServerResult.result_str, + ) + + def translate_to_rpc(self, rpcModesServerResult): + """Translates this SDK object into its gRPC equivalent""" + + rpcModesServerResult.result = self.result.translate_to_rpc() + + rpcModesServerResult.result_str = self.result_str + + +class ModesServerError(Exception): + """Raised when a ModesServerResult is a fail code""" + + def __init__(self, result, origin, *params): + self._result = result + self._origin = origin + self._params = params + + def __str__(self): + return f"{self._result.result}: '{self._result.result_str}'; origin: {self._origin}; params: {self._params}" + + +class ModesServer(AsyncBase): + """ + Provide the flight modes of an autopilot, the counterpart of the Modes plugin. + + The modes are announced using the MAVLink standard modes protocol + (AVAILABLE_MODES, AVAILABLE_MODES_MONITOR, CURRENT_MODE). + + Once modes are set, this plugin also handles mode change requests + (MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE and SET_MODE) for those + modes, instead of the deprecated flight mode API of the ActionServer plugin. + + Generated by dcsdkgen - MAVSDK ModesServer API + """ + + # Plugin name + name = "ModesServer" + + def _setup_stub(self, channel): + """Setups the api stub""" + self._stub = modes_server_pb2_grpc.ModesServerServiceStub(channel) + + def _extract_result(self, response): + """Returns the response status and description""" + return ModesServerResult.translate_from_rpc(response.modes_server_result) + + async def set_available_modes(self, modes): + """ + Set the modes the vehicle provides. + + Ground stations are told that the list changed so they download it again. + From then on, mode change requests are handled by this plugin. + + Parameters + ---------- + modes : [Mode] + The available modes + + Raises + ------ + ModesServerError + If the request fails. The error contains the reason for the failure. + """ + + request = modes_server_pb2.SetAvailableModesRequest() + + rpc_elems_list = [] + for elem in modes: + rpc_elem = modes_server_pb2.Mode() + elem.translate_to_rpc(rpc_elem) + rpc_elems_list.append(rpc_elem) + + request.modes.extend(rpc_elems_list) + + response = await self._stub.SetAvailableModes(request) + + result = self._extract_result(response) + + if result.result != ModesServerResult.Result.SUCCESS: + raise ModesServerError(result, "set_available_modes()", modes) + + async def mode_requested(self): + """ + Subscribe to mode change requests. + + Requests for a mode in the list are reported here and need to be + answered with RespondModeRequested. Until then, the ground station is + told that the request is in progress. + + Yields + ------- + mode : Mode + The requested mode + + + """ + + request = modes_server_pb2.SubscribeModeRequestedRequest() + mode_requested_stream = self._stub.SubscribeModeRequested(request) + + try: + async for response in mode_requested_stream: + yield Mode.translate_from_rpc(response.mode) + finally: + mode_requested_stream.cancel() + + async def respond_mode_requested(self, mode_feedback): + """ + Respond to the last mode change request. + + If the request is accepted, the requested mode becomes the current mode. + Otherwise the vehicle stays in its current mode, e.g. if it can't switch + to Position without GPS. + + Parameters + ---------- + mode_feedback : ModeFeedback + The answer to the request + + Raises + ------ + ModesServerError + If the request fails. The error contains the reason for the failure. + """ + + request = modes_server_pb2.RespondModeRequestedRequest() + + request.mode_feedback = mode_feedback.translate_to_rpc() + + response = await self._stub.RespondModeRequested(request) + + result = self._extract_result(response) + + if result.result != ModesServerResult.Result.SUCCESS: + raise ModesServerError(result, "respond_mode_requested()", mode_feedback) + + async def set_current_mode(self, name): + """ + Set the mode the vehicle is in. + + Parameters + ---------- + name : std::string + Name of the mode, one of the available modes + + Raises + ------ + ModesServerError + If the request fails. The error contains the reason for the failure. + """ + + request = modes_server_pb2.SetCurrentModeRequest() + request.name = name + response = await self._stub.SetCurrentMode(request) + + result = self._extract_result(response) + + if result.result != ModesServerResult.Result.SUCCESS: + raise ModesServerError(result, "set_current_mode()", name) diff --git a/mavsdk/modes_server_pb2.py b/mavsdk/modes_server_pb2.py new file mode 100644 index 00000000..2b748b16 --- /dev/null +++ b/mavsdk/modes_server_pb2.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: modes_server/modes_server.proto +# Protobuf Python Version: 7.35.1 +"""Generated protocol buffer code.""" + +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "modes_server/modes_server.proto" +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import mavsdk_options_pb2 as mavsdk__options__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x1fmodes_server/modes_server.proto\x12\x17mavsdk.rpc.modes_server\x1a\x14mavsdk_options.proto"H\n\x18SetAvailableModesRequest\x12,\n\x05modes\x18\x01 \x03(\x0b\x32\x1d.mavsdk.rpc.modes_server.Mode"d\n\x19SetAvailableModesResponse\x12G\n\x13modes_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.modes_server.ModesServerResult"\x1f\n\x1dSubscribeModeRequestedRequest"D\n\x15ModeRequestedResponse\x12+\n\x04mode\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.modes_server.Mode"[\n\x1bRespondModeRequestedRequest\x12<\n\rmode_feedback\x18\x01 \x01(\x0e\x32%.mavsdk.rpc.modes_server.ModeFeedback"g\n\x1cRespondModeRequestedResponse\x12G\n\x13modes_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.modes_server.ModesServerResult"%\n\x15SetCurrentModeRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"a\n\x16SetCurrentModeResponse\x12G\n\x13modes_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.modes_server.ModesServerResult"\x85\x01\n\x04Mode\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x63ustom_mode\x18\x02 \x01(\r\x12\x13\n\x0bis_standard\x18\x03 \x01(\x08\x12\x1a\n\x12is_user_selectable\x18\x04 \x01(\x08\x12\x13\n\x0bis_advanced\x18\x05 \x01(\x08\x12\x14\n\x0cis_auto_mode\x18\x06 \x01(\x08"\x86\x02\n\x11ModesServerResult\x12\x41\n\x06result\x18\x01 \x01(\x0e\x32\x31.mavsdk.rpc.modes_server.ModesServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\x99\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x18\n\x14RESULT_INVALID_MODES\x10\x02\x12\x19\n\x15RESULT_MODE_NOT_FOUND\x10\x03\x12\x15\n\x11RESULT_NO_REQUEST\x10\x04\x12\x1b\n\x17RESULT_INVALID_FEEDBACK\x10\x05*\x91\x01\n\x0cModeFeedback\x12\x19\n\x15MODE_FEEDBACK_UNKNOWN\x10\x00\x12\x1a\n\x16MODE_FEEDBACK_ACCEPTED\x10\x01\x12\x16\n\x12MODE_FEEDBACK_BUSY\x10\x02\x12\x18\n\x14MODE_FEEDBACK_DENIED\x10\x03\x12\x18\n\x14MODE_FEEDBACK_FAILED\x10\x04\x32\xa7\x04\n\x12ModesServerService\x12\x80\x01\n\x11SetAvailableModes\x12\x31.mavsdk.rpc.modes_server.SetAvailableModesRequest\x1a\x32.mavsdk.rpc.modes_server.SetAvailableModesResponse"\x04\x80\xb5\x18\x01\x12\x88\x01\n\x16SubscribeModeRequested\x12\x36.mavsdk.rpc.modes_server.SubscribeModeRequestedRequest\x1a..mavsdk.rpc.modes_server.ModeRequestedResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x89\x01\n\x14RespondModeRequested\x12\x34.mavsdk.rpc.modes_server.RespondModeRequestedRequest\x1a\x35.mavsdk.rpc.modes_server.RespondModeRequestedResponse"\x04\x80\xb5\x18\x01\x12w\n\x0eSetCurrentMode\x12..mavsdk.rpc.modes_server.SetCurrentModeRequest\x1a/.mavsdk.rpc.modes_server.SetCurrentModeResponse"\x04\x80\xb5\x18\x01\x42*\n\x16io.mavsdk.modes_serverB\x10ModesServerProtob\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages( + DESCRIPTOR, "modes_server.modes_server_pb2", _globals +) +if not _descriptor._USE_C_DESCRIPTORS: + _globals["DESCRIPTOR"]._loaded_options = None + _globals[ + "DESCRIPTOR" + ]._serialized_options = b"\n\026io.mavsdk.modes_serverB\020ModesServerProto" + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SetAvailableModes" + ]._loaded_options = None + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SetAvailableModes" + ]._serialized_options = b"\200\265\030\001" + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SubscribeModeRequested" + ]._loaded_options = None + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SubscribeModeRequested" + ]._serialized_options = b"\200\265\030\000" + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "RespondModeRequested" + ]._loaded_options = None + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "RespondModeRequested" + ]._serialized_options = b"\200\265\030\001" + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SetCurrentMode" + ]._loaded_options = None + _globals["_MODESSERVERSERVICE"].methods_by_name[ + "SetCurrentMode" + ]._serialized_options = b"\200\265\030\001" + _globals["_MODEFEEDBACK"]._serialized_start = 1099 + _globals["_MODEFEEDBACK"]._serialized_end = 1244 + _globals["_SETAVAILABLEMODESREQUEST"]._serialized_start = 82 + _globals["_SETAVAILABLEMODESREQUEST"]._serialized_end = 154 + _globals["_SETAVAILABLEMODESRESPONSE"]._serialized_start = 156 + _globals["_SETAVAILABLEMODESRESPONSE"]._serialized_end = 256 + _globals["_SUBSCRIBEMODEREQUESTEDREQUEST"]._serialized_start = 258 + _globals["_SUBSCRIBEMODEREQUESTEDREQUEST"]._serialized_end = 289 + _globals["_MODEREQUESTEDRESPONSE"]._serialized_start = 291 + _globals["_MODEREQUESTEDRESPONSE"]._serialized_end = 359 + _globals["_RESPONDMODEREQUESTEDREQUEST"]._serialized_start = 361 + _globals["_RESPONDMODEREQUESTEDREQUEST"]._serialized_end = 452 + _globals["_RESPONDMODEREQUESTEDRESPONSE"]._serialized_start = 454 + _globals["_RESPONDMODEREQUESTEDRESPONSE"]._serialized_end = 557 + _globals["_SETCURRENTMODEREQUEST"]._serialized_start = 559 + _globals["_SETCURRENTMODEREQUEST"]._serialized_end = 596 + _globals["_SETCURRENTMODERESPONSE"]._serialized_start = 598 + _globals["_SETCURRENTMODERESPONSE"]._serialized_end = 695 + _globals["_MODE"]._serialized_start = 698 + _globals["_MODE"]._serialized_end = 831 + _globals["_MODESSERVERRESULT"]._serialized_start = 834 + _globals["_MODESSERVERRESULT"]._serialized_end = 1096 + _globals["_MODESSERVERRESULT_RESULT"]._serialized_start = 943 + _globals["_MODESSERVERRESULT_RESULT"]._serialized_end = 1096 + _globals["_MODESSERVERSERVICE"]._serialized_start = 1247 + _globals["_MODESSERVERSERVICE"]._serialized_end = 1798 +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/modes_server_pb2_grpc.py b/mavsdk/modes_server_pb2_grpc.py new file mode 100644 index 00000000..f61f34a8 --- /dev/null +++ b/mavsdk/modes_server_pb2_grpc.py @@ -0,0 +1,295 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" + +import grpc +import warnings + +from . import modes_server_pb2 as modes__server_dot_modes__server__pb2 + +GRPC_GENERATED_VERSION = "1.85.3" +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f"The grpc package installed is at version {GRPC_VERSION}," + + " but the generated code in modes_server/modes_server_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + ) + + +class ModesServerServiceStub: + """ + Provide the flight modes of an autopilot, the counterpart of the Modes plugin. + + The modes are announced using the MAVLink standard modes protocol + (AVAILABLE_MODES, AVAILABLE_MODES_MONITOR, CURRENT_MODE). + + Once modes are set, this plugin also handles mode change requests + (MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE and SET_MODE) for those + modes, instead of the deprecated flight mode API of the ActionServer plugin. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SetAvailableModes = channel.unary_unary( + "/mavsdk.rpc.modes_server.ModesServerService/SetAvailableModes", + request_serializer=modes__server_dot_modes__server__pb2.SetAvailableModesRequest.SerializeToString, + response_deserializer=modes__server_dot_modes__server__pb2.SetAvailableModesResponse.FromString, + _registered_method=True, + ) + self.SubscribeModeRequested = channel.unary_stream( + "/mavsdk.rpc.modes_server.ModesServerService/SubscribeModeRequested", + request_serializer=modes__server_dot_modes__server__pb2.SubscribeModeRequestedRequest.SerializeToString, + response_deserializer=modes__server_dot_modes__server__pb2.ModeRequestedResponse.FromString, + _registered_method=True, + ) + self.RespondModeRequested = channel.unary_unary( + "/mavsdk.rpc.modes_server.ModesServerService/RespondModeRequested", + request_serializer=modes__server_dot_modes__server__pb2.RespondModeRequestedRequest.SerializeToString, + response_deserializer=modes__server_dot_modes__server__pb2.RespondModeRequestedResponse.FromString, + _registered_method=True, + ) + self.SetCurrentMode = channel.unary_unary( + "/mavsdk.rpc.modes_server.ModesServerService/SetCurrentMode", + request_serializer=modes__server_dot_modes__server__pb2.SetCurrentModeRequest.SerializeToString, + response_deserializer=modes__server_dot_modes__server__pb2.SetCurrentModeResponse.FromString, + _registered_method=True, + ) + + +class ModesServerServiceServicer: + """ + Provide the flight modes of an autopilot, the counterpart of the Modes plugin. + + The modes are announced using the MAVLink standard modes protocol + (AVAILABLE_MODES, AVAILABLE_MODES_MONITOR, CURRENT_MODE). + + Once modes are set, this plugin also handles mode change requests + (MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE and SET_MODE) for those + modes, instead of the deprecated flight mode API of the ActionServer plugin. + """ + + def SetAvailableModes(self, request, context): + """ + Set the modes the vehicle provides. + + Ground stations are told that the list changed so they download it again. + From then on, mode change requests are handled by this plugin. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def SubscribeModeRequested(self, request, context): + """ + Subscribe to mode change requests. + + Requests for a mode in the list are reported here and need to be + answered with RespondModeRequested. Until then, the ground station is + told that the request is in progress. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def RespondModeRequested(self, request, context): + """ + Respond to the last mode change request. + + If the request is accepted, the requested mode becomes the current mode. + Otherwise the vehicle stays in its current mode, e.g. if it can't switch + to Position without GPS. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def SetCurrentMode(self, request, context): + """ + Set the mode the vehicle is in. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_ModesServerServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "SetAvailableModes": grpc.unary_unary_rpc_method_handler( + servicer.SetAvailableModes, + request_deserializer=modes__server_dot_modes__server__pb2.SetAvailableModesRequest.FromString, + response_serializer=modes__server_dot_modes__server__pb2.SetAvailableModesResponse.SerializeToString, + ), + "SubscribeModeRequested": grpc.unary_stream_rpc_method_handler( + servicer.SubscribeModeRequested, + request_deserializer=modes__server_dot_modes__server__pb2.SubscribeModeRequestedRequest.FromString, + response_serializer=modes__server_dot_modes__server__pb2.ModeRequestedResponse.SerializeToString, + ), + "RespondModeRequested": grpc.unary_unary_rpc_method_handler( + servicer.RespondModeRequested, + request_deserializer=modes__server_dot_modes__server__pb2.RespondModeRequestedRequest.FromString, + response_serializer=modes__server_dot_modes__server__pb2.RespondModeRequestedResponse.SerializeToString, + ), + "SetCurrentMode": grpc.unary_unary_rpc_method_handler( + servicer.SetCurrentMode, + request_deserializer=modes__server_dot_modes__server__pb2.SetCurrentModeRequest.FromString, + response_serializer=modes__server_dot_modes__server__pb2.SetCurrentModeResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "mavsdk.rpc.modes_server.ModesServerService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers( + "mavsdk.rpc.modes_server.ModesServerService", rpc_method_handlers + ) + + +# This class is part of an EXPERIMENTAL API. +class ModesServerService: + """ + Provide the flight modes of an autopilot, the counterpart of the Modes plugin. + + The modes are announced using the MAVLink standard modes protocol + (AVAILABLE_MODES, AVAILABLE_MODES_MONITOR, CURRENT_MODE). + + Once modes are set, this plugin also handles mode change requests + (MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE and SET_MODE) for those + modes, instead of the deprecated flight mode API of the ActionServer plugin. + """ + + @staticmethod + def SetAvailableModes( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.modes_server.ModesServerService/SetAvailableModes", + modes__server_dot_modes__server__pb2.SetAvailableModesRequest.SerializeToString, + modes__server_dot_modes__server__pb2.SetAvailableModesResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def SubscribeModeRequested( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_stream( + request, + target, + "/mavsdk.rpc.modes_server.ModesServerService/SubscribeModeRequested", + modes__server_dot_modes__server__pb2.SubscribeModeRequestedRequest.SerializeToString, + modes__server_dot_modes__server__pb2.ModeRequestedResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def RespondModeRequested( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.modes_server.ModesServerService/RespondModeRequested", + modes__server_dot_modes__server__pb2.RespondModeRequestedRequest.SerializeToString, + modes__server_dot_modes__server__pb2.RespondModeRequestedResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def SetCurrentMode( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/mavsdk.rpc.modes_server.ModesServerService/SetCurrentMode", + modes__server_dot_modes__server__pb2.SetCurrentModeRequest.SerializeToString, + modes__server_dot_modes__server__pb2.SetCurrentModeResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/offboard_pb2.py b/mavsdk/offboard_pb2.py index c8a0cb8b..5dcacc3b 100644 --- a/mavsdk/offboard_pb2.py +++ b/mavsdk/offboard_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: offboard/offboard.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "offboard/offboard.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "offboard/offboard.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/offboard_pb2_grpc.py b/mavsdk/offboard_pb2_grpc.py index 320bf8b9..aaec7f29 100644 --- a/mavsdk/offboard_pb2_grpc.py +++ b/mavsdk/offboard_pb2_grpc.py @@ -6,7 +6,7 @@ from . import offboard_pb2 as offboard_dot_offboard__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in offboard/offboard_pb2_grpc.py depends on" + + " but the generated code in offboard/offboard_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class OffboardServiceStub(object): +class OffboardServiceStub: """ Control a drone with position, velocity, attitude or motor commands. @@ -127,7 +127,7 @@ def __init__(self, channel): ) -class OffboardServiceServicer(object): +class OffboardServiceServicer: """ Control a drone with position, velocity, attitude or motor commands. @@ -330,7 +330,7 @@ def add_OffboardServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class OffboardService(object): +class OffboardService: """ Control a drone with position, velocity, attitude or motor commands. diff --git a/mavsdk/param_pb2.py b/mavsdk/param_pb2.py index 4f21d32b..c4a8f85b 100644 --- a/mavsdk/param_pb2.py +++ b/mavsdk/param_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: param/param.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "param/param.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "param/param.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/param_pb2_grpc.py b/mavsdk/param_pb2_grpc.py index 75872873..4351f386 100644 --- a/mavsdk/param_pb2_grpc.py +++ b/mavsdk/param_pb2_grpc.py @@ -6,7 +6,7 @@ from . import param_pb2 as param_dot_param__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in param/param_pb2_grpc.py depends on" + + " but the generated code in param/param_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ParamServiceStub(object): +class ParamServiceStub: """Provide raw access to get and set parameters.""" def __init__(self, channel): @@ -88,7 +88,7 @@ def __init__(self, channel): ) -class ParamServiceServicer(object): +class ParamServiceServicer: """Provide raw access to get and set parameters.""" def GetParamInt(self, request, context): @@ -223,7 +223,7 @@ def add_ParamServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ParamService(object): +class ParamService: """Provide raw access to get and set parameters.""" @staticmethod diff --git a/mavsdk/param_server_pb2.py b/mavsdk/param_server_pb2.py index 151fadd4..cad3e0e4 100644 --- a/mavsdk/param_server_pb2.py +++ b/mavsdk/param_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: param_server/param_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "param_server/param_server.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "param_server/param_server.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/param_server_pb2_grpc.py b/mavsdk/param_server_pb2_grpc.py index 4b6c6c9d..fa811489 100644 --- a/mavsdk/param_server_pb2_grpc.py +++ b/mavsdk/param_server_pb2_grpc.py @@ -6,7 +6,7 @@ from . import param_server_pb2 as param__server_dot_param__server__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in param_server/param_server_pb2_grpc.py depends on" + + " but the generated code in param_server/param_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ParamServerServiceStub(object): +class ParamServerServiceStub: """Provide raw access to retrieve and provide server parameters.""" def __init__(self, channel): @@ -106,7 +106,7 @@ def __init__(self, channel): ) -class ParamServerServiceServicer(object): +class ParamServerServiceServicer: """Provide raw access to retrieve and provide server parameters.""" def SetProtocol(self, request, context): @@ -291,7 +291,7 @@ def add_ParamServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ParamServerService(object): +class ParamServerService: """Provide raw access to retrieve and provide server parameters.""" @staticmethod diff --git a/mavsdk/rtk_pb2.py b/mavsdk/rtk_pb2.py index a97f7522..f0ac2678 100644 --- a/mavsdk/rtk_pb2.py +++ b/mavsdk/rtk_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: rtk/rtk.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "rtk/rtk.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "rtk/rtk.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/rtk_pb2_grpc.py b/mavsdk/rtk_pb2_grpc.py index 21f3df96..b926dcc8 100644 --- a/mavsdk/rtk_pb2_grpc.py +++ b/mavsdk/rtk_pb2_grpc.py @@ -6,7 +6,7 @@ from . import rtk_pb2 as rtk_dot_rtk__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in rtk/rtk_pb2_grpc.py depends on" + + " but the generated code in rtk/rtk_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class RtkServiceStub(object): +class RtkServiceStub: """Service to send RTK corrections to the vehicle.""" def __init__(self, channel): @@ -46,7 +46,7 @@ def __init__(self, channel): ) -class RtkServiceServicer(object): +class RtkServiceServicer: """Service to send RTK corrections to the vehicle.""" def SendRtcmData(self, request, context): @@ -74,7 +74,7 @@ def add_RtkServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class RtkService(object): +class RtkService: """Service to send RTK corrections to the vehicle.""" @staticmethod diff --git a/mavsdk/server_utility_pb2.py b/mavsdk/server_utility_pb2.py index ecf5725e..18eeffed 100644 --- a/mavsdk/server_utility_pb2.py +++ b/mavsdk/server_utility_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: server_utility/server_utility.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "server_utility/server_utility.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "server_utility/server_utility.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/server_utility_pb2_grpc.py b/mavsdk/server_utility_pb2_grpc.py index d06d1c16..a23acd9f 100644 --- a/mavsdk/server_utility_pb2_grpc.py +++ b/mavsdk/server_utility_pb2_grpc.py @@ -6,7 +6,7 @@ from . import server_utility_pb2 as server__utility_dot_server__utility__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in server_utility/server_utility_pb2_grpc.py depends on" + + " but the generated code in server_utility/server_utility_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ServerUtilityServiceStub(object): +class ServerUtilityServiceStub: """ Utility for onboard MAVSDK instances for common "server" tasks. """ @@ -48,7 +48,7 @@ def __init__(self, channel): ) -class ServerUtilityServiceServicer(object): +class ServerUtilityServiceServicer: """ Utility for onboard MAVSDK instances for common "server" tasks. """ @@ -78,7 +78,7 @@ def add_ServerUtilityServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ServerUtilityService(object): +class ServerUtilityService: """ Utility for onboard MAVSDK instances for common "server" tasks. """ diff --git a/mavsdk/shell_pb2.py b/mavsdk/shell_pb2.py index ae575834..29e83589 100644 --- a/mavsdk/shell_pb2.py +++ b/mavsdk/shell_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: shell/shell.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "shell/shell.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "shell/shell.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/shell_pb2_grpc.py b/mavsdk/shell_pb2_grpc.py index ca3202d6..b186112e 100644 --- a/mavsdk/shell_pb2_grpc.py +++ b/mavsdk/shell_pb2_grpc.py @@ -6,7 +6,7 @@ from . import shell_pb2 as shell_dot_shell__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in shell/shell_pb2_grpc.py depends on" + + " but the generated code in shell/shell_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class ShellServiceStub(object): +class ShellServiceStub: """ Allow to communicate with the vehicle's system shell. @@ -59,7 +59,7 @@ def __init__(self, channel): ) -class ShellServiceServicer(object): +class ShellServiceServicer: """ Allow to communicate with the vehicle's system shell. @@ -111,7 +111,7 @@ def add_ShellServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class ShellService(object): +class ShellService: """ Allow to communicate with the vehicle's system shell. diff --git a/mavsdk/source/plugins/index.rst b/mavsdk/source/plugins/index.rst index 03d87807..4dd81f26 100644 --- a/mavsdk/source/plugins/index.rst +++ b/mavsdk/source/plugins/index.rst @@ -43,3 +43,5 @@ Plugins events mavlink_direct mavlink_direct_server + modes + modes_server diff --git a/mavsdk/source/plugins/modes.rst b/mavsdk/source/plugins/modes.rst new file mode 100644 index 00000000..ac96c7e5 --- /dev/null +++ b/mavsdk/source/plugins/modes.rst @@ -0,0 +1,8 @@ +Modes +===== + +.. automodule:: mavsdk.modes + :members: + :undoc-members: + :show-inheritance: + :exclude-members: translate_from_rpc, translate_to_rpc \ No newline at end of file diff --git a/mavsdk/source/plugins/modes_server.rst b/mavsdk/source/plugins/modes_server.rst new file mode 100644 index 00000000..97ee00b2 --- /dev/null +++ b/mavsdk/source/plugins/modes_server.rst @@ -0,0 +1,8 @@ +ModesServer +=========== + +.. automodule:: mavsdk.modes_server + :members: + :undoc-members: + :show-inheritance: + :exclude-members: translate_from_rpc, translate_to_rpc \ No newline at end of file diff --git a/mavsdk/telemetry_pb2.py b/mavsdk/telemetry_pb2.py index 8f7e6724..825c3e24 100644 --- a/mavsdk/telemetry_pb2.py +++ b/mavsdk/telemetry_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: telemetry/telemetry.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "telemetry/telemetry.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "telemetry/telemetry.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/telemetry_pb2_grpc.py b/mavsdk/telemetry_pb2_grpc.py index 4f675e3f..8f82e759 100644 --- a/mavsdk/telemetry_pb2_grpc.py +++ b/mavsdk/telemetry_pb2_grpc.py @@ -6,7 +6,7 @@ from . import telemetry_pb2 as telemetry_dot_telemetry__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in telemetry/telemetry_pb2_grpc.py depends on" + + " but the generated code in telemetry/telemetry_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class TelemetryServiceStub(object): +class TelemetryServiceStub: """ Allow users to get vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. @@ -398,7 +398,7 @@ def __init__(self, channel): ) -class TelemetryServiceServicer(object): +class TelemetryServiceServicer: """ Allow users to get vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. @@ -1070,7 +1070,7 @@ def add_TelemetryServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class TelemetryService(object): +class TelemetryService: """ Allow users to get vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. diff --git a/mavsdk/telemetry_server_pb2.py b/mavsdk/telemetry_server_pb2.py index f8eec576..912cae7b 100644 --- a/mavsdk/telemetry_server_pb2.py +++ b/mavsdk/telemetry_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: telemetry_server/telemetry_server.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -13,8 +13,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 6, - 31, + 7, + 35, 1, "", "telemetry_server/telemetry_server.proto", diff --git a/mavsdk/telemetry_server_pb2_grpc.py b/mavsdk/telemetry_server_pb2_grpc.py index 5a5ef790..bb1f6fcd 100644 --- a/mavsdk/telemetry_server_pb2_grpc.py +++ b/mavsdk/telemetry_server_pb2_grpc.py @@ -6,7 +6,7 @@ from . import telemetry_server_pb2 as telemetry__server_dot_telemetry__server__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in telemetry_server/telemetry_server_pb2_grpc.py depends on" + + " but the generated code in telemetry_server/telemetry_server_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class TelemetryServerServiceStub(object): +class TelemetryServerServiceStub: """ Allow users to provide vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. @@ -145,7 +145,7 @@ def __init__(self, channel): ) -class TelemetryServerServiceServicer(object): +class TelemetryServerServiceServicer: """ Allow users to provide vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. @@ -352,7 +352,7 @@ def add_TelemetryServerServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class TelemetryServerService(object): +class TelemetryServerService: """ Allow users to provide vehicle telemetry and state information (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates. diff --git a/mavsdk/transponder_pb2.py b/mavsdk/transponder_pb2.py index c53a326a..5d2c3439 100644 --- a/mavsdk/transponder_pb2.py +++ b/mavsdk/transponder_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: transponder/transponder.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "transponder/transponder.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "transponder/transponder.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/transponder_pb2_grpc.py b/mavsdk/transponder_pb2_grpc.py index abb03b08..9b0a3f36 100644 --- a/mavsdk/transponder_pb2_grpc.py +++ b/mavsdk/transponder_pb2_grpc.py @@ -6,7 +6,7 @@ from . import transponder_pb2 as transponder_dot_transponder__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in transponder/transponder_pb2_grpc.py depends on" + + " but the generated code in transponder/transponder_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class TransponderServiceStub(object): +class TransponderServiceStub: """ Allow users to get ADS-B information and set ADS-B update rates. @@ -55,7 +55,7 @@ def __init__(self, channel): ) -class TransponderServiceServicer(object): +class TransponderServiceServicer: """ Allow users to get ADS-B information and set ADS-B update rates. @@ -97,7 +97,7 @@ def add_TransponderServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class TransponderService(object): +class TransponderService: """ Allow users to get ADS-B information and set ADS-B update rates. diff --git a/mavsdk/tune_pb2.py b/mavsdk/tune_pb2.py index b5579c97..781d34e8 100644 --- a/mavsdk/tune_pb2.py +++ b/mavsdk/tune_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tune/tune.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "tune/tune.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "tune/tune.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/tune_pb2_grpc.py b/mavsdk/tune_pb2_grpc.py index c6604708..44f20eed 100644 --- a/mavsdk/tune_pb2_grpc.py +++ b/mavsdk/tune_pb2_grpc.py @@ -6,7 +6,7 @@ from . import tune_pb2 as tune_dot_tune__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in tune/tune_pb2_grpc.py depends on" + + " but the generated code in tune/tune_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class TuneServiceStub(object): +class TuneServiceStub: """Enable creating and sending a tune to be played on the system.""" def __init__(self, channel): @@ -46,7 +46,7 @@ def __init__(self, channel): ) -class TuneServiceServicer(object): +class TuneServiceServicer: """Enable creating and sending a tune to be played on the system.""" def PlayTune(self, request, context): @@ -74,7 +74,7 @@ def add_TuneServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class TuneService(object): +class TuneService: """Enable creating and sending a tune to be played on the system.""" @staticmethod diff --git a/mavsdk/winch_pb2.py b/mavsdk/winch_pb2.py index 9ebbce01..7610931d 100644 --- a/mavsdk/winch_pb2.py +++ b/mavsdk/winch_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: winch/winch.proto -# Protobuf Python Version: 6.31.1 +# Protobuf Python Version: 7.35.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor @@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, 6, 31, 1, "", "winch/winch.proto" + _runtime_version.Domain.PUBLIC, 7, 35, 1, "", "winch/winch.proto" ) # @@protoc_insertion_point(imports) diff --git a/mavsdk/winch_pb2_grpc.py b/mavsdk/winch_pb2_grpc.py index 9b3033e4..941b388d 100644 --- a/mavsdk/winch_pb2_grpc.py +++ b/mavsdk/winch_pb2_grpc.py @@ -6,7 +6,7 @@ from . import winch_pb2 as winch_dot_winch__pb2 -GRPC_GENERATED_VERSION = "1.75.0" +GRPC_GENERATED_VERSION = "1.85.3" GRPC_VERSION = grpc.__version__ _version_not_supported = False @@ -22,14 +22,14 @@ if _version_not_supported: raise RuntimeError( f"The grpc package installed is at version {GRPC_VERSION}," - + f" but the generated code in winch/winch_pb2_grpc.py depends on" + + " but the generated code in winch/winch_pb2_grpc.py depends on" + f" grpcio>={GRPC_GENERATED_VERSION}." + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." ) -class WinchServiceStub(object): +class WinchServiceStub: """ Allows users to send winch actions, as well as receive status information from winch systems. @@ -109,7 +109,7 @@ def __init__(self, channel): ) -class WinchServiceServicer(object): +class WinchServiceServicer: """ Allows users to send winch actions, as well as receive status information from winch systems. @@ -272,7 +272,7 @@ def add_WinchServiceServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. -class WinchService(object): +class WinchService: """ Allows users to send winch actions, as well as receive status information from winch systems. diff --git a/proto b/proto index d69ec1a3..df90b7eb 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit d69ec1a32a89088a04c591ae37a2e4a10b18fe5a +Subproject commit df90b7ebba3c9c73d2e43c87885709fd34c7eb25