Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to mavsdk_server v2.9.0 #680

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MAVSDK_SERVER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.8.1
v2.9.0
26 changes: 25 additions & 1 deletion mavsdk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,28 @@ async def get_speed_factor(self):


return response.speed_factor



async def flight_information(self):
"""
Subscribe to 'flight information' updates.

Yields
-------
flight_info : FlightInfo
The next flight information


"""

request = info_pb2.SubscribeFlightInformationRequest()
flight_information_stream = self._stub.SubscribeFlightInformation(request)

try:
async for response in flight_information_stream:



yield FlightInfo.translate_from_rpc(response.flight_info)
finally:
flight_information_stream.cancel()
56 changes: 39 additions & 17 deletions mavsdk/info_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions mavsdk/info_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def __init__(self, channel):
request_serializer=info_dot_info__pb2.GetSpeedFactorRequest.SerializeToString,
response_deserializer=info_dot_info__pb2.GetSpeedFactorResponse.FromString,
)
self.SubscribeFlightInformation = channel.unary_stream(
'/mavsdk.rpc.info.InfoService/SubscribeFlightInformation',
request_serializer=info_dot_info__pb2.SubscribeFlightInformationRequest.SerializeToString,
response_deserializer=info_dot_info__pb2.FlightInformationResponse.FromString,
)


class InfoServiceServicer(object):
Expand Down Expand Up @@ -81,6 +86,13 @@ def GetSpeedFactor(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def SubscribeFlightInformation(self, request, context):
"""Subscribe to 'flight information' updates.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_InfoServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand Down Expand Up @@ -109,6 +121,11 @@ def add_InfoServiceServicer_to_server(servicer, server):
request_deserializer=info_dot_info__pb2.GetSpeedFactorRequest.FromString,
response_serializer=info_dot_info__pb2.GetSpeedFactorResponse.SerializeToString,
),
'SubscribeFlightInformation': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeFlightInformation,
request_deserializer=info_dot_info__pb2.SubscribeFlightInformationRequest.FromString,
response_serializer=info_dot_info__pb2.FlightInformationResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'mavsdk.rpc.info.InfoService', rpc_method_handlers)
Expand Down Expand Up @@ -204,3 +221,20 @@ def GetSpeedFactor(request,
info_dot_info__pb2.GetSpeedFactorResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SubscribeFlightInformation(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_stream(request, target, '/mavsdk.rpc.info.InfoService/SubscribeFlightInformation',
info_dot_info__pb2.SubscribeFlightInformationRequest.SerializeToString,
info_dot_info__pb2.FlightInformationResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
2 changes: 1 addition & 1 deletion proto
Submodule proto updated from e3f50d to debaac