From ca700fb80652776bdfab75331027e11bbc081058 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 11 Feb 2026 14:24:30 +1300 Subject: [PATCH] Update to MAVSDK v3.15.0 --- MAVSDK_SERVER_VERSION | 2 +- mavsdk/action.py | 110 +++++++++++++++++++++++++++ mavsdk/action_pb2.py | 90 +++++++++++++--------- mavsdk/action_pb2_grpc.py | 103 +++++++++++++++++++++++++ mavsdk/action_server.py | 73 +++++++++++++++++- mavsdk/action_server_pb2.py | 124 +++++++++++++++++-------------- mavsdk/action_server_pb2_grpc.py | 47 ++++++++++++ mavsdk/param.py | 64 ++++++++++++++++ mavsdk/param_pb2.py | 14 ++-- mavsdk/param_server.py | 23 ++++++ mavsdk/param_server_pb2.py | 10 +-- mavsdk/param_server_pb2_grpc.py | 13 ++++ proto | 2 +- 13 files changed, 566 insertions(+), 109 deletions(-) diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index fbc2e548..64d4aab1 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1 +1 @@ -v3.10.2 +v3.15.0 diff --git a/mavsdk/action.py b/mavsdk/action.py index bd5548d3..29c15d9f 100644 --- a/mavsdk/action.py +++ b/mavsdk/action.py @@ -65,6 +65,41 @@ def __str__(self): return self.name +class RelayCommand(Enum): + """ + Commanded values for relays + + Values + ------ + ON + Turn the relay off + + OFF + Turn the relay on. + + """ + + ON = 0 + OFF = 1 + + def translate_to_rpc(self): + if self == RelayCommand.ON: + return action_pb2.RELAY_COMMAND_ON + if self == RelayCommand.OFF: + return action_pb2.RELAY_COMMAND_OFF + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """Parses a gRPC response""" + if rpc_enum_value == action_pb2.RELAY_COMMAND_ON: + return RelayCommand.ON + if rpc_enum_value == action_pb2.RELAY_COMMAND_OFF: + return RelayCommand.OFF + + def __str__(self): + return self.name + + class ActionResult: """ Result type. @@ -684,6 +719,39 @@ async def set_actuator(self, index, value): if result.result != ActionResult.Result.SUCCESS: raise ActionError(result, "set_actuator()", index, value) + async def set_relay(self, index, setting): + """ + Send command to set the value of a relay. + + The index of the relay starts at 0. + For the relay value, 1=on, 0=off, others possible depending on system hardware + + Parameters + ---------- + index : int32_t + Index of relay (starting with 0) + + setting : RelayCommand + Value to set the relay to + + Raises + ------ + ActionError + If the request fails. The error contains the reason for the failure. + """ + + request = action_pb2.SetRelayRequest() + request.index = index + + request.setting = setting.translate_to_rpc() + + response = await self._stub.SetRelay(request) + + result = self._extract_result(response) + + if result.result != ActionResult.Result.SUCCESS: + raise ActionError(result, "set_relay()", index, setting) + async def transition_to_fixedwing(self): """ Send command to transition the drone to fixedwing. @@ -854,3 +922,45 @@ async def set_current_speed(self, speed_m_s): if result.result != ActionResult.Result.SUCCESS: raise ActionError(result, "set_current_speed()", speed_m_s) + + async def set_gps_global_origin( + self, latitude_deg, longitude_deg, absolute_altitude_m + ): + """ + Set GPS Global Origin. + + Sets the GPS coordinates of the vehicle local origin (0,0,0) position. + + Parameters + ---------- + latitude_deg : double + Latitude (in degrees) + + longitude_deg : double + Longitude (in degrees) + + absolute_altitude_m : float + Altitude AMSL (in meters) + + Raises + ------ + ActionError + If the request fails. The error contains the reason for the failure. + """ + + request = action_pb2.SetGpsGlobalOriginRequest() + request.latitude_deg = latitude_deg + request.longitude_deg = longitude_deg + request.absolute_altitude_m = absolute_altitude_m + response = await self._stub.SetGpsGlobalOrigin(request) + + result = self._extract_result(response) + + if result.result != ActionResult.Result.SUCCESS: + raise ActionError( + result, + "set_gps_global_origin()", + latitude_deg, + longitude_deg, + absolute_altitude_m, + ) diff --git a/mavsdk/action_pb2.py b/mavsdk/action_pb2.py index 0e03494d..1e8ca3e2 100644 --- a/mavsdk/action_pb2.py +++ b/mavsdk/action_pb2.py @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x13\x61\x63tion/action.proto\x12\x11mavsdk.rpc.action\x1a\x14mavsdk_options.proto"\x0c\n\nArmRequest"E\n\x0b\x41rmResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x11\n\x0f\x41rmForceRequest"J\n\x10\x41rmForceResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x0f\n\rDisarmRequest"H\n\x0e\x44isarmResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x10\n\x0eTakeoffRequest"I\n\x0fTakeoffResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bLandRequest"F\n\x0cLandResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x0f\n\rRebootRequest"H\n\x0eRebootResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x11\n\x0fShutdownRequest"J\n\x10ShutdownResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x12\n\x10TerminateRequest"K\n\x11TerminateResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bKillRequest"F\n\x0cKillResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x17\n\x15ReturnToLaunchRequest"P\n\x16ReturnToLaunchResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"p\n\x13GotoLocationRequest\x12\x14\n\x0clatitude_deg\x18\x01 \x01(\x01\x12\x15\n\rlongitude_deg\x18\x02 \x01(\x01\x12\x1b\n\x13\x61\x62solute_altitude_m\x18\x03 \x01(\x02\x12\x0f\n\x07yaw_deg\x18\x04 \x01(\x02"N\n\x14GotoLocationResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\xd7\x01\n\x0e\x44oOrbitRequest\x12\x10\n\x08radius_m\x18\x01 \x01(\x02\x12\x13\n\x0bvelocity_ms\x18\x02 \x01(\x02\x12\x39\n\x0cyaw_behavior\x18\x03 \x01(\x0e\x32#.mavsdk.rpc.action.OrbitYawBehavior\x12\x1d\n\x0clatitude_deg\x18\x05 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN\x12\x1e\n\rlongitude_deg\x18\x06 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN\x12$\n\x13\x61\x62solute_altitude_m\x18\x07 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN"I\n\x0f\x44oOrbitResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bHoldRequest"F\n\x0cHoldResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"2\n\x12SetActuatorRequest\x12\r\n\x05index\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x02"M\n\x13SetActuatorResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x1e\n\x1cTransitionToFixedwingRequest"W\n\x1dTransitionToFixedwingResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult" \n\x1eTransitionToMulticopterRequest"Y\n\x1fTransitionToMulticopterResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x1b\n\x19GetTakeoffAltitudeRequest"f\n\x1aGetTakeoffAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\x10\n\x08\x61ltitude\x18\x02 \x01(\x02"-\n\x19SetTakeoffAltitudeRequest\x12\x10\n\x08\x61ltitude\x18\x01 \x01(\x02"T\n\x1aSetTakeoffAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult""\n GetReturnToLaunchAltitudeRequest"x\n!GetReturnToLaunchAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\x1b\n\x13relative_altitude_m\x18\x02 \x01(\x02"?\n SetReturnToLaunchAltitudeRequest\x12\x1b\n\x13relative_altitude_m\x18\x01 \x01(\x02"[\n!SetReturnToLaunchAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"+\n\x16SetCurrentSpeedRequest\x12\x11\n\tspeed_m_s\x18\x01 \x01(\x02"Q\n\x17SetCurrentSpeedResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x8d\x04\n\x0c\x41\x63tionResult\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.mavsdk.rpc.action.ActionResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xb0\x03\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\x16\n\x12RESULT_UNSUPPORTED\x10\x0c\x12\x11\n\rRESULT_FAILED\x10\r\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x0e*\xf3\x01\n\x10OrbitYawBehavior\x12\x32\n.ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TO_CIRCLE_CENTER\x10\x00\x12+\n\'ORBIT_YAW_BEHAVIOR_HOLD_INITIAL_HEADING\x10\x01\x12#\n\x1fORBIT_YAW_BEHAVIOR_UNCONTROLLED\x10\x02\x12\x33\n/ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TANGENT_TO_CIRCLE\x10\x03\x12$\n ORBIT_YAW_BEHAVIOR_RC_CONTROLLED\x10\x04\x32\xa5\x10\n\rActionService\x12\x46\n\x03\x41rm\x12\x1d.mavsdk.rpc.action.ArmRequest\x1a\x1e.mavsdk.rpc.action.ArmResponse"\x00\x12U\n\x08\x41rmForce\x12".mavsdk.rpc.action.ArmForceRequest\x1a#.mavsdk.rpc.action.ArmForceResponse"\x00\x12O\n\x06\x44isarm\x12 .mavsdk.rpc.action.DisarmRequest\x1a!.mavsdk.rpc.action.DisarmResponse"\x00\x12R\n\x07Takeoff\x12!.mavsdk.rpc.action.TakeoffRequest\x1a".mavsdk.rpc.action.TakeoffResponse"\x00\x12I\n\x04Land\x12\x1e.mavsdk.rpc.action.LandRequest\x1a\x1f.mavsdk.rpc.action.LandResponse"\x00\x12O\n\x06Reboot\x12 .mavsdk.rpc.action.RebootRequest\x1a!.mavsdk.rpc.action.RebootResponse"\x00\x12U\n\x08Shutdown\x12".mavsdk.rpc.action.ShutdownRequest\x1a#.mavsdk.rpc.action.ShutdownResponse"\x00\x12X\n\tTerminate\x12#.mavsdk.rpc.action.TerminateRequest\x1a$.mavsdk.rpc.action.TerminateResponse"\x00\x12I\n\x04Kill\x12\x1e.mavsdk.rpc.action.KillRequest\x1a\x1f.mavsdk.rpc.action.KillResponse"\x00\x12g\n\x0eReturnToLaunch\x12(.mavsdk.rpc.action.ReturnToLaunchRequest\x1a).mavsdk.rpc.action.ReturnToLaunchResponse"\x00\x12\x61\n\x0cGotoLocation\x12&.mavsdk.rpc.action.GotoLocationRequest\x1a\'.mavsdk.rpc.action.GotoLocationResponse"\x00\x12R\n\x07\x44oOrbit\x12!.mavsdk.rpc.action.DoOrbitRequest\x1a".mavsdk.rpc.action.DoOrbitResponse"\x00\x12I\n\x04Hold\x12\x1e.mavsdk.rpc.action.HoldRequest\x1a\x1f.mavsdk.rpc.action.HoldResponse"\x00\x12^\n\x0bSetActuator\x12%.mavsdk.rpc.action.SetActuatorRequest\x1a&.mavsdk.rpc.action.SetActuatorResponse"\x00\x12|\n\x15TransitionToFixedwing\x12/.mavsdk.rpc.action.TransitionToFixedwingRequest\x1a\x30.mavsdk.rpc.action.TransitionToFixedwingResponse"\x00\x12\x82\x01\n\x17TransitionToMulticopter\x12\x31.mavsdk.rpc.action.TransitionToMulticopterRequest\x1a\x32.mavsdk.rpc.action.TransitionToMulticopterResponse"\x00\x12s\n\x12GetTakeoffAltitude\x12,.mavsdk.rpc.action.GetTakeoffAltitudeRequest\x1a-.mavsdk.rpc.action.GetTakeoffAltitudeResponse"\x00\x12s\n\x12SetTakeoffAltitude\x12,.mavsdk.rpc.action.SetTakeoffAltitudeRequest\x1a-.mavsdk.rpc.action.SetTakeoffAltitudeResponse"\x00\x12\x88\x01\n\x19GetReturnToLaunchAltitude\x12\x33.mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest\x1a\x34.mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse"\x00\x12\x88\x01\n\x19SetReturnToLaunchAltitude\x12\x33.mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest\x1a\x34.mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse"\x00\x12j\n\x0fSetCurrentSpeed\x12).mavsdk.rpc.action.SetCurrentSpeedRequest\x1a*.mavsdk.rpc.action.SetCurrentSpeedResponse"\x00\x42\x1f\n\x10io.mavsdk.actionB\x0b\x41\x63tionProtob\x06proto3' + b'\n\x13\x61\x63tion/action.proto\x12\x11mavsdk.rpc.action\x1a\x14mavsdk_options.proto"\x0c\n\nArmRequest"E\n\x0b\x41rmResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x11\n\x0f\x41rmForceRequest"J\n\x10\x41rmForceResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x0f\n\rDisarmRequest"H\n\x0e\x44isarmResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x10\n\x0eTakeoffRequest"I\n\x0fTakeoffResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bLandRequest"F\n\x0cLandResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x0f\n\rRebootRequest"H\n\x0eRebootResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x11\n\x0fShutdownRequest"J\n\x10ShutdownResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x12\n\x10TerminateRequest"K\n\x11TerminateResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bKillRequest"F\n\x0cKillResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x17\n\x15ReturnToLaunchRequest"P\n\x16ReturnToLaunchResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"p\n\x13GotoLocationRequest\x12\x14\n\x0clatitude_deg\x18\x01 \x01(\x01\x12\x15\n\rlongitude_deg\x18\x02 \x01(\x01\x12\x1b\n\x13\x61\x62solute_altitude_m\x18\x03 \x01(\x02\x12\x0f\n\x07yaw_deg\x18\x04 \x01(\x02"N\n\x14GotoLocationResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\xd7\x01\n\x0e\x44oOrbitRequest\x12\x10\n\x08radius_m\x18\x01 \x01(\x02\x12\x13\n\x0bvelocity_ms\x18\x02 \x01(\x02\x12\x39\n\x0cyaw_behavior\x18\x03 \x01(\x0e\x32#.mavsdk.rpc.action.OrbitYawBehavior\x12\x1d\n\x0clatitude_deg\x18\x05 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN\x12\x1e\n\rlongitude_deg\x18\x06 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN\x12$\n\x13\x61\x62solute_altitude_m\x18\x07 \x01(\x01\x42\x07\x82\xb5\x18\x03NaN"I\n\x0f\x44oOrbitResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\r\n\x0bHoldRequest"F\n\x0cHoldResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"2\n\x12SetActuatorRequest\x12\r\n\x05index\x18\x01 \x01(\x05\x12\r\n\x05value\x18\x02 \x01(\x02"M\n\x13SetActuatorResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"R\n\x0fSetRelayRequest\x12\r\n\x05index\x18\x01 \x01(\x05\x12\x30\n\x07setting\x18\x02 \x01(\x0e\x32\x1f.mavsdk.rpc.action.RelayCommand"J\n\x10SetRelayResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x1e\n\x1cTransitionToFixedwingRequest"W\n\x1dTransitionToFixedwingResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult" \n\x1eTransitionToMulticopterRequest"Y\n\x1fTransitionToMulticopterResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x1b\n\x19GetTakeoffAltitudeRequest"f\n\x1aGetTakeoffAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\x10\n\x08\x61ltitude\x18\x02 \x01(\x02"-\n\x19SetTakeoffAltitudeRequest\x12\x10\n\x08\x61ltitude\x18\x01 \x01(\x02"T\n\x1aSetTakeoffAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult""\n GetReturnToLaunchAltitudeRequest"x\n!GetReturnToLaunchAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\x1b\n\x13relative_altitude_m\x18\x02 \x01(\x02"?\n SetReturnToLaunchAltitudeRequest\x12\x1b\n\x13relative_altitude_m\x18\x01 \x01(\x02"[\n!SetReturnToLaunchAltitudeResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"+\n\x16SetCurrentSpeedRequest\x12\x11\n\tspeed_m_s\x18\x01 \x01(\x02"Q\n\x17SetCurrentSpeedResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"e\n\x19SetGpsGlobalOriginRequest\x12\x14\n\x0clatitude_deg\x18\x01 \x01(\x01\x12\x15\n\rlongitude_deg\x18\x02 \x01(\x01\x12\x1b\n\x13\x61\x62solute_altitude_m\x18\x03 \x01(\x02"T\n\x1aSetGpsGlobalOriginResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult"\x8d\x04\n\x0c\x41\x63tionResult\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.mavsdk.rpc.action.ActionResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xb0\x03\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\x16\n\x12RESULT_UNSUPPORTED\x10\x0c\x12\x11\n\rRESULT_FAILED\x10\r\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x0e*\xf3\x01\n\x10OrbitYawBehavior\x12\x32\n.ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TO_CIRCLE_CENTER\x10\x00\x12+\n\'ORBIT_YAW_BEHAVIOR_HOLD_INITIAL_HEADING\x10\x01\x12#\n\x1fORBIT_YAW_BEHAVIOR_UNCONTROLLED\x10\x02\x12\x33\n/ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TANGENT_TO_CIRCLE\x10\x03\x12$\n ORBIT_YAW_BEHAVIOR_RC_CONTROLLED\x10\x04*;\n\x0cRelayCommand\x12\x14\n\x10RELAY_COMMAND_ON\x10\x00\x12\x15\n\x11RELAY_COMMAND_OFF\x10\x01\x32\xf5\x11\n\rActionService\x12\x46\n\x03\x41rm\x12\x1d.mavsdk.rpc.action.ArmRequest\x1a\x1e.mavsdk.rpc.action.ArmResponse"\x00\x12U\n\x08\x41rmForce\x12".mavsdk.rpc.action.ArmForceRequest\x1a#.mavsdk.rpc.action.ArmForceResponse"\x00\x12O\n\x06\x44isarm\x12 .mavsdk.rpc.action.DisarmRequest\x1a!.mavsdk.rpc.action.DisarmResponse"\x00\x12R\n\x07Takeoff\x12!.mavsdk.rpc.action.TakeoffRequest\x1a".mavsdk.rpc.action.TakeoffResponse"\x00\x12I\n\x04Land\x12\x1e.mavsdk.rpc.action.LandRequest\x1a\x1f.mavsdk.rpc.action.LandResponse"\x00\x12O\n\x06Reboot\x12 .mavsdk.rpc.action.RebootRequest\x1a!.mavsdk.rpc.action.RebootResponse"\x00\x12U\n\x08Shutdown\x12".mavsdk.rpc.action.ShutdownRequest\x1a#.mavsdk.rpc.action.ShutdownResponse"\x00\x12X\n\tTerminate\x12#.mavsdk.rpc.action.TerminateRequest\x1a$.mavsdk.rpc.action.TerminateResponse"\x00\x12I\n\x04Kill\x12\x1e.mavsdk.rpc.action.KillRequest\x1a\x1f.mavsdk.rpc.action.KillResponse"\x00\x12g\n\x0eReturnToLaunch\x12(.mavsdk.rpc.action.ReturnToLaunchRequest\x1a).mavsdk.rpc.action.ReturnToLaunchResponse"\x00\x12\x61\n\x0cGotoLocation\x12&.mavsdk.rpc.action.GotoLocationRequest\x1a\'.mavsdk.rpc.action.GotoLocationResponse"\x00\x12R\n\x07\x44oOrbit\x12!.mavsdk.rpc.action.DoOrbitRequest\x1a".mavsdk.rpc.action.DoOrbitResponse"\x00\x12I\n\x04Hold\x12\x1e.mavsdk.rpc.action.HoldRequest\x1a\x1f.mavsdk.rpc.action.HoldResponse"\x00\x12^\n\x0bSetActuator\x12%.mavsdk.rpc.action.SetActuatorRequest\x1a&.mavsdk.rpc.action.SetActuatorResponse"\x00\x12U\n\x08SetRelay\x12".mavsdk.rpc.action.SetRelayRequest\x1a#.mavsdk.rpc.action.SetRelayResponse"\x00\x12|\n\x15TransitionToFixedwing\x12/.mavsdk.rpc.action.TransitionToFixedwingRequest\x1a\x30.mavsdk.rpc.action.TransitionToFixedwingResponse"\x00\x12\x82\x01\n\x17TransitionToMulticopter\x12\x31.mavsdk.rpc.action.TransitionToMulticopterRequest\x1a\x32.mavsdk.rpc.action.TransitionToMulticopterResponse"\x00\x12s\n\x12GetTakeoffAltitude\x12,.mavsdk.rpc.action.GetTakeoffAltitudeRequest\x1a-.mavsdk.rpc.action.GetTakeoffAltitudeResponse"\x00\x12s\n\x12SetTakeoffAltitude\x12,.mavsdk.rpc.action.SetTakeoffAltitudeRequest\x1a-.mavsdk.rpc.action.SetTakeoffAltitudeResponse"\x00\x12\x88\x01\n\x19GetReturnToLaunchAltitude\x12\x33.mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest\x1a\x34.mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse"\x00\x12\x88\x01\n\x19SetReturnToLaunchAltitude\x12\x33.mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest\x1a\x34.mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse"\x00\x12j\n\x0fSetCurrentSpeed\x12).mavsdk.rpc.action.SetCurrentSpeedRequest\x1a*.mavsdk.rpc.action.SetCurrentSpeedResponse"\x00\x12w\n\x12SetGpsGlobalOrigin\x12,.mavsdk.rpc.action.SetGpsGlobalOriginRequest\x1a-.mavsdk.rpc.action.SetGpsGlobalOriginResponse"\x04\x80\xb5\x18\x01\x42\x1f\n\x10io.mavsdk.actionB\x0b\x41\x63tionProtob\x06proto3' ) _globals = globals() @@ -48,8 +48,16 @@ _globals["_DOORBITREQUEST"].fields_by_name[ "absolute_altitude_m" ]._serialized_options = b"\202\265\030\003NaN" - _globals["_ORBITYAWBEHAVIOR"]._serialized_start = 3182 - _globals["_ORBITYAWBEHAVIOR"]._serialized_end = 3425 + _globals["_ACTIONSERVICE"].methods_by_name[ + "SetGpsGlobalOrigin" + ]._loaded_options = None + _globals["_ACTIONSERVICE"].methods_by_name[ + "SetGpsGlobalOrigin" + ]._serialized_options = b"\200\265\030\001" + _globals["_ORBITYAWBEHAVIOR"]._serialized_start = 3531 + _globals["_ORBITYAWBEHAVIOR"]._serialized_end = 3774 + _globals["_RELAYCOMMAND"]._serialized_start = 3776 + _globals["_RELAYCOMMAND"]._serialized_end = 3835 _globals["_ARMREQUEST"]._serialized_start = 64 _globals["_ARMREQUEST"]._serialized_end = 76 _globals["_ARMRESPONSE"]._serialized_start = 78 @@ -106,38 +114,46 @@ _globals["_SETACTUATORREQUEST"]._serialized_end = 1616 _globals["_SETACTUATORRESPONSE"]._serialized_start = 1618 _globals["_SETACTUATORRESPONSE"]._serialized_end = 1695 - _globals["_TRANSITIONTOFIXEDWINGREQUEST"]._serialized_start = 1697 - _globals["_TRANSITIONTOFIXEDWINGREQUEST"]._serialized_end = 1727 - _globals["_TRANSITIONTOFIXEDWINGRESPONSE"]._serialized_start = 1729 - _globals["_TRANSITIONTOFIXEDWINGRESPONSE"]._serialized_end = 1816 - _globals["_TRANSITIONTOMULTICOPTERREQUEST"]._serialized_start = 1818 - _globals["_TRANSITIONTOMULTICOPTERREQUEST"]._serialized_end = 1850 - _globals["_TRANSITIONTOMULTICOPTERRESPONSE"]._serialized_start = 1852 - _globals["_TRANSITIONTOMULTICOPTERRESPONSE"]._serialized_end = 1941 - _globals["_GETTAKEOFFALTITUDEREQUEST"]._serialized_start = 1943 - _globals["_GETTAKEOFFALTITUDEREQUEST"]._serialized_end = 1970 - _globals["_GETTAKEOFFALTITUDERESPONSE"]._serialized_start = 1972 - _globals["_GETTAKEOFFALTITUDERESPONSE"]._serialized_end = 2074 - _globals["_SETTAKEOFFALTITUDEREQUEST"]._serialized_start = 2076 - _globals["_SETTAKEOFFALTITUDEREQUEST"]._serialized_end = 2121 - _globals["_SETTAKEOFFALTITUDERESPONSE"]._serialized_start = 2123 - _globals["_SETTAKEOFFALTITUDERESPONSE"]._serialized_end = 2207 - _globals["_GETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_start = 2209 - _globals["_GETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_end = 2243 - _globals["_GETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_start = 2245 - _globals["_GETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_end = 2365 - _globals["_SETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_start = 2367 - _globals["_SETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_end = 2430 - _globals["_SETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_start = 2432 - _globals["_SETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_end = 2523 - _globals["_SETCURRENTSPEEDREQUEST"]._serialized_start = 2525 - _globals["_SETCURRENTSPEEDREQUEST"]._serialized_end = 2568 - _globals["_SETCURRENTSPEEDRESPONSE"]._serialized_start = 2570 - _globals["_SETCURRENTSPEEDRESPONSE"]._serialized_end = 2651 - _globals["_ACTIONRESULT"]._serialized_start = 2654 - _globals["_ACTIONRESULT"]._serialized_end = 3179 - _globals["_ACTIONRESULT_RESULT"]._serialized_start = 2747 - _globals["_ACTIONRESULT_RESULT"]._serialized_end = 3179 - _globals["_ACTIONSERVICE"]._serialized_start = 3428 - _globals["_ACTIONSERVICE"]._serialized_end = 5513 + _globals["_SETRELAYREQUEST"]._serialized_start = 1697 + _globals["_SETRELAYREQUEST"]._serialized_end = 1779 + _globals["_SETRELAYRESPONSE"]._serialized_start = 1781 + _globals["_SETRELAYRESPONSE"]._serialized_end = 1855 + _globals["_TRANSITIONTOFIXEDWINGREQUEST"]._serialized_start = 1857 + _globals["_TRANSITIONTOFIXEDWINGREQUEST"]._serialized_end = 1887 + _globals["_TRANSITIONTOFIXEDWINGRESPONSE"]._serialized_start = 1889 + _globals["_TRANSITIONTOFIXEDWINGRESPONSE"]._serialized_end = 1976 + _globals["_TRANSITIONTOMULTICOPTERREQUEST"]._serialized_start = 1978 + _globals["_TRANSITIONTOMULTICOPTERREQUEST"]._serialized_end = 2010 + _globals["_TRANSITIONTOMULTICOPTERRESPONSE"]._serialized_start = 2012 + _globals["_TRANSITIONTOMULTICOPTERRESPONSE"]._serialized_end = 2101 + _globals["_GETTAKEOFFALTITUDEREQUEST"]._serialized_start = 2103 + _globals["_GETTAKEOFFALTITUDEREQUEST"]._serialized_end = 2130 + _globals["_GETTAKEOFFALTITUDERESPONSE"]._serialized_start = 2132 + _globals["_GETTAKEOFFALTITUDERESPONSE"]._serialized_end = 2234 + _globals["_SETTAKEOFFALTITUDEREQUEST"]._serialized_start = 2236 + _globals["_SETTAKEOFFALTITUDEREQUEST"]._serialized_end = 2281 + _globals["_SETTAKEOFFALTITUDERESPONSE"]._serialized_start = 2283 + _globals["_SETTAKEOFFALTITUDERESPONSE"]._serialized_end = 2367 + _globals["_GETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_start = 2369 + _globals["_GETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_end = 2403 + _globals["_GETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_start = 2405 + _globals["_GETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_end = 2525 + _globals["_SETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_start = 2527 + _globals["_SETRETURNTOLAUNCHALTITUDEREQUEST"]._serialized_end = 2590 + _globals["_SETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_start = 2592 + _globals["_SETRETURNTOLAUNCHALTITUDERESPONSE"]._serialized_end = 2683 + _globals["_SETCURRENTSPEEDREQUEST"]._serialized_start = 2685 + _globals["_SETCURRENTSPEEDREQUEST"]._serialized_end = 2728 + _globals["_SETCURRENTSPEEDRESPONSE"]._serialized_start = 2730 + _globals["_SETCURRENTSPEEDRESPONSE"]._serialized_end = 2811 + _globals["_SETGPSGLOBALORIGINREQUEST"]._serialized_start = 2813 + _globals["_SETGPSGLOBALORIGINREQUEST"]._serialized_end = 2914 + _globals["_SETGPSGLOBALORIGINRESPONSE"]._serialized_start = 2916 + _globals["_SETGPSGLOBALORIGINRESPONSE"]._serialized_end = 3000 + _globals["_ACTIONRESULT"]._serialized_start = 3003 + _globals["_ACTIONRESULT"]._serialized_end = 3528 + _globals["_ACTIONRESULT_RESULT"]._serialized_start = 3096 + _globals["_ACTIONRESULT_RESULT"]._serialized_end = 3528 + _globals["_ACTIONSERVICE"]._serialized_start = 3838 + _globals["_ACTIONSERVICE"]._serialized_end = 6131 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/action_pb2_grpc.py b/mavsdk/action_pb2_grpc.py index bdc11456..5116ad12 100644 --- a/mavsdk/action_pb2_grpc.py +++ b/mavsdk/action_pb2_grpc.py @@ -122,6 +122,12 @@ def __init__(self, channel): response_deserializer=action_dot_action__pb2.SetActuatorResponse.FromString, _registered_method=True, ) + self.SetRelay = channel.unary_unary( + "/mavsdk.rpc.action.ActionService/SetRelay", + request_serializer=action_dot_action__pb2.SetRelayRequest.SerializeToString, + response_deserializer=action_dot_action__pb2.SetRelayResponse.FromString, + _registered_method=True, + ) self.TransitionToFixedwing = channel.unary_unary( "/mavsdk.rpc.action.ActionService/TransitionToFixedwing", request_serializer=action_dot_action__pb2.TransitionToFixedwingRequest.SerializeToString, @@ -164,6 +170,12 @@ def __init__(self, channel): response_deserializer=action_dot_action__pb2.SetCurrentSpeedResponse.FromString, _registered_method=True, ) + self.SetGpsGlobalOrigin = channel.unary_unary( + "/mavsdk.rpc.action.ActionService/SetGpsGlobalOrigin", + request_serializer=action_dot_action__pb2.SetGpsGlobalOriginRequest.SerializeToString, + response_deserializer=action_dot_action__pb2.SetGpsGlobalOriginResponse.FromString, + _registered_method=True, + ) class ActionServiceServicer(object): @@ -329,6 +341,17 @@ def SetActuator(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def SetRelay(self, request, context): + """ + Send command to set the value of a relay. + + The index of the relay starts at 0. + For the relay value, 1=on, 0=off, others possible depending on system hardware + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def TransitionToFixedwing(self, request, context): """ Send command to transition the drone to fixedwing. @@ -396,6 +419,16 @@ def SetCurrentSpeed(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def SetGpsGlobalOrigin(self, request, context): + """ + Set GPS Global Origin. + + Sets the GPS coordinates of the vehicle local origin (0,0,0) position. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_ActionServiceServicer_to_server(servicer, server): rpc_method_handlers = { @@ -469,6 +502,11 @@ def add_ActionServiceServicer_to_server(servicer, server): request_deserializer=action_dot_action__pb2.SetActuatorRequest.FromString, response_serializer=action_dot_action__pb2.SetActuatorResponse.SerializeToString, ), + "SetRelay": grpc.unary_unary_rpc_method_handler( + servicer.SetRelay, + request_deserializer=action_dot_action__pb2.SetRelayRequest.FromString, + response_serializer=action_dot_action__pb2.SetRelayResponse.SerializeToString, + ), "TransitionToFixedwing": grpc.unary_unary_rpc_method_handler( servicer.TransitionToFixedwing, request_deserializer=action_dot_action__pb2.TransitionToFixedwingRequest.FromString, @@ -504,6 +542,11 @@ def add_ActionServiceServicer_to_server(servicer, server): request_deserializer=action_dot_action__pb2.SetCurrentSpeedRequest.FromString, response_serializer=action_dot_action__pb2.SetCurrentSpeedResponse.SerializeToString, ), + "SetGpsGlobalOrigin": grpc.unary_unary_rpc_method_handler( + servicer.SetGpsGlobalOrigin, + request_deserializer=action_dot_action__pb2.SetGpsGlobalOriginRequest.FromString, + response_serializer=action_dot_action__pb2.SetGpsGlobalOriginResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "mavsdk.rpc.action.ActionService", rpc_method_handlers @@ -938,6 +981,36 @@ def SetActuator( _registered_method=True, ) + @staticmethod + def SetRelay( + 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.action.ActionService/SetRelay", + action_dot_action__pb2.SetRelayRequest.SerializeToString, + action_dot_action__pb2.SetRelayResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + @staticmethod def TransitionToFixedwing( request, @@ -1147,3 +1220,33 @@ def SetCurrentSpeed( metadata, _registered_method=True, ) + + @staticmethod + def SetGpsGlobalOrigin( + 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.action.ActionService/SetGpsGlobalOrigin", + action_dot_action__pb2.SetGpsGlobalOriginRequest.SerializeToString, + action_dot_action__pb2.SetGpsGlobalOriginResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/action_server.py b/mavsdk/action_server.py index 3b09c946..a2bac6df 100644 --- a/mavsdk/action_server.py +++ b/mavsdk/action_server.py @@ -156,13 +156,38 @@ class AllowableFlightModes: can_stabilize_mode : bool Stabilize mode + can_auto_rtl_mode : bool + Auto RTL mode + + can_auto_takeoff_mode : bool + Auto takeoff mode + + can_auto_land_mode : bool + Auto land mode + + can_auto_loiter_mode : bool + Auto hold/loiter mode + """ - def __init__(self, can_auto_mode, can_guided_mode, can_stabilize_mode): + def __init__( + self, + can_auto_mode, + can_guided_mode, + can_stabilize_mode, + can_auto_rtl_mode, + can_auto_takeoff_mode, + can_auto_land_mode, + can_auto_loiter_mode, + ): """Initializes the AllowableFlightModes object""" self.can_auto_mode = can_auto_mode self.can_guided_mode = can_guided_mode self.can_stabilize_mode = can_stabilize_mode + self.can_auto_rtl_mode = can_auto_rtl_mode + self.can_auto_takeoff_mode = can_auto_takeoff_mode + self.can_auto_land_mode = can_auto_land_mode + self.can_auto_loiter_mode = can_auto_loiter_mode def __eq__(self, to_compare): """Checks if two AllowableFlightModes are the same""" @@ -173,6 +198,10 @@ def __eq__(self, to_compare): (self.can_auto_mode == to_compare.can_auto_mode) and (self.can_guided_mode == to_compare.can_guided_mode) and (self.can_stabilize_mode == to_compare.can_stabilize_mode) + and (self.can_auto_rtl_mode == to_compare.can_auto_rtl_mode) + and (self.can_auto_takeoff_mode == to_compare.can_auto_takeoff_mode) + and (self.can_auto_land_mode == to_compare.can_auto_land_mode) + and (self.can_auto_loiter_mode == to_compare.can_auto_loiter_mode) ) except AttributeError: @@ -185,6 +214,10 @@ def __str__(self): "can_auto_mode: " + str(self.can_auto_mode), "can_guided_mode: " + str(self.can_guided_mode), "can_stabilize_mode: " + str(self.can_stabilize_mode), + "can_auto_rtl_mode: " + str(self.can_auto_rtl_mode), + "can_auto_takeoff_mode: " + str(self.can_auto_takeoff_mode), + "can_auto_land_mode: " + str(self.can_auto_land_mode), + "can_auto_loiter_mode: " + str(self.can_auto_loiter_mode), ] ) @@ -197,6 +230,10 @@ def translate_from_rpc(rpcAllowableFlightModes): rpcAllowableFlightModes.can_auto_mode, rpcAllowableFlightModes.can_guided_mode, rpcAllowableFlightModes.can_stabilize_mode, + rpcAllowableFlightModes.can_auto_rtl_mode, + rpcAllowableFlightModes.can_auto_takeoff_mode, + rpcAllowableFlightModes.can_auto_land_mode, + rpcAllowableFlightModes.can_auto_loiter_mode, ) def translate_to_rpc(self, rpcAllowableFlightModes): @@ -208,6 +245,14 @@ def translate_to_rpc(self, rpcAllowableFlightModes): rpcAllowableFlightModes.can_stabilize_mode = self.can_stabilize_mode + rpcAllowableFlightModes.can_auto_rtl_mode = self.can_auto_rtl_mode + + rpcAllowableFlightModes.can_auto_takeoff_mode = self.can_auto_takeoff_mode + + rpcAllowableFlightModes.can_auto_land_mode = self.can_auto_land_mode + + rpcAllowableFlightModes.can_auto_loiter_mode = self.can_auto_loiter_mode + class ArmDisarm: """ @@ -925,3 +970,29 @@ async def set_flight_mode(self, flight_mode): if result.result != ActionServerResult.Result.SUCCESS: raise ActionServerError(result, "set_flight_mode()", 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 + + Parameters + ---------- + flight_mode : FlightMode + Current vehicle flight mode, e.g. Takeoff/Mission/Land/etc. + + Raises + ------ + ActionServerError + If the request fails. The error contains the reason for the failure. + """ + + request = action_server_pb2.SetFlightModeInternalRequest() + + request.flight_mode = flight_mode.translate_to_rpc() + + response = await self._stub.SetFlightModeInternal(request) + + result = self._extract_result(response) + + if result.result != ActionServerResult.Result.SUCCESS: + raise ActionServerError(result, "set_flight_mode_internal()", flight_mode) diff --git a/mavsdk/action_server_pb2.py b/mavsdk/action_server_pb2.py index c4d21a01..8fda7e27 100644 --- a/mavsdk/action_server_pb2.py +++ b/mavsdk/action_server_pb2.py @@ -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" \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"b\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"\'\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\x8d\x0e\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\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\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' ) _globals = globals() @@ -120,8 +120,14 @@ _globals["_ACTIONSERVERSERVICE"].methods_by_name[ "SetFlightMode" ]._serialized_options = b"\200\265\030\001" - _globals["_FLIGHTMODE"]._serialized_start = 2951 - _globals["_FLIGHTMODE"]._serialized_end = 3314 + _globals["_ACTIONSERVERSERVICE"].methods_by_name[ + "SetFlightModeInternal" + ]._loaded_options = None + _globals["_ACTIONSERVERSERVICE"].methods_by_name[ + "SetFlightModeInternal" + ]._serialized_options = b"\200\265\030\001" + _globals["_FLIGHTMODE"]._serialized_start = 3268 + _globals["_FLIGHTMODE"]._serialized_end = 3631 _globals["_SETALLOWTAKEOFFREQUEST"]._serialized_start = 85 _globals["_SETALLOWTAKEOFFREQUEST"]._serialized_end = 132 _globals["_SETARMABLEREQUEST"]._serialized_start = 134 @@ -134,58 +140,62 @@ _globals["_SETARMEDSTATEREQUEST"]._serialized_end = 409 _globals["_SETFLIGHTMODEREQUEST"]._serialized_start = 411 _globals["_SETFLIGHTMODEREQUEST"]._serialized_end = 492 - _globals["_GETALLOWABLEFLIGHTMODESREQUEST"]._serialized_start = 494 - _globals["_GETALLOWABLEFLIGHTMODESREQUEST"]._serialized_end = 526 - _globals["_SUBSCRIBEARMDISARMREQUEST"]._serialized_start = 528 - _globals["_SUBSCRIBEARMDISARMREQUEST"]._serialized_end = 555 - _globals["_SUBSCRIBEFLIGHTMODECHANGEREQUEST"]._serialized_start = 557 - _globals["_SUBSCRIBEFLIGHTMODECHANGEREQUEST"]._serialized_end = 591 - _globals["_SUBSCRIBETAKEOFFREQUEST"]._serialized_start = 593 - _globals["_SUBSCRIBETAKEOFFREQUEST"]._serialized_end = 618 - _globals["_SUBSCRIBELANDREQUEST"]._serialized_start = 620 - _globals["_SUBSCRIBELANDREQUEST"]._serialized_end = 642 - _globals["_SUBSCRIBEREBOOTREQUEST"]._serialized_start = 644 - _globals["_SUBSCRIBEREBOOTREQUEST"]._serialized_end = 668 - _globals["_SUBSCRIBESHUTDOWNREQUEST"]._serialized_start = 670 - _globals["_SUBSCRIBESHUTDOWNREQUEST"]._serialized_end = 696 - _globals["_SUBSCRIBETERMINATEREQUEST"]._serialized_start = 698 - _globals["_SUBSCRIBETERMINATEREQUEST"]._serialized_end = 725 - _globals["_ARMDISARMRESPONSE"]._serialized_start = 728 - _globals["_ARMDISARMRESPONSE"]._serialized_end = 873 - _globals["_FLIGHTMODECHANGERESPONSE"]._serialized_start = 876 - _globals["_FLIGHTMODECHANGERESPONSE"]._serialized_end = 1037 - _globals["_TAKEOFFRESPONSE"]._serialized_start = 1039 - _globals["_TAKEOFFRESPONSE"]._serialized_end = 1149 - _globals["_LANDRESPONSE"]._serialized_start = 1151 - _globals["_LANDRESPONSE"]._serialized_end = 1255 - _globals["_REBOOTRESPONSE"]._serialized_start = 1257 - _globals["_REBOOTRESPONSE"]._serialized_end = 1365 - _globals["_SHUTDOWNRESPONSE"]._serialized_start = 1367 - _globals["_SHUTDOWNRESPONSE"]._serialized_end = 1479 - _globals["_TERMINATERESPONSE"]._serialized_start = 1481 - _globals["_TERMINATERESPONSE"]._serialized_end = 1595 - _globals["_SETARMABLERESPONSE"]._serialized_start = 1597 - _globals["_SETARMABLERESPONSE"]._serialized_end = 1693 - _globals["_SETDISARMABLERESPONSE"]._serialized_start = 1695 - _globals["_SETDISARMABLERESPONSE"]._serialized_end = 1794 - _globals["_SETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_start = 1796 - _globals["_SETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_end = 1905 - _globals["_SETALLOWTAKEOFFRESPONSE"]._serialized_start = 1907 - _globals["_SETALLOWTAKEOFFRESPONSE"]._serialized_end = 2008 - _globals["_GETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_start = 2010 - _globals["_GETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_end = 2113 - _globals["_SETARMEDSTATERESPONSE"]._serialized_start = 2115 - _globals["_SETARMEDSTATERESPONSE"]._serialized_end = 2214 - _globals["_SETFLIGHTMODERESPONSE"]._serialized_start = 2216 - _globals["_SETFLIGHTMODERESPONSE"]._serialized_end = 2315 - _globals["_ALLOWABLEFLIGHTMODES"]._serialized_start = 2317 - _globals["_ALLOWABLEFLIGHTMODES"]._serialized_end = 2415 - _globals["_ARMDISARM"]._serialized_start = 2417 - _globals["_ARMDISARM"]._serialized_end = 2456 - _globals["_ACTIONSERVERRESULT"]._serialized_start = 2459 - _globals["_ACTIONSERVERRESULT"]._serialized_end = 2948 - _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_start = 2571 - _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_end = 2948 - _globals["_ACTIONSERVERSERVICE"]._serialized_start = 3317 - _globals["_ACTIONSERVERSERVICE"]._serialized_end = 5122 + _globals["_SETFLIGHTMODEINTERNALREQUEST"]._serialized_start = 494 + _globals["_SETFLIGHTMODEINTERNALREQUEST"]._serialized_end = 583 + _globals["_GETALLOWABLEFLIGHTMODESREQUEST"]._serialized_start = 585 + _globals["_GETALLOWABLEFLIGHTMODESREQUEST"]._serialized_end = 617 + _globals["_SUBSCRIBEARMDISARMREQUEST"]._serialized_start = 619 + _globals["_SUBSCRIBEARMDISARMREQUEST"]._serialized_end = 646 + _globals["_SUBSCRIBEFLIGHTMODECHANGEREQUEST"]._serialized_start = 648 + _globals["_SUBSCRIBEFLIGHTMODECHANGEREQUEST"]._serialized_end = 682 + _globals["_SUBSCRIBETAKEOFFREQUEST"]._serialized_start = 684 + _globals["_SUBSCRIBETAKEOFFREQUEST"]._serialized_end = 709 + _globals["_SUBSCRIBELANDREQUEST"]._serialized_start = 711 + _globals["_SUBSCRIBELANDREQUEST"]._serialized_end = 733 + _globals["_SUBSCRIBEREBOOTREQUEST"]._serialized_start = 735 + _globals["_SUBSCRIBEREBOOTREQUEST"]._serialized_end = 759 + _globals["_SUBSCRIBESHUTDOWNREQUEST"]._serialized_start = 761 + _globals["_SUBSCRIBESHUTDOWNREQUEST"]._serialized_end = 787 + _globals["_SUBSCRIBETERMINATEREQUEST"]._serialized_start = 789 + _globals["_SUBSCRIBETERMINATEREQUEST"]._serialized_end = 816 + _globals["_ARMDISARMRESPONSE"]._serialized_start = 819 + _globals["_ARMDISARMRESPONSE"]._serialized_end = 964 + _globals["_FLIGHTMODECHANGERESPONSE"]._serialized_start = 967 + _globals["_FLIGHTMODECHANGERESPONSE"]._serialized_end = 1128 + _globals["_TAKEOFFRESPONSE"]._serialized_start = 1130 + _globals["_TAKEOFFRESPONSE"]._serialized_end = 1240 + _globals["_LANDRESPONSE"]._serialized_start = 1242 + _globals["_LANDRESPONSE"]._serialized_end = 1346 + _globals["_REBOOTRESPONSE"]._serialized_start = 1348 + _globals["_REBOOTRESPONSE"]._serialized_end = 1456 + _globals["_SHUTDOWNRESPONSE"]._serialized_start = 1458 + _globals["_SHUTDOWNRESPONSE"]._serialized_end = 1570 + _globals["_TERMINATERESPONSE"]._serialized_start = 1572 + _globals["_TERMINATERESPONSE"]._serialized_end = 1686 + _globals["_SETARMABLERESPONSE"]._serialized_start = 1688 + _globals["_SETARMABLERESPONSE"]._serialized_end = 1784 + _globals["_SETDISARMABLERESPONSE"]._serialized_start = 1786 + _globals["_SETDISARMABLERESPONSE"]._serialized_end = 1885 + _globals["_SETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_start = 1887 + _globals["_SETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_end = 1996 + _globals["_SETALLOWTAKEOFFRESPONSE"]._serialized_start = 1998 + _globals["_SETALLOWTAKEOFFRESPONSE"]._serialized_end = 2099 + _globals["_GETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_start = 2101 + _globals["_GETALLOWABLEFLIGHTMODESRESPONSE"]._serialized_end = 2204 + _globals["_SETARMEDSTATERESPONSE"]._serialized_start = 2206 + _globals["_SETARMEDSTATERESPONSE"]._serialized_end = 2305 + _globals["_SETFLIGHTMODERESPONSE"]._serialized_start = 2307 + _globals["_SETFLIGHTMODERESPONSE"]._serialized_end = 2406 + _globals["_SETFLIGHTMODEINTERNALRESPONSE"]._serialized_start = 2408 + _globals["_SETFLIGHTMODEINTERNALRESPONSE"]._serialized_end = 2515 + _globals["_ALLOWABLEFLIGHTMODES"]._serialized_start = 2518 + _globals["_ALLOWABLEFLIGHTMODES"]._serialized_end = 2732 + _globals["_ARMDISARM"]._serialized_start = 2734 + _globals["_ARMDISARM"]._serialized_end = 2773 + _globals["_ACTIONSERVERRESULT"]._serialized_start = 2776 + _globals["_ACTIONSERVERRESULT"]._serialized_end = 3265 + _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_start = 2888 + _globals["_ACTIONSERVERRESULT_RESULT"]._serialized_end = 3265 + _globals["_ACTIONSERVERSERVICE"]._serialized_start = 3634 + _globals["_ACTIONSERVERSERVICE"]._serialized_end = 5584 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/action_server_pb2_grpc.py b/mavsdk/action_server_pb2_grpc.py index 0c88c2f6..fc1b7662 100644 --- a/mavsdk/action_server_pb2_grpc.py +++ b/mavsdk/action_server_pb2_grpc.py @@ -122,6 +122,12 @@ def __init__(self, channel): response_deserializer=action__server_dot_action__server__pb2.SetFlightModeResponse.FromString, _registered_method=True, ) + self.SetFlightModeInternal = channel.unary_unary( + "/mavsdk.rpc.action_server.ActionServerService/SetFlightModeInternal", + request_serializer=action__server_dot_action__server__pb2.SetFlightModeInternalRequest.SerializeToString, + response_deserializer=action__server_dot_action__server__pb2.SetFlightModeInternalResponse.FromString, + _registered_method=True, + ) class ActionServerServiceServicer(object): @@ -211,6 +217,12 @@ def SetFlightMode(self, request, context): 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""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_ActionServerServiceServicer_to_server(servicer, server): rpc_method_handlers = { @@ -284,6 +296,11 @@ def add_ActionServerServiceServicer_to_server(servicer, server): request_deserializer=action__server_dot_action__server__pb2.SetFlightModeRequest.FromString, response_serializer=action__server_dot_action__server__pb2.SetFlightModeResponse.SerializeToString, ), + "SetFlightModeInternal": grpc.unary_unary_rpc_method_handler( + servicer.SetFlightModeInternal, + request_deserializer=action__server_dot_action__server__pb2.SetFlightModeInternalRequest.FromString, + response_serializer=action__server_dot_action__server__pb2.SetFlightModeInternalResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "mavsdk.rpc.action_server.ActionServerService", rpc_method_handlers @@ -717,3 +734,33 @@ def SetFlightMode( metadata, _registered_method=True, ) + + @staticmethod + def SetFlightModeInternal( + 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.action_server.ActionServerService/SetFlightModeInternal", + action__server_dot_action__server__pb2.SetFlightModeInternalRequest.SerializeToString, + action__server_dot_action__server__pb2.SetFlightModeInternalResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/mavsdk/param.py b/mavsdk/param.py index c3b88d75..6cfae8d7 100644 --- a/mavsdk/param.py +++ b/mavsdk/param.py @@ -327,6 +327,30 @@ class Result(Enum): FAILED Operation failed. + DOES_NOT_EXIST + Parameter does not exist + + VALUE_OUT_OF_RANGE + Parameter value does not fit within accepted range + + PERMISSION_DENIED + Caller is not permitted to set the value of this parameter + + COMPONENT_NOT_FOUND + Unknown component specified + + READ_ONLY + Parameter is read-only + + TYPE_UNSUPPORTED + Parameter data type is not supported by flight stack + + TYPE_MISMATCH + Parameter type does not match expected type + + READ_FAIL + Parameter exists but reading failed + """ UNKNOWN = 0 @@ -338,6 +362,14 @@ class Result(Enum): NO_SYSTEM = 6 PARAM_VALUE_TOO_LONG = 7 FAILED = 8 + DOES_NOT_EXIST = 9 + VALUE_OUT_OF_RANGE = 10 + PERMISSION_DENIED = 11 + COMPONENT_NOT_FOUND = 12 + READ_ONLY = 13 + TYPE_UNSUPPORTED = 14 + TYPE_MISMATCH = 15 + READ_FAIL = 16 def translate_to_rpc(self): if self == ParamResult.Result.UNKNOWN: @@ -358,6 +390,22 @@ def translate_to_rpc(self): return param_pb2.ParamResult.RESULT_PARAM_VALUE_TOO_LONG if self == ParamResult.Result.FAILED: return param_pb2.ParamResult.RESULT_FAILED + if self == ParamResult.Result.DOES_NOT_EXIST: + return param_pb2.ParamResult.RESULT_DOES_NOT_EXIST + if self == ParamResult.Result.VALUE_OUT_OF_RANGE: + return param_pb2.ParamResult.RESULT_VALUE_OUT_OF_RANGE + if self == ParamResult.Result.PERMISSION_DENIED: + return param_pb2.ParamResult.RESULT_PERMISSION_DENIED + if self == ParamResult.Result.COMPONENT_NOT_FOUND: + return param_pb2.ParamResult.RESULT_COMPONENT_NOT_FOUND + if self == ParamResult.Result.READ_ONLY: + return param_pb2.ParamResult.RESULT_READ_ONLY + if self == ParamResult.Result.TYPE_UNSUPPORTED: + return param_pb2.ParamResult.RESULT_TYPE_UNSUPPORTED + if self == ParamResult.Result.TYPE_MISMATCH: + return param_pb2.ParamResult.RESULT_TYPE_MISMATCH + if self == ParamResult.Result.READ_FAIL: + return param_pb2.ParamResult.RESULT_READ_FAIL @staticmethod def translate_from_rpc(rpc_enum_value): @@ -380,6 +428,22 @@ def translate_from_rpc(rpc_enum_value): return ParamResult.Result.PARAM_VALUE_TOO_LONG if rpc_enum_value == param_pb2.ParamResult.RESULT_FAILED: return ParamResult.Result.FAILED + if rpc_enum_value == param_pb2.ParamResult.RESULT_DOES_NOT_EXIST: + return ParamResult.Result.DOES_NOT_EXIST + if rpc_enum_value == param_pb2.ParamResult.RESULT_VALUE_OUT_OF_RANGE: + return ParamResult.Result.VALUE_OUT_OF_RANGE + if rpc_enum_value == param_pb2.ParamResult.RESULT_PERMISSION_DENIED: + return ParamResult.Result.PERMISSION_DENIED + if rpc_enum_value == param_pb2.ParamResult.RESULT_COMPONENT_NOT_FOUND: + return ParamResult.Result.COMPONENT_NOT_FOUND + if rpc_enum_value == param_pb2.ParamResult.RESULT_READ_ONLY: + return ParamResult.Result.READ_ONLY + if rpc_enum_value == param_pb2.ParamResult.RESULT_TYPE_UNSUPPORTED: + return ParamResult.Result.TYPE_UNSUPPORTED + if rpc_enum_value == param_pb2.ParamResult.RESULT_TYPE_MISMATCH: + return ParamResult.Result.TYPE_MISMATCH + if rpc_enum_value == param_pb2.ParamResult.RESULT_READ_FAIL: + return ParamResult.Result.READ_FAIL def __str__(self): return self.name diff --git a/mavsdk/param_pb2.py b/mavsdk/param_pb2.py index bf44ba12..4f21d32b 100644 --- a/mavsdk/param_pb2.py +++ b/mavsdk/param_pb2.py @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x11param/param.proto\x12\x10mavsdk.rpc.param\x1a\x14mavsdk_options.proto""\n\x12GetParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"Y\n\x13GetParamIntResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\x05"1\n\x12SetParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05"J\n\x13SetParamIntResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"$\n\x14GetParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"[\n\x15GetParamFloatResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\x02"3\n\x14SetParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"L\n\x15SetParamFloatResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"%\n\x15GetParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\\\n\x16GetParamCustomResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\t"4\n\x15SetParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"M\n\x16SetParamCustomResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"\x15\n\x13GetAllParamsRequest"C\n\x14GetAllParamsResponse\x12+\n\x06params\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.param.AllParams"N\n\x17SelectComponentResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"k\n\x16SelectComponentRequest\x12\x14\n\x0c\x63omponent_id\x18\x01 \x01(\x05\x12;\n\x10protocol_version\x18\x02 \x01(\x0e\x32!.mavsdk.rpc.param.ProtocolVersion"\'\n\x08IntParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05")\n\nFloatParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"*\n\x0b\x43ustomParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"\xa5\x01\n\tAllParams\x12.\n\nint_params\x18\x01 \x03(\x0b\x32\x1a.mavsdk.rpc.param.IntParam\x12\x32\n\x0c\x66loat_params\x18\x02 \x03(\x0b\x32\x1c.mavsdk.rpc.param.FloatParam\x12\x34\n\rcustom_params\x18\x03 \x03(\x0b\x32\x1d.mavsdk.rpc.param.CustomParam"\xbc\x02\n\x0bParamResult\x12\x34\n\x06result\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.param.ParamResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xe2\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x12\n\x0eRESULT_TIMEOUT\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x15\n\x11RESULT_WRONG_TYPE\x10\x04\x12\x1e\n\x1aRESULT_PARAM_NAME_TOO_LONG\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x1f\n\x1bRESULT_PARAM_VALUE_TOO_LONG\x10\x07\x12\x11\n\rRESULT_FAILED\x10\x08*D\n\x0fProtocolVersion\x12\x17\n\x13PROTOCOL_VERSION_V1\x10\x00\x12\x18\n\x14PROTOCOL_VERSION_EXT\x10\x01\x32\xcb\x06\n\x0cParamService\x12`\n\x0bGetParamInt\x12$.mavsdk.rpc.param.GetParamIntRequest\x1a%.mavsdk.rpc.param.GetParamIntResponse"\x04\x80\xb5\x18\x01\x12`\n\x0bSetParamInt\x12$.mavsdk.rpc.param.SetParamIntRequest\x1a%.mavsdk.rpc.param.SetParamIntResponse"\x04\x80\xb5\x18\x01\x12\x66\n\rGetParamFloat\x12&.mavsdk.rpc.param.GetParamFloatRequest\x1a\'.mavsdk.rpc.param.GetParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x66\n\rSetParamFloat\x12&.mavsdk.rpc.param.SetParamFloatRequest\x1a\'.mavsdk.rpc.param.SetParamFloatResponse"\x04\x80\xb5\x18\x01\x12i\n\x0eGetParamCustom\x12\'.mavsdk.rpc.param.GetParamCustomRequest\x1a(.mavsdk.rpc.param.GetParamCustomResponse"\x04\x80\xb5\x18\x01\x12i\n\x0eSetParamCustom\x12\'.mavsdk.rpc.param.SetParamCustomRequest\x1a(.mavsdk.rpc.param.SetParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x63\n\x0cGetAllParams\x12%.mavsdk.rpc.param.GetAllParamsRequest\x1a&.mavsdk.rpc.param.GetAllParamsResponse"\x04\x80\xb5\x18\x01\x12l\n\x0fSelectComponent\x12(.mavsdk.rpc.param.SelectComponentRequest\x1a).mavsdk.rpc.param.SelectComponentResponse"\x04\x80\xb5\x18\x01\x42\x1d\n\x0fio.mavsdk.paramB\nParamProtob\x06proto3' + b'\n\x11param/param.proto\x12\x10mavsdk.rpc.param\x1a\x14mavsdk_options.proto""\n\x12GetParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"Y\n\x13GetParamIntResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\x05"1\n\x12SetParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05"J\n\x13SetParamIntResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"$\n\x14GetParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"[\n\x15GetParamFloatResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\x02"3\n\x14SetParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"L\n\x15SetParamFloatResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"%\n\x15GetParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\\\n\x16GetParamCustomResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult\x12\r\n\x05value\x18\x02 \x01(\t"4\n\x15SetParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"M\n\x16SetParamCustomResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"\x15\n\x13GetAllParamsRequest"C\n\x14GetAllParamsResponse\x12+\n\x06params\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.param.AllParams"N\n\x17SelectComponentResponse\x12\x33\n\x0cparam_result\x18\x01 \x01(\x0b\x32\x1d.mavsdk.rpc.param.ParamResult"k\n\x16SelectComponentRequest\x12\x14\n\x0c\x63omponent_id\x18\x01 \x01(\x05\x12;\n\x10protocol_version\x18\x02 \x01(\x0e\x32!.mavsdk.rpc.param.ProtocolVersion"\'\n\x08IntParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05")\n\nFloatParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"*\n\x0b\x43ustomParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"\xa5\x01\n\tAllParams\x12.\n\nint_params\x18\x01 \x03(\x0b\x32\x1a.mavsdk.rpc.param.IntParam\x12\x32\n\x0c\x66loat_params\x18\x02 \x03(\x0b\x32\x1c.mavsdk.rpc.param.FloatParam\x12\x34\n\rcustom_params\x18\x03 \x03(\x0b\x32\x1d.mavsdk.rpc.param.CustomParam"\x97\x04\n\x0bParamResult\x12\x34\n\x06result\x18\x01 \x01(\x0e\x32$.mavsdk.rpc.param.ParamResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xbd\x03\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x12\n\x0eRESULT_TIMEOUT\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x15\n\x11RESULT_WRONG_TYPE\x10\x04\x12\x1e\n\x1aRESULT_PARAM_NAME_TOO_LONG\x10\x05\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x06\x12\x1f\n\x1bRESULT_PARAM_VALUE_TOO_LONG\x10\x07\x12\x11\n\rRESULT_FAILED\x10\x08\x12\x19\n\x15RESULT_DOES_NOT_EXIST\x10\t\x12\x1d\n\x19RESULT_VALUE_OUT_OF_RANGE\x10\n\x12\x1c\n\x18RESULT_PERMISSION_DENIED\x10\x0b\x12\x1e\n\x1aRESULT_COMPONENT_NOT_FOUND\x10\x0c\x12\x14\n\x10RESULT_READ_ONLY\x10\r\x12\x1b\n\x17RESULT_TYPE_UNSUPPORTED\x10\x0e\x12\x18\n\x14RESULT_TYPE_MISMATCH\x10\x0f\x12\x14\n\x10RESULT_READ_FAIL\x10\x10*D\n\x0fProtocolVersion\x12\x17\n\x13PROTOCOL_VERSION_V1\x10\x00\x12\x18\n\x14PROTOCOL_VERSION_EXT\x10\x01\x32\xcb\x06\n\x0cParamService\x12`\n\x0bGetParamInt\x12$.mavsdk.rpc.param.GetParamIntRequest\x1a%.mavsdk.rpc.param.GetParamIntResponse"\x04\x80\xb5\x18\x01\x12`\n\x0bSetParamInt\x12$.mavsdk.rpc.param.SetParamIntRequest\x1a%.mavsdk.rpc.param.SetParamIntResponse"\x04\x80\xb5\x18\x01\x12\x66\n\rGetParamFloat\x12&.mavsdk.rpc.param.GetParamFloatRequest\x1a\'.mavsdk.rpc.param.GetParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x66\n\rSetParamFloat\x12&.mavsdk.rpc.param.SetParamFloatRequest\x1a\'.mavsdk.rpc.param.SetParamFloatResponse"\x04\x80\xb5\x18\x01\x12i\n\x0eGetParamCustom\x12\'.mavsdk.rpc.param.GetParamCustomRequest\x1a(.mavsdk.rpc.param.GetParamCustomResponse"\x04\x80\xb5\x18\x01\x12i\n\x0eSetParamCustom\x12\'.mavsdk.rpc.param.SetParamCustomRequest\x1a(.mavsdk.rpc.param.SetParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x63\n\x0cGetAllParams\x12%.mavsdk.rpc.param.GetAllParamsRequest\x1a&.mavsdk.rpc.param.GetAllParamsResponse"\x04\x80\xb5\x18\x01\x12l\n\x0fSelectComponent\x12(.mavsdk.rpc.param.SelectComponentRequest\x1a).mavsdk.rpc.param.SelectComponentResponse"\x04\x80\xb5\x18\x01\x42\x1d\n\x0fio.mavsdk.paramB\nParamProtob\x06proto3' ) _globals = globals() @@ -64,8 +64,8 @@ _globals["_PARAMSERVICE"].methods_by_name[ "SelectComponent" ]._serialized_options = b"\200\265\030\001" - _globals["_PROTOCOLVERSION"]._serialized_start = 1739 - _globals["_PROTOCOLVERSION"]._serialized_end = 1807 + _globals["_PROTOCOLVERSION"]._serialized_start = 1958 + _globals["_PROTOCOLVERSION"]._serialized_end = 2026 _globals["_GETPARAMINTREQUEST"]._serialized_start = 61 _globals["_GETPARAMINTREQUEST"]._serialized_end = 95 _globals["_GETPARAMINTRESPONSE"]._serialized_start = 97 @@ -107,9 +107,9 @@ _globals["_ALLPARAMS"]._serialized_start = 1253 _globals["_ALLPARAMS"]._serialized_end = 1418 _globals["_PARAMRESULT"]._serialized_start = 1421 - _globals["_PARAMRESULT"]._serialized_end = 1737 + _globals["_PARAMRESULT"]._serialized_end = 1956 _globals["_PARAMRESULT_RESULT"]._serialized_start = 1511 - _globals["_PARAMRESULT_RESULT"]._serialized_end = 1737 - _globals["_PARAMSERVICE"]._serialized_start = 1810 - _globals["_PARAMSERVICE"]._serialized_end = 2653 + _globals["_PARAMRESULT_RESULT"]._serialized_end = 1956 + _globals["_PARAMSERVICE"]._serialized_start = 2029 + _globals["_PARAMSERVICE"]._serialized_end = 2872 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/param_server.py b/mavsdk/param_server.py index c6c0fe90..da759e70 100644 --- a/mavsdk/param_server.py +++ b/mavsdk/param_server.py @@ -286,6 +286,9 @@ class Result(Enum): PARAM_VALUE_TOO_LONG Parameter name too long (> 128) + PARAM_PROVIDED_TOO_LATE + All parameters have to be provided upfront + """ UNKNOWN = 0 @@ -295,6 +298,7 @@ class Result(Enum): PARAM_NAME_TOO_LONG = 4 NO_SYSTEM = 5 PARAM_VALUE_TOO_LONG = 6 + PARAM_PROVIDED_TOO_LATE = 7 def translate_to_rpc(self): if self == ParamServerResult.Result.UNKNOWN: @@ -311,6 +315,8 @@ def translate_to_rpc(self): return param_server_pb2.ParamServerResult.RESULT_NO_SYSTEM if self == ParamServerResult.Result.PARAM_VALUE_TOO_LONG: return param_server_pb2.ParamServerResult.RESULT_PARAM_VALUE_TOO_LONG + if self == ParamServerResult.Result.PARAM_PROVIDED_TOO_LATE: + return param_server_pb2.ParamServerResult.RESULT_PARAM_PROVIDED_TOO_LATE @staticmethod def translate_from_rpc(rpc_enum_value): @@ -335,6 +341,11 @@ def translate_from_rpc(rpc_enum_value): == param_server_pb2.ParamServerResult.RESULT_PARAM_VALUE_TOO_LONG ): return ParamServerResult.Result.PARAM_VALUE_TOO_LONG + if ( + rpc_enum_value + == param_server_pb2.ParamServerResult.RESULT_PARAM_PROVIDED_TOO_LATE + ): + return ParamServerResult.Result.PARAM_PROVIDED_TOO_LATE def __str__(self): return self.name @@ -479,6 +490,10 @@ async def provide_param_int(self, name, value): If the type is wrong, the result will be `WRONG_TYPE`. + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. + Parameters ---------- name : std::string @@ -509,6 +524,10 @@ async def retrieve_param_float(self, name): If the type is wrong, the result will be `WRONG_TYPE`. + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. + Parameters ---------- name : std::string @@ -574,6 +593,10 @@ async def retrieve_param_custom(self, name): If the type is wrong, the result will be `WRONG_TYPE`. + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. + Parameters ---------- name : std::string diff --git a/mavsdk/param_server_pb2.py b/mavsdk/param_server_pb2.py index 08e686b1..151fadd4 100644 --- a/mavsdk/param_server_pb2.py +++ b/mavsdk/param_server_pb2.py @@ -23,7 +23,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x1fparam_server/param_server.proto\x12\x17mavsdk.rpc.param_server\x1a\x14mavsdk_options.proto"/\n\x12SetProtocolRequest\x12\x19\n\x11\x65xtended_protocol\x18\x01 \x01(\x08"^\n\x13SetProtocolResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"\'\n\x17RetrieveParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"r\n\x18RetrieveParamIntResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\x05"5\n\x16ProvideParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05"b\n\x17ProvideParamIntResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult")\n\x19RetrieveParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"t\n\x1aRetrieveParamFloatResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\x02"7\n\x18ProvideParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"d\n\x19ProvideParamFloatResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"*\n\x1aRetrieveParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"u\n\x1bRetrieveParamCustomResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\t"8\n\x19ProvideParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"e\n\x1aProvideParamCustomResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"\x1a\n\x18RetrieveAllParamsRequest"O\n\x19RetrieveAllParamsResponse\x12\x32\n\x06params\x18\x01 \x01(\x0b\x32".mavsdk.rpc.param_server.AllParams"!\n\x1fSubscribeChangedParamIntRequest"K\n\x17\x43hangedParamIntResponse\x12\x30\n\x05param\x18\x01 \x01(\x0b\x32!.mavsdk.rpc.param_server.IntParam"#\n!SubscribeChangedParamFloatRequest"O\n\x19\x43hangedParamFloatResponse\x12\x32\n\x05param\x18\x01 \x01(\x0b\x32#.mavsdk.rpc.param_server.FloatParam"$\n"SubscribeChangedParamCustomRequest"Q\n\x1a\x43hangedParamCustomResponse\x12\x33\n\x05param\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.param_server.CustomParam"\'\n\x08IntParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05")\n\nFloatParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"*\n\x0b\x43ustomParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"\xba\x01\n\tAllParams\x12\x35\n\nint_params\x18\x01 \x03(\x0b\x32!.mavsdk.rpc.param_server.IntParam\x12\x39\n\x0c\x66loat_params\x18\x02 \x03(\x0b\x32#.mavsdk.rpc.param_server.FloatParam\x12;\n\rcustom_params\x18\x03 \x03(\x0b\x32$.mavsdk.rpc.param_server.CustomParam"\xa1\x02\n\x11ParamServerResult\x12\x41\n\x06result\x18\x01 \x01(\x0e\x32\x31.mavsdk.rpc.param_server.ParamServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xb4\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NOT_FOUND\x10\x02\x12\x15\n\x11RESULT_WRONG_TYPE\x10\x03\x12\x1e\n\x1aRESULT_PARAM_NAME_TOO_LONG\x10\x04\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x05\x12\x1f\n\x1bRESULT_PARAM_VALUE_TOO_LONG\x10\x06\x32\xdc\x0b\n\x12ParamServerService\x12n\n\x0bSetProtocol\x12+.mavsdk.rpc.param_server.SetProtocolRequest\x1a,.mavsdk.rpc.param_server.SetProtocolResponse"\x04\x80\xb5\x18\x01\x12}\n\x10RetrieveParamInt\x12\x30.mavsdk.rpc.param_server.RetrieveParamIntRequest\x1a\x31.mavsdk.rpc.param_server.RetrieveParamIntResponse"\x04\x80\xb5\x18\x01\x12z\n\x0fProvideParamInt\x12/.mavsdk.rpc.param_server.ProvideParamIntRequest\x1a\x30.mavsdk.rpc.param_server.ProvideParamIntResponse"\x04\x80\xb5\x18\x01\x12\x83\x01\n\x12RetrieveParamFloat\x12\x32.mavsdk.rpc.param_server.RetrieveParamFloatRequest\x1a\x33.mavsdk.rpc.param_server.RetrieveParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x80\x01\n\x11ProvideParamFloat\x12\x31.mavsdk.rpc.param_server.ProvideParamFloatRequest\x1a\x32.mavsdk.rpc.param_server.ProvideParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x86\x01\n\x13RetrieveParamCustom\x12\x33.mavsdk.rpc.param_server.RetrieveParamCustomRequest\x1a\x34.mavsdk.rpc.param_server.RetrieveParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x83\x01\n\x12ProvideParamCustom\x12\x32.mavsdk.rpc.param_server.ProvideParamCustomRequest\x1a\x33.mavsdk.rpc.param_server.ProvideParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x80\x01\n\x11RetrieveAllParams\x12\x31.mavsdk.rpc.param_server.RetrieveAllParamsRequest\x1a\x32.mavsdk.rpc.param_server.RetrieveAllParamsResponse"\x04\x80\xb5\x18\x01\x12\x8e\x01\n\x18SubscribeChangedParamInt\x12\x38.mavsdk.rpc.param_server.SubscribeChangedParamIntRequest\x1a\x30.mavsdk.rpc.param_server.ChangedParamIntResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x94\x01\n\x1aSubscribeChangedParamFloat\x12:.mavsdk.rpc.param_server.SubscribeChangedParamFloatRequest\x1a\x32.mavsdk.rpc.param_server.ChangedParamFloatResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x97\x01\n\x1bSubscribeChangedParamCustom\x12;.mavsdk.rpc.param_server.SubscribeChangedParamCustomRequest\x1a\x33.mavsdk.rpc.param_server.ChangedParamCustomResponse"\x04\x80\xb5\x18\x00\x30\x01\x42*\n\x16io.mavsdk.param_serverB\x10ParamServerProtob\x06proto3' + b'\n\x1fparam_server/param_server.proto\x12\x17mavsdk.rpc.param_server\x1a\x14mavsdk_options.proto"/\n\x12SetProtocolRequest\x12\x19\n\x11\x65xtended_protocol\x18\x01 \x01(\x08"^\n\x13SetProtocolResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"\'\n\x17RetrieveParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"r\n\x18RetrieveParamIntResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\x05"5\n\x16ProvideParamIntRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05"b\n\x17ProvideParamIntResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult")\n\x19RetrieveParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"t\n\x1aRetrieveParamFloatResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\x02"7\n\x18ProvideParamFloatRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"d\n\x19ProvideParamFloatResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"*\n\x1aRetrieveParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"u\n\x1bRetrieveParamCustomResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult\x12\r\n\x05value\x18\x02 \x01(\t"8\n\x19ProvideParamCustomRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"e\n\x1aProvideParamCustomResponse\x12G\n\x13param_server_result\x18\x01 \x01(\x0b\x32*.mavsdk.rpc.param_server.ParamServerResult"\x1a\n\x18RetrieveAllParamsRequest"O\n\x19RetrieveAllParamsResponse\x12\x32\n\x06params\x18\x01 \x01(\x0b\x32".mavsdk.rpc.param_server.AllParams"!\n\x1fSubscribeChangedParamIntRequest"K\n\x17\x43hangedParamIntResponse\x12\x30\n\x05param\x18\x01 \x01(\x0b\x32!.mavsdk.rpc.param_server.IntParam"#\n!SubscribeChangedParamFloatRequest"O\n\x19\x43hangedParamFloatResponse\x12\x32\n\x05param\x18\x01 \x01(\x0b\x32#.mavsdk.rpc.param_server.FloatParam"$\n"SubscribeChangedParamCustomRequest"Q\n\x1a\x43hangedParamCustomResponse\x12\x33\n\x05param\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.param_server.CustomParam"\'\n\x08IntParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05")\n\nFloatParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02"*\n\x0b\x43ustomParam\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t"\xba\x01\n\tAllParams\x12\x35\n\nint_params\x18\x01 \x03(\x0b\x32!.mavsdk.rpc.param_server.IntParam\x12\x39\n\x0c\x66loat_params\x18\x02 \x03(\x0b\x32#.mavsdk.rpc.param_server.FloatParam\x12;\n\rcustom_params\x18\x03 \x03(\x0b\x32$.mavsdk.rpc.param_server.CustomParam"\xc5\x02\n\x11ParamServerResult\x12\x41\n\x06result\x18\x01 \x01(\x0e\x32\x31.mavsdk.rpc.param_server.ParamServerResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t"\xd8\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NOT_FOUND\x10\x02\x12\x15\n\x11RESULT_WRONG_TYPE\x10\x03\x12\x1e\n\x1aRESULT_PARAM_NAME_TOO_LONG\x10\x04\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x05\x12\x1f\n\x1bRESULT_PARAM_VALUE_TOO_LONG\x10\x06\x12"\n\x1eRESULT_PARAM_PROVIDED_TOO_LATE\x10\x07\x32\xdc\x0b\n\x12ParamServerService\x12n\n\x0bSetProtocol\x12+.mavsdk.rpc.param_server.SetProtocolRequest\x1a,.mavsdk.rpc.param_server.SetProtocolResponse"\x04\x80\xb5\x18\x01\x12}\n\x10RetrieveParamInt\x12\x30.mavsdk.rpc.param_server.RetrieveParamIntRequest\x1a\x31.mavsdk.rpc.param_server.RetrieveParamIntResponse"\x04\x80\xb5\x18\x01\x12z\n\x0fProvideParamInt\x12/.mavsdk.rpc.param_server.ProvideParamIntRequest\x1a\x30.mavsdk.rpc.param_server.ProvideParamIntResponse"\x04\x80\xb5\x18\x01\x12\x83\x01\n\x12RetrieveParamFloat\x12\x32.mavsdk.rpc.param_server.RetrieveParamFloatRequest\x1a\x33.mavsdk.rpc.param_server.RetrieveParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x80\x01\n\x11ProvideParamFloat\x12\x31.mavsdk.rpc.param_server.ProvideParamFloatRequest\x1a\x32.mavsdk.rpc.param_server.ProvideParamFloatResponse"\x04\x80\xb5\x18\x01\x12\x86\x01\n\x13RetrieveParamCustom\x12\x33.mavsdk.rpc.param_server.RetrieveParamCustomRequest\x1a\x34.mavsdk.rpc.param_server.RetrieveParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x83\x01\n\x12ProvideParamCustom\x12\x32.mavsdk.rpc.param_server.ProvideParamCustomRequest\x1a\x33.mavsdk.rpc.param_server.ProvideParamCustomResponse"\x04\x80\xb5\x18\x01\x12\x80\x01\n\x11RetrieveAllParams\x12\x31.mavsdk.rpc.param_server.RetrieveAllParamsRequest\x1a\x32.mavsdk.rpc.param_server.RetrieveAllParamsResponse"\x04\x80\xb5\x18\x01\x12\x8e\x01\n\x18SubscribeChangedParamInt\x12\x38.mavsdk.rpc.param_server.SubscribeChangedParamIntRequest\x1a\x30.mavsdk.rpc.param_server.ChangedParamIntResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x94\x01\n\x1aSubscribeChangedParamFloat\x12:.mavsdk.rpc.param_server.SubscribeChangedParamFloatRequest\x1a\x32.mavsdk.rpc.param_server.ChangedParamFloatResponse"\x04\x80\xb5\x18\x00\x30\x01\x12\x97\x01\n\x1bSubscribeChangedParamCustom\x12;.mavsdk.rpc.param_server.SubscribeChangedParamCustomRequest\x1a\x33.mavsdk.rpc.param_server.ChangedParamCustomResponse"\x04\x80\xb5\x18\x00\x30\x01\x42*\n\x16io.mavsdk.param_serverB\x10ParamServerProtob\x06proto3' ) _globals = globals() @@ -155,9 +155,9 @@ _globals["_ALLPARAMS"]._serialized_start = 1772 _globals["_ALLPARAMS"]._serialized_end = 1958 _globals["_PARAMSERVERRESULT"]._serialized_start = 1961 - _globals["_PARAMSERVERRESULT"]._serialized_end = 2250 + _globals["_PARAMSERVERRESULT"]._serialized_end = 2286 _globals["_PARAMSERVERRESULT_RESULT"]._serialized_start = 2070 - _globals["_PARAMSERVERRESULT_RESULT"]._serialized_end = 2250 - _globals["_PARAMSERVERSERVICE"]._serialized_start = 2253 - _globals["_PARAMSERVERSERVICE"]._serialized_end = 3753 + _globals["_PARAMSERVERRESULT_RESULT"]._serialized_end = 2286 + _globals["_PARAMSERVERSERVICE"]._serialized_start = 2289 + _globals["_PARAMSERVERSERVICE"]._serialized_end = 3789 # @@protoc_insertion_point(module_scope) diff --git a/mavsdk/param_server_pb2_grpc.py b/mavsdk/param_server_pb2_grpc.py index a96bfa2d..64da5dca 100644 --- a/mavsdk/param_server_pb2_grpc.py +++ b/mavsdk/param_server_pb2_grpc.py @@ -136,6 +136,11 @@ def ProvideParamInt(self, request, context): Provide an int parameter. If the type is wrong, the result will be `WRONG_TYPE`. + + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") @@ -146,6 +151,10 @@ def RetrieveParamFloat(self, request, context): Retrieve a float parameter. If the type is wrong, the result will be `WRONG_TYPE`. + + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") @@ -166,6 +175,10 @@ def RetrieveParamCustom(self, request, context): Retrieve a custom parameter. If the type is wrong, the result will be `WRONG_TYPE`. + + Note that all params need to be provided upfront. Once a client has + requested a param list, the indices are locked and no more params + can be added. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") diff --git a/proto b/proto index f22994b4..b5113c15 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit f22994b46cd830eb2ad2e7d508b612582cd0173d +Subproject commit b5113c15e125af48dee07f9affe83b6b1f4a2aab