From d6aa6ba1d6fc8e9d28e4e78887bc23f8239be352 Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Wed, 26 May 2021 01:02:03 +0200 Subject: [PATCH] Update mavsdk to v0.40.0 --- MAVSDK_SERVER_VERSION | 5 +- mavsdk/action.py | 30 ++++++ mavsdk/action_pb2.py | 196 ++++++++++++++++++++++++++++---------- mavsdk/action_pb2_grpc.py | 35 +++++++ mavsdk/core.py | 16 ---- mavsdk/core_pb2.py | 21 ++-- mavsdk/info.py | 24 ++++- mavsdk/info_pb2.py | 31 +++--- proto | 2 +- 9 files changed, 260 insertions(+), 100 deletions(-) diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index 50ec3f7e..707d5fac 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1,4 +1 @@ -v0.39.0 - - - +v0.40.0 diff --git a/mavsdk/action.py b/mavsdk/action.py index 4e750029..c96b95cb 100644 --- a/mavsdk/action.py +++ b/mavsdk/action.py @@ -617,6 +617,36 @@ async def hold(self): raise ActionError(result, "hold()") + async def set_actuator(self, index, value): + """ + Send command to set the value of an actuator. + + Parameters + ---------- + index : int32_t + Index of actuator (starting with 1) + + value : float + Value to set the actuator to (normalized from [-1..1]) + + Raises + ------ + ActionError + If the request fails. The error contains the reason for the failure. + """ + + request = action_pb2.SetActuatorRequest() + request.index = index + request.value = value + response = await self._stub.SetActuator(request) + + + result = self._extract_result(response) + + if result.result is not ActionResult.Result.SUCCESS: + raise ActionError(result, "set_actuator()", index, value) + + async def transition_to_fixedwing(self): """ Send command to transition the drone to fixedwing. diff --git a/mavsdk/action_pb2.py b/mavsdk/action_pb2.py index 07324504..559d8eac 100644 --- a/mavsdk/action_pb2.py +++ b/mavsdk/action_pb2.py @@ -21,7 +21,7 @@ syntax='proto3', serialized_options=b'\n\020io.mavsdk.actionB\013ActionProto', create_key=_descriptor._internal_create_key, - serialized_pb=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\"\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\"\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\"\x18\n\x16GetMaximumSpeedRequest\"`\n\x17GetMaximumSpeedResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\r\n\x05speed\x18\x02 \x01(\x02\"\'\n\x16SetMaximumSpeedRequest\x12\r\n\x05speed\x18\x01 \x01(\x02\"Q\n\x17SetMaximumSpeedResponse\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\"\xc5\x03\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\"\xe8\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*\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\xda\x0f\n\rActionService\x12\x46\n\x03\x41rm\x12\x1d.mavsdk.rpc.action.ArmRequest\x1a\x1e.mavsdk.rpc.action.ArmResponse\"\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\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\x12j\n\x0fGetMaximumSpeed\x12).mavsdk.rpc.action.GetMaximumSpeedRequest\x1a*.mavsdk.rpc.action.GetMaximumSpeedResponse\"\x00\x12j\n\x0fSetMaximumSpeed\x12).mavsdk.rpc.action.SetMaximumSpeedRequest\x1a*.mavsdk.rpc.action.SetMaximumSpeedResponse\"\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\x42\x1f\n\x10io.mavsdk.actionB\x0b\x41\x63tionProtob\x06proto3' + serialized_pb=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\"\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\"\x18\n\x16GetMaximumSpeedRequest\"`\n\x17GetMaximumSpeedResponse\x12\x36\n\raction_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.action.ActionResult\x12\r\n\x05speed\x18\x02 \x01(\x02\"\'\n\x16SetMaximumSpeedRequest\x12\r\n\x05speed\x18\x01 \x01(\x02\"Q\n\x17SetMaximumSpeedResponse\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\"\xc5\x03\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\"\xe8\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*\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\xba\x10\n\rActionService\x12\x46\n\x03\x41rm\x12\x1d.mavsdk.rpc.action.ArmRequest\x1a\x1e.mavsdk.rpc.action.ArmResponse\"\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\x12j\n\x0fGetMaximumSpeed\x12).mavsdk.rpc.action.GetMaximumSpeedRequest\x1a*.mavsdk.rpc.action.GetMaximumSpeedResponse\"\x00\x12j\n\x0fSetMaximumSpeed\x12).mavsdk.rpc.action.SetMaximumSpeedRequest\x1a*.mavsdk.rpc.action.SetMaximumSpeedResponse\"\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\x42\x1f\n\x10io.mavsdk.actionB\x0b\x41\x63tionProtob\x06proto3' , dependencies=[mavsdk__options__pb2.DESCRIPTOR,]) @@ -60,8 +60,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=3004, - serialized_end=3247, + serialized_start=3135, + serialized_end=3378, ) _sym_db.RegisterEnumDescriptor(_ORBITYAWBEHAVIOR) @@ -143,8 +143,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=2641, - serialized_end=3001, + serialized_start=2772, + serialized_end=3132, ) _sym_db.RegisterEnumDescriptor(_ACTIONRESULT_RESULT) @@ -903,6 +903,77 @@ ) +_SETACTUATORREQUEST = _descriptor.Descriptor( + name='SetActuatorRequest', + full_name='mavsdk.rpc.action.SetActuatorRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='index', full_name='mavsdk.rpc.action.SetActuatorRequest.index', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='mavsdk.rpc.action.SetActuatorRequest.value', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1471, + serialized_end=1521, +) + + +_SETACTUATORRESPONSE = _descriptor.Descriptor( + name='SetActuatorResponse', + full_name='mavsdk.rpc.action.SetActuatorResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='action_result', full_name='mavsdk.rpc.action.SetActuatorResponse.action_result', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1523, + serialized_end=1600, +) + + _TRANSITIONTOFIXEDWINGREQUEST = _descriptor.Descriptor( name='TransitionToFixedwingRequest', full_name='mavsdk.rpc.action.TransitionToFixedwingRequest', @@ -923,8 +994,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1471, - serialized_end=1501, + serialized_start=1602, + serialized_end=1632, ) @@ -955,8 +1026,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1503, - serialized_end=1590, + serialized_start=1634, + serialized_end=1721, ) @@ -980,8 +1051,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1592, - serialized_end=1624, + serialized_start=1723, + serialized_end=1755, ) @@ -1012,8 +1083,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1626, - serialized_end=1715, + serialized_start=1757, + serialized_end=1846, ) @@ -1037,8 +1108,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1717, - serialized_end=1744, + serialized_start=1848, + serialized_end=1875, ) @@ -1076,8 +1147,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1746, - serialized_end=1848, + serialized_start=1877, + serialized_end=1979, ) @@ -1108,8 +1179,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1850, - serialized_end=1895, + serialized_start=1981, + serialized_end=2026, ) @@ -1140,8 +1211,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1897, - serialized_end=1981, + serialized_start=2028, + serialized_end=2112, ) @@ -1165,8 +1236,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1983, - serialized_end=2007, + serialized_start=2114, + serialized_end=2138, ) @@ -1204,8 +1275,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2009, - serialized_end=2105, + serialized_start=2140, + serialized_end=2236, ) @@ -1236,8 +1307,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2107, - serialized_end=2146, + serialized_start=2238, + serialized_end=2277, ) @@ -1268,8 +1339,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2148, - serialized_end=2229, + serialized_start=2279, + serialized_end=2360, ) @@ -1293,8 +1364,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2231, - serialized_end=2265, + serialized_start=2362, + serialized_end=2396, ) @@ -1332,8 +1403,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2267, - serialized_end=2387, + serialized_start=2398, + serialized_end=2518, ) @@ -1364,8 +1435,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2389, - serialized_end=2452, + serialized_start=2520, + serialized_end=2583, ) @@ -1396,8 +1467,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2454, - serialized_end=2545, + serialized_start=2585, + serialized_end=2676, ) @@ -1436,8 +1507,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=2548, - serialized_end=3001, + serialized_start=2679, + serialized_end=3132, ) _ARMRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT @@ -1453,6 +1524,7 @@ _DOORBITREQUEST.fields_by_name['yaw_behavior'].enum_type = _ORBITYAWBEHAVIOR _DOORBITRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT _HOLDRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT +_SETACTUATORRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT _TRANSITIONTOFIXEDWINGRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT _TRANSITIONTOMULTICOPTERRESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT _GETTAKEOFFALTITUDERESPONSE.fields_by_name['action_result'].message_type = _ACTIONRESULT @@ -1487,6 +1559,8 @@ DESCRIPTOR.message_types_by_name['DoOrbitResponse'] = _DOORBITRESPONSE DESCRIPTOR.message_types_by_name['HoldRequest'] = _HOLDREQUEST DESCRIPTOR.message_types_by_name['HoldResponse'] = _HOLDRESPONSE +DESCRIPTOR.message_types_by_name['SetActuatorRequest'] = _SETACTUATORREQUEST +DESCRIPTOR.message_types_by_name['SetActuatorResponse'] = _SETACTUATORRESPONSE DESCRIPTOR.message_types_by_name['TransitionToFixedwingRequest'] = _TRANSITIONTOFIXEDWINGREQUEST DESCRIPTOR.message_types_by_name['TransitionToFixedwingResponse'] = _TRANSITIONTOFIXEDWINGRESPONSE DESCRIPTOR.message_types_by_name['TransitionToMulticopterRequest'] = _TRANSITIONTOMULTICOPTERREQUEST @@ -1675,6 +1749,20 @@ }) _sym_db.RegisterMessage(HoldResponse) +SetActuatorRequest = _reflection.GeneratedProtocolMessageType('SetActuatorRequest', (_message.Message,), { + 'DESCRIPTOR' : _SETACTUATORREQUEST, + '__module__' : 'action.action_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.action.SetActuatorRequest) + }) +_sym_db.RegisterMessage(SetActuatorRequest) + +SetActuatorResponse = _reflection.GeneratedProtocolMessageType('SetActuatorResponse', (_message.Message,), { + 'DESCRIPTOR' : _SETACTUATORRESPONSE, + '__module__' : 'action.action_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.action.SetActuatorResponse) + }) +_sym_db.RegisterMessage(SetActuatorResponse) + TransitionToFixedwingRequest = _reflection.GeneratedProtocolMessageType('TransitionToFixedwingRequest', (_message.Message,), { 'DESCRIPTOR' : _TRANSITIONTOFIXEDWINGREQUEST, '__module__' : 'action.action_pb2' @@ -1807,8 +1895,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=3250, - serialized_end=5260, + serialized_start=3381, + serialized_end=5487, methods=[ _descriptor.MethodDescriptor( name='Arm', @@ -1930,10 +2018,20 @@ serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='SetActuator', + full_name='mavsdk.rpc.action.ActionService.SetActuator', + index=12, + containing_service=None, + input_type=_SETACTUATORREQUEST, + output_type=_SETACTUATORRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), _descriptor.MethodDescriptor( name='TransitionToFixedwing', full_name='mavsdk.rpc.action.ActionService.TransitionToFixedwing', - index=12, + index=13, containing_service=None, input_type=_TRANSITIONTOFIXEDWINGREQUEST, output_type=_TRANSITIONTOFIXEDWINGRESPONSE, @@ -1943,7 +2041,7 @@ _descriptor.MethodDescriptor( name='TransitionToMulticopter', full_name='mavsdk.rpc.action.ActionService.TransitionToMulticopter', - index=13, + index=14, containing_service=None, input_type=_TRANSITIONTOMULTICOPTERREQUEST, output_type=_TRANSITIONTOMULTICOPTERRESPONSE, @@ -1953,7 +2051,7 @@ _descriptor.MethodDescriptor( name='GetTakeoffAltitude', full_name='mavsdk.rpc.action.ActionService.GetTakeoffAltitude', - index=14, + index=15, containing_service=None, input_type=_GETTAKEOFFALTITUDEREQUEST, output_type=_GETTAKEOFFALTITUDERESPONSE, @@ -1963,7 +2061,7 @@ _descriptor.MethodDescriptor( name='SetTakeoffAltitude', full_name='mavsdk.rpc.action.ActionService.SetTakeoffAltitude', - index=15, + index=16, containing_service=None, input_type=_SETTAKEOFFALTITUDEREQUEST, output_type=_SETTAKEOFFALTITUDERESPONSE, @@ -1973,7 +2071,7 @@ _descriptor.MethodDescriptor( name='GetMaximumSpeed', full_name='mavsdk.rpc.action.ActionService.GetMaximumSpeed', - index=16, + index=17, containing_service=None, input_type=_GETMAXIMUMSPEEDREQUEST, output_type=_GETMAXIMUMSPEEDRESPONSE, @@ -1983,7 +2081,7 @@ _descriptor.MethodDescriptor( name='SetMaximumSpeed', full_name='mavsdk.rpc.action.ActionService.SetMaximumSpeed', - index=17, + index=18, containing_service=None, input_type=_SETMAXIMUMSPEEDREQUEST, output_type=_SETMAXIMUMSPEEDRESPONSE, @@ -1993,7 +2091,7 @@ _descriptor.MethodDescriptor( name='GetReturnToLaunchAltitude', full_name='mavsdk.rpc.action.ActionService.GetReturnToLaunchAltitude', - index=18, + index=19, containing_service=None, input_type=_GETRETURNTOLAUNCHALTITUDEREQUEST, output_type=_GETRETURNTOLAUNCHALTITUDERESPONSE, @@ -2003,7 +2101,7 @@ _descriptor.MethodDescriptor( name='SetReturnToLaunchAltitude', full_name='mavsdk.rpc.action.ActionService.SetReturnToLaunchAltitude', - index=19, + index=20, containing_service=None, input_type=_SETRETURNTOLAUNCHALTITUDEREQUEST, output_type=_SETRETURNTOLAUNCHALTITUDERESPONSE, diff --git a/mavsdk/action_pb2_grpc.py b/mavsdk/action_pb2_grpc.py index 1098f3c5..a6d9d713 100644 --- a/mavsdk/action_pb2_grpc.py +++ b/mavsdk/action_pb2_grpc.py @@ -75,6 +75,11 @@ def __init__(self, channel): request_serializer=action_dot_action__pb2.HoldRequest.SerializeToString, response_deserializer=action_dot_action__pb2.HoldResponse.FromString, ) + self.SetActuator = channel.unary_unary( + '/mavsdk.rpc.action.ActionService/SetActuator', + request_serializer=action_dot_action__pb2.SetActuatorRequest.SerializeToString, + response_deserializer=action_dot_action__pb2.SetActuatorResponse.FromString, + ) self.TransitionToFixedwing = channel.unary_unary( '/mavsdk.rpc.action.ActionService/TransitionToFixedwing', request_serializer=action_dot_action__pb2.TransitionToFixedwingRequest.SerializeToString, @@ -258,6 +263,14 @@ def Hold(self, request, context): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def SetActuator(self, request, context): + """ + Send command to set the value of an actuator. + """ + 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. @@ -393,6 +406,11 @@ def add_ActionServiceServicer_to_server(servicer, server): request_deserializer=action_dot_action__pb2.HoldRequest.FromString, response_serializer=action_dot_action__pb2.HoldResponse.SerializeToString, ), + 'SetActuator': grpc.unary_unary_rpc_method_handler( + servicer.SetActuator, + request_deserializer=action_dot_action__pb2.SetActuatorRequest.FromString, + response_serializer=action_dot_action__pb2.SetActuatorResponse.SerializeToString, + ), 'TransitionToFixedwing': grpc.unary_unary_rpc_method_handler( servicer.TransitionToFixedwing, request_deserializer=action_dot_action__pb2.TransitionToFixedwingRequest.FromString, @@ -648,6 +666,23 @@ def Hold(request, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod + def SetActuator(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/SetActuator', + action_dot_action__pb2.SetActuatorRequest.SerializeToString, + action_dot_action__pb2.SetActuatorResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def TransitionToFixedwing(request, target, diff --git a/mavsdk/core.py b/mavsdk/core.py index 433147eb..bf27bc47 100644 --- a/mavsdk/core.py +++ b/mavsdk/core.py @@ -12,9 +12,6 @@ class ConnectionState: Parameters ---------- - uuid : uint64_t - UUID of the vehicle - is_connected : bool Whether the vehicle got connected or disconnected @@ -24,10 +21,8 @@ class ConnectionState: def __init__( self, - uuid, is_connected): """ Initializes the ConnectionState object """ - self.uuid = uuid self.is_connected = is_connected def __equals__(self, to_compare): @@ -36,7 +31,6 @@ def __equals__(self, to_compare): # Try to compare - this likely fails when it is compared to a non # ConnectionState object return \ - (self.uuid == to_compare.uuid) and \ (self.is_connected == to_compare.is_connected) except AttributeError: @@ -45,7 +39,6 @@ def __equals__(self, to_compare): def __str__(self): """ ConnectionState in string representation """ struct_repr = ", ".join([ - "uuid: " + str(self.uuid), "is_connected: " + str(self.is_connected) ]) @@ -56,9 +49,6 @@ def translate_from_rpc(rpcConnectionState): """ Translates a gRPC struct to the SDK equivalent """ return ConnectionState( - rpcConnectionState.uuid, - - rpcConnectionState.is_connected ) @@ -68,12 +58,6 @@ def translate_to_rpc(self, rpcConnectionState): - rpcConnectionState.uuid = self.uuid - - - - - rpcConnectionState.is_connected = self.is_connected diff --git a/mavsdk/core_pb2.py b/mavsdk/core_pb2.py index 5670c44a..ffc93f43 100644 --- a/mavsdk/core_pb2.py +++ b/mavsdk/core_pb2.py @@ -19,7 +19,7 @@ syntax='proto3', serialized_options=b'\n\016io.mavsdk.coreB\tCoreProto', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x0f\x63ore/core.proto\x12\x0fmavsdk.rpc.core\"!\n\x1fSubscribeConnectionStateRequest\"U\n\x17\x43onnectionStateResponse\x12:\n\x10\x63onnection_state\x18\x01 \x01(\x0b\x32 .mavsdk.rpc.core.ConnectionState\"\x1b\n\x19ListRunningPluginsRequest\"N\n\x1aListRunningPluginsResponse\x12\x30\n\x0bplugin_info\x18\x01 \x03(\x0b\x32\x1b.mavsdk.rpc.core.PluginInfo\"5\n\x0f\x43onnectionState\x12\x0c\n\x04uuid\x18\x01 \x01(\x04\x12\x14\n\x0cis_connected\x18\x02 \x01(\x08\"9\n\nPluginInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\x05\x32\xfa\x01\n\x0b\x43oreService\x12z\n\x18SubscribeConnectionState\x12\x30.mavsdk.rpc.core.SubscribeConnectionStateRequest\x1a(.mavsdk.rpc.core.ConnectionStateResponse\"\x00\x30\x01\x12o\n\x12ListRunningPlugins\x12*.mavsdk.rpc.core.ListRunningPluginsRequest\x1a+.mavsdk.rpc.core.ListRunningPluginsResponse\"\x00\x42\x1b\n\x0eio.mavsdk.coreB\tCoreProtob\x06proto3' + serialized_pb=b'\n\x0f\x63ore/core.proto\x12\x0fmavsdk.rpc.core\"!\n\x1fSubscribeConnectionStateRequest\"U\n\x17\x43onnectionStateResponse\x12:\n\x10\x63onnection_state\x18\x01 \x01(\x0b\x32 .mavsdk.rpc.core.ConnectionState\"\x1b\n\x19ListRunningPluginsRequest\"N\n\x1aListRunningPluginsResponse\x12\x30\n\x0bplugin_info\x18\x01 \x03(\x0b\x32\x1b.mavsdk.rpc.core.PluginInfo\"\'\n\x0f\x43onnectionState\x12\x14\n\x0cis_connected\x18\x02 \x01(\x08\"9\n\nPluginInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\x05\x32\xfa\x01\n\x0b\x43oreService\x12z\n\x18SubscribeConnectionState\x12\x30.mavsdk.rpc.core.SubscribeConnectionStateRequest\x1a(.mavsdk.rpc.core.ConnectionStateResponse\"\x00\x30\x01\x12o\n\x12ListRunningPlugins\x12*.mavsdk.rpc.core.ListRunningPluginsRequest\x1a+.mavsdk.rpc.core.ListRunningPluginsResponse\"\x00\x42\x1b\n\x0eio.mavsdk.coreB\tCoreProtob\x06proto3' ) @@ -148,14 +148,7 @@ create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='uuid', full_name='mavsdk.rpc.core.ConnectionState.uuid', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_connected', full_name='mavsdk.rpc.core.ConnectionState.is_connected', index=1, + name='is_connected', full_name='mavsdk.rpc.core.ConnectionState.is_connected', index=0, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -174,7 +167,7 @@ oneofs=[ ], serialized_start=267, - serialized_end=320, + serialized_end=306, ) @@ -219,8 +212,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=322, - serialized_end=379, + serialized_start=308, + serialized_end=365, ) _CONNECTIONSTATERESPONSE.fields_by_name['connection_state'].message_type = _CONNECTIONSTATE @@ -285,8 +278,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=382, - serialized_end=632, + serialized_start=368, + serialized_end=618, methods=[ _descriptor.MethodDescriptor( name='SubscribeConnectionState', diff --git a/mavsdk/info.py b/mavsdk/info.py index 61fde73c..1396b887 100644 --- a/mavsdk/info.py +++ b/mavsdk/info.py @@ -89,15 +89,20 @@ class Identification: hardware_uid : std::string UID of the hardware. This refers to uid2 of MAVLink. If the system does not support uid2 yet, this is all zeros. + legacy_uid : uint64_t + Legacy UID of the hardware, referred to as uid in MAVLink (formerly exposed during system discovery as UUID). + """ def __init__( self, - hardware_uid): + hardware_uid, + legacy_uid): """ Initializes the Identification object """ self.hardware_uid = hardware_uid + self.legacy_uid = legacy_uid def __equals__(self, to_compare): """ Checks if two Identification are the same """ @@ -105,7 +110,8 @@ def __equals__(self, to_compare): # Try to compare - this likely fails when it is compared to a non # Identification object return \ - (self.hardware_uid == to_compare.hardware_uid) + (self.hardware_uid == to_compare.hardware_uid) and \ + (self.legacy_uid == to_compare.legacy_uid) except AttributeError: return False @@ -113,7 +119,8 @@ def __equals__(self, to_compare): def __str__(self): """ Identification in string representation """ struct_repr = ", ".join([ - "hardware_uid: " + str(self.hardware_uid) + "hardware_uid: " + str(self.hardware_uid), + "legacy_uid: " + str(self.legacy_uid) ]) return f"Identification: [{struct_repr}]" @@ -123,7 +130,10 @@ def translate_from_rpc(rpcIdentification): """ Translates a gRPC struct to the SDK equivalent """ return Identification( - rpcIdentification.hardware_uid + rpcIdentification.hardware_uid, + + + rpcIdentification.legacy_uid ) def translate_to_rpc(self, rpcIdentification): @@ -136,6 +146,12 @@ def translate_to_rpc(self, rpcIdentification): + + + rpcIdentification.legacy_uid = self.legacy_uid + + + class Product: diff --git a/mavsdk/info_pb2.py b/mavsdk/info_pb2.py index f8b66be9..97646860 100644 --- a/mavsdk/info_pb2.py +++ b/mavsdk/info_pb2.py @@ -20,7 +20,7 @@ syntax='proto3', serialized_options=b'\n\016io.mavsdk.infoB\tInfoProto', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x0finfo/info.proto\x12\x0fmavsdk.rpc.info\x1a\x14mavsdk_options.proto\"\x1d\n\x1bGetFlightInformationRequest\"\x82\x01\n\x1cGetFlightInformationResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x30\n\x0b\x66light_info\x18\x02 \x01(\x0b\x32\x1b.mavsdk.rpc.info.FlightInfo\"\x1a\n\x18GetIdentificationRequest\"\x86\x01\n\x19GetIdentificationResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x37\n\x0eidentification\x18\x02 \x01(\x0b\x32\x1f.mavsdk.rpc.info.Identification\"\x13\n\x11GetProductRequest\"q\n\x12GetProductResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12)\n\x07product\x18\x02 \x01(\x0b\x32\x18.mavsdk.rpc.info.Product\"\x13\n\x11GetVersionRequest\"q\n\x12GetVersionResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12)\n\x07version\x18\x02 \x01(\x0b\x32\x18.mavsdk.rpc.info.Version\"\x17\n\x15GetSpeedFactorRequest\"`\n\x16GetSpeedFactorResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x14\n\x0cspeed_factor\x18\x02 \x01(\x01\"6\n\nFlightInfo\x12\x14\n\x0ctime_boot_ms\x18\x01 \x01(\r\x12\x12\n\nflight_uid\x18\x02 \x01(\x04\"&\n\x0eIdentification\x12\x14\n\x0chardware_uid\x18\x01 \x01(\t\"[\n\x07Product\x12\x11\n\tvendor_id\x18\x01 \x01(\x05\x12\x13\n\x0bvendor_name\x18\x02 \x01(\t\x12\x12\n\nproduct_id\x18\x03 \x01(\x05\x12\x14\n\x0cproduct_name\x18\x04 \x01(\t\"\xa7\x02\n\x07Version\x12\x17\n\x0f\x66light_sw_major\x18\x01 \x01(\x05\x12\x17\n\x0f\x66light_sw_minor\x18\x02 \x01(\x05\x12\x17\n\x0f\x66light_sw_patch\x18\x03 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_major\x18\x04 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_minor\x18\x05 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_patch\x18\x06 \x01(\x05\x12\x13\n\x0bos_sw_major\x18\x07 \x01(\x05\x12\x13\n\x0bos_sw_minor\x18\x08 \x01(\x05\x12\x13\n\x0bos_sw_patch\x18\t \x01(\x05\x12\x1a\n\x12\x66light_sw_git_hash\x18\n \x01(\t\x12\x16\n\x0eos_sw_git_hash\x18\x0b \x01(\t\"\xaf\x01\n\nInfoResult\x12\x32\n\x06result\x18\x01 \x01(\x0e\x32\".mavsdk.rpc.info.InfoResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"Y\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\'\n#RESULT_INFORMATION_NOT_RECEIVED_YET\x10\x02\x32\x9d\x04\n\x0bInfoService\x12y\n\x14GetFlightInformation\x12,.mavsdk.rpc.info.GetFlightInformationRequest\x1a-.mavsdk.rpc.info.GetFlightInformationResponse\"\x04\x80\xb5\x18\x01\x12p\n\x11GetIdentification\x12).mavsdk.rpc.info.GetIdentificationRequest\x1a*.mavsdk.rpc.info.GetIdentificationResponse\"\x04\x80\xb5\x18\x01\x12[\n\nGetProduct\x12\".mavsdk.rpc.info.GetProductRequest\x1a#.mavsdk.rpc.info.GetProductResponse\"\x04\x80\xb5\x18\x01\x12[\n\nGetVersion\x12\".mavsdk.rpc.info.GetVersionRequest\x1a#.mavsdk.rpc.info.GetVersionResponse\"\x04\x80\xb5\x18\x01\x12g\n\x0eGetSpeedFactor\x12&.mavsdk.rpc.info.GetSpeedFactorRequest\x1a\'.mavsdk.rpc.info.GetSpeedFactorResponse\"\x04\x80\xb5\x18\x01\x42\x1b\n\x0eio.mavsdk.infoB\tInfoProtob\x06proto3' + serialized_pb=b'\n\x0finfo/info.proto\x12\x0fmavsdk.rpc.info\x1a\x14mavsdk_options.proto\"\x1d\n\x1bGetFlightInformationRequest\"\x82\x01\n\x1cGetFlightInformationResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x30\n\x0b\x66light_info\x18\x02 \x01(\x0b\x32\x1b.mavsdk.rpc.info.FlightInfo\"\x1a\n\x18GetIdentificationRequest\"\x86\x01\n\x19GetIdentificationResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x37\n\x0eidentification\x18\x02 \x01(\x0b\x32\x1f.mavsdk.rpc.info.Identification\"\x13\n\x11GetProductRequest\"q\n\x12GetProductResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12)\n\x07product\x18\x02 \x01(\x0b\x32\x18.mavsdk.rpc.info.Product\"\x13\n\x11GetVersionRequest\"q\n\x12GetVersionResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12)\n\x07version\x18\x02 \x01(\x0b\x32\x18.mavsdk.rpc.info.Version\"\x17\n\x15GetSpeedFactorRequest\"`\n\x16GetSpeedFactorResponse\x12\x30\n\x0binfo_result\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.info.InfoResult\x12\x14\n\x0cspeed_factor\x18\x02 \x01(\x01\"6\n\nFlightInfo\x12\x14\n\x0ctime_boot_ms\x18\x01 \x01(\r\x12\x12\n\nflight_uid\x18\x02 \x01(\x04\":\n\x0eIdentification\x12\x14\n\x0chardware_uid\x18\x01 \x01(\t\x12\x12\n\nlegacy_uid\x18\x02 \x01(\x04\"[\n\x07Product\x12\x11\n\tvendor_id\x18\x01 \x01(\x05\x12\x13\n\x0bvendor_name\x18\x02 \x01(\t\x12\x12\n\nproduct_id\x18\x03 \x01(\x05\x12\x14\n\x0cproduct_name\x18\x04 \x01(\t\"\xa7\x02\n\x07Version\x12\x17\n\x0f\x66light_sw_major\x18\x01 \x01(\x05\x12\x17\n\x0f\x66light_sw_minor\x18\x02 \x01(\x05\x12\x17\n\x0f\x66light_sw_patch\x18\x03 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_major\x18\x04 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_minor\x18\x05 \x01(\x05\x12\x1e\n\x16\x66light_sw_vendor_patch\x18\x06 \x01(\x05\x12\x13\n\x0bos_sw_major\x18\x07 \x01(\x05\x12\x13\n\x0bos_sw_minor\x18\x08 \x01(\x05\x12\x13\n\x0bos_sw_patch\x18\t \x01(\x05\x12\x1a\n\x12\x66light_sw_git_hash\x18\n \x01(\t\x12\x16\n\x0eos_sw_git_hash\x18\x0b \x01(\t\"\xaf\x01\n\nInfoResult\x12\x32\n\x06result\x18\x01 \x01(\x0e\x32\".mavsdk.rpc.info.InfoResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"Y\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\'\n#RESULT_INFORMATION_NOT_RECEIVED_YET\x10\x02\x32\x9d\x04\n\x0bInfoService\x12y\n\x14GetFlightInformation\x12,.mavsdk.rpc.info.GetFlightInformationRequest\x1a-.mavsdk.rpc.info.GetFlightInformationResponse\"\x04\x80\xb5\x18\x01\x12p\n\x11GetIdentification\x12).mavsdk.rpc.info.GetIdentificationRequest\x1a*.mavsdk.rpc.info.GetIdentificationResponse\"\x04\x80\xb5\x18\x01\x12[\n\nGetProduct\x12\".mavsdk.rpc.info.GetProductRequest\x1a#.mavsdk.rpc.info.GetProductResponse\"\x04\x80\xb5\x18\x01\x12[\n\nGetVersion\x12\".mavsdk.rpc.info.GetVersionRequest\x1a#.mavsdk.rpc.info.GetVersionResponse\"\x04\x80\xb5\x18\x01\x12g\n\x0eGetSpeedFactor\x12&.mavsdk.rpc.info.GetSpeedFactorRequest\x1a\'.mavsdk.rpc.info.GetSpeedFactorResponse\"\x04\x80\xb5\x18\x01\x42\x1b\n\x0eio.mavsdk.infoB\tInfoProtob\x06proto3' , dependencies=[mavsdk__options__pb2.DESCRIPTOR,]) @@ -51,8 +51,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=1356, - serialized_end=1445, + serialized_start=1376, + serialized_end=1465, ) _sym_db.RegisterEnumDescriptor(_INFORESULT_RESULT) @@ -431,6 +431,13 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='legacy_uid', full_name='mavsdk.rpc.info.Identification.legacy_uid', index=1, + number=2, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -444,7 +451,7 @@ oneofs=[ ], serialized_start=838, - serialized_end=876, + serialized_end=896, ) @@ -496,8 +503,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=878, - serialized_end=969, + serialized_start=898, + serialized_end=989, ) @@ -598,8 +605,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=972, - serialized_end=1267, + serialized_start=992, + serialized_end=1287, ) @@ -638,8 +645,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1270, - serialized_end=1445, + serialized_start=1290, + serialized_end=1465, ) _GETFLIGHTINFORMATIONRESPONSE.fields_by_name['info_result'].message_type = _INFORESULT @@ -785,8 +792,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=1448, - serialized_end=1989, + serialized_start=1468, + serialized_end=2009, methods=[ _descriptor.MethodDescriptor( name='GetFlightInformation', diff --git a/proto b/proto index 65d11219..a968c018 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 65d11219fb83ec88833dde587ca0ef640628ebc7 +Subproject commit a968c018dd0216425d79307aa382192ed62e2362