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: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpcOffboardResult):
""" Translates a gRPC struct to the SDK equivalent """
return OffboardResult(
OffboardResult.Result.translate_from_rpc(rpcOffboardResult.result),
rpcOffboardResult.result_str
)
"""
Start offboard control.
Raises
------
OffboardError
If the request fails. The error contains the reason for the failure.
"""
request = offboard_pb2.StartRequest()
response = await self._stub.Start(request)
result = self._extract_result(response)
if result.result is not OffboardResult.Result.SUCCESS:
raise OffboardError(result, "start()")
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: OffboardResult.Result.UNKNOWN,
1: OffboardResult.Result.SUCCESS,
2: OffboardResult.Result.NO_SYSTEM,
3: OffboardResult.Result.CONNECTION_ERROR,
4: OffboardResult.Result.BUSY,
5: OffboardResult.Result.COMMAND_DENIED,
6: OffboardResult.Result.TIMEOUT,
7: OffboardResult.Result.NO_SETPOINT_SET,
}.get(rpc_enum_value, None)