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: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
-------
flight_mode : FlightMode
The next flight mode
"""
request = telemetry_pb2.SubscribeFlightModeRequest()
flight_mode_stream = self._stub.SubscribeFlightMode(request)
try:
async for response in flight_mode_stream:
yield FlightMode.translate_from_rpc(response.flight_mode)
finally:
flight_mode_stream.cancel()
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: FlightMode.UNKNOWN,
1: FlightMode.READY,
2: FlightMode.TAKEOFF,
3: FlightMode.HOLD,
4: FlightMode.MISSION,
5: FlightMode.RETURN_TO_LAUNCH,
6: FlightMode.LAND,
7: FlightMode.OFFBOARD,
8: FlightMode.FOLLOW_ME,
}.get(rpc_enum_value, None)