How to use the mavsdk.generated.action_pb2 function in mavsdk

To help you get started, we’ve selected a few mavsdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def reboot(self):
        """
         Send command to reboot the drone components.

         This will reboot the autopilot, companion computer, camera and gimbal.

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

        request = action_pb2.RebootRequest()
        response = await self._stub.Reboot(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "reboot()")
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def disarm(self):
        """
         Send command to disarm the drone.

         This will disarm a drone that considers itself landed. If flying, the drone should
         reject the disarm command. Disarming means that all motors will stop.

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

        request = action_pb2.DisarmRequest()
        response = await self._stub.Disarm(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "disarm()")
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def arm(self):
        """
         Send command to arm the drone.

         Arming a drone normally causes motors to spin at idle.
         Before arming take all safety precautions and stand clear of the drone!

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

        request = action_pb2.ArmRequest()
        response = await self._stub.Arm(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "arm()")
github mavlink / MAVSDK-Python / mavsdk / generated / action_pb2_grpc.py View on Github external
response_serializer=action__pb2.ReturnToLaunchResponse.SerializeToString,
      ),
      'TransitionToFixedWing': grpc.unary_unary_rpc_method_handler(
          servicer.TransitionToFixedWing,
          request_deserializer=action__pb2.TransitionToFixedWingRequest.FromString,
          response_serializer=action__pb2.TransitionToFixedWingResponse.SerializeToString,
      ),
      'TransitionToMulticopter': grpc.unary_unary_rpc_method_handler(
          servicer.TransitionToMulticopter,
          request_deserializer=action__pb2.TransitionToMulticopterRequest.FromString,
          response_serializer=action__pb2.TransitionToMulticopterResponse.SerializeToString,
      ),
      'GetTakeoffAltitude': grpc.unary_unary_rpc_method_handler(
          servicer.GetTakeoffAltitude,
          request_deserializer=action__pb2.GetTakeoffAltitudeRequest.FromString,
          response_serializer=action__pb2.GetTakeoffAltitudeResponse.SerializeToString,
      ),
      'SetTakeoffAltitude': grpc.unary_unary_rpc_method_handler(
          servicer.SetTakeoffAltitude,
          request_deserializer=action__pb2.SetTakeoffAltitudeRequest.FromString,
          response_serializer=action__pb2.SetTakeoffAltitudeResponse.SerializeToString,
      ),
      'GetMaximumSpeed': grpc.unary_unary_rpc_method_handler(
          servicer.GetMaximumSpeed,
          request_deserializer=action__pb2.GetMaximumSpeedRequest.FromString,
          response_serializer=action__pb2.GetMaximumSpeedResponse.SerializeToString,
      ),
      'SetMaximumSpeed': grpc.unary_unary_rpc_method_handler(
          servicer.SetMaximumSpeed,
          request_deserializer=action__pb2.SetMaximumSpeedRequest.FromString,
          response_serializer=action__pb2.SetMaximumSpeedResponse.SerializeToString,
      ),
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def set_return_to_launch_altitude(self, relative_altitude_m):
        """
         Set the return to launch minimum return altitude (in meters).

         Parameters
         ----------
         relative_altitude_m : float
              Return altitude relative to takeoff location (in meters)

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

        request = action_pb2.SetReturnToLaunchAltitudeRequest()
        request.relative_altitude_m = relative_altitude_m
        response = await self._stub.SetReturnToLaunchAltitude(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "set_return_to_launch_altitude()", relative_altitude_m)
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def land(self):
        """
         Send command to land at the current position.

         This switches the drone to 'Land' flight mode.

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

        request = action_pb2.LandRequest()
        response = await self._stub.Land(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "land()")
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
def translate_to_rpc(self, rpcResult):
            return {
                    0: action_pb2.ActionResult.UNKNOWN,
                    1: action_pb2.ActionResult.SUCCESS,
                    2: action_pb2.ActionResult.NO_SYSTEM,
                    3: action_pb2.ActionResult.CONNECTION_ERROR,
                    4: action_pb2.ActionResult.BUSY,
                    5: action_pb2.ActionResult.COMMAND_DENIED,
                    6: action_pb2.ActionResult.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
                    7: action_pb2.ActionResult.COMMAND_DENIED_NOT_LANDED,
                    8: action_pb2.ActionResult.TIMEOUT,
                    9: action_pb2.ActionResult.VTOL_TRANSITION_SUPPORT_UNKNOWN,
                    10: action_pb2.ActionResult.NO_VTOL_TRANSITION_SUPPORT,
                    11: action_pb2.ActionResult.PARAMETER_ERROR
                }.get(self.value, None)
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def kill(self):
        """
         Send command to kill the drone. 

         This will disarm a drone irrespective of whether it is landed or flying.
         Note that the drone will fall out of the sky if this command is used while flying.

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

        request = action_pb2.KillRequest()
        response = await self._stub.Kill(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "kill()")
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def return_to_launch(self):
        """
         Send command to return to the launch (takeoff) position and land.

         This switches the drone into [RTL mode](https://docs.px4.io/en/flight_modes/rtl.html) which
         generally means it will rise up to a certain altitude to clear any obstacles before heading
         back to the launch (takeoff) position and land there.

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

        request = action_pb2.ReturnToLaunchRequest()
        response = await self._stub.ReturnToLaunch(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "return_to_launch()")
github mavlink / MAVSDK-Python / mavsdk / generated / action.py View on Github external
async def get_return_to_launch_altitude(self):
        """
         Get the return to launch minimum return altitude (in meters).

         Returns
         -------
         relative_altitude_m : float
              Return altitude relative to takeoff location (in meters)

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

        request = action_pb2.GetReturnToLaunchAltitudeRequest()
        response = await self._stub.GetReturnToLaunchAltitude(request)

        
        result = self._extract_result(response)

        if result.result is not ActionResult.Result.SUCCESS:
            raise ActionError(result, "get_return_to_launch_altitude()")
        

        return response.relative_altitude_m