Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpcActionResult):
""" Translates a gRPC struct to the SDK equivalent """
return ActionResult(
ActionResult.Result.translate_from_rpc(rpcActionResult.result),
rpcActionResult.result_str
)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
command will fail). The command will succeed if called when the vehicle
is already in fixedwing mode.
Raises
------
ActionError
If the request fails. The error contains the reason for the failure.
"""
request = action_pb2.TransitionToFixedWingRequest()
response = await self._stub.TransitionToFixedWing(request)
result = self._extract_result(response)
if result.result is not ActionResult.Result.SUCCESS:
raise ActionError(result, "transition_to_fixed_wing()")
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: ActionResult.Result.UNKNOWN,
1: ActionResult.Result.SUCCESS,
2: ActionResult.Result.NO_SYSTEM,
3: ActionResult.Result.CONNECTION_ERROR,
4: ActionResult.Result.BUSY,
5: ActionResult.Result.COMMAND_DENIED,
6: ActionResult.Result.COMMAND_DENIED_LANDED_STATE_UNKNOWN,
7: ActionResult.Result.COMMAND_DENIED_NOT_LANDED,
8: ActionResult.Result.TIMEOUT,
9: ActionResult.Result.VTOL_TRANSITION_SUPPORT_UNKNOWN,
10: ActionResult.Result.NO_VTOL_TRANSITION_SUPPORT,
11: ActionResult.Result.PARAMETER_ERROR,
}.get(rpc_enum_value, None)