Skip to content

Commit 0b3d8ab

Browse files
authored
Merge pull request #367 from mavlink/pr-update-proto
Update proto, mavsdk_server v0.41.0
2 parents 831f68b + 9a93ffc commit 0b3d8ab

37 files changed

+10264
-416
lines changed

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.40.0
1+
v0.41.0

mavsdk/camera.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,17 @@ class Result(Enum):
124124
Camera denied the command
125125
126126
ERROR
127-
An error has occured while executing the command
127+
An error has occurred while executing the command
128128
129129
TIMEOUT
130130
Command timed out
131131
132132
WRONG_ARGUMENT
133133
Command has wrong argument(s)
134134
135+
NO_SYSTEM
136+
No system connected
137+
135138
"""
136139

137140

@@ -143,6 +146,7 @@ class Result(Enum):
143146
ERROR = 5
144147
TIMEOUT = 6
145148
WRONG_ARGUMENT = 7
149+
NO_SYSTEM = 8
146150

147151
def translate_to_rpc(self):
148152
if self == CameraResult.Result.UNKNOWN:
@@ -161,6 +165,8 @@ def translate_to_rpc(self):
161165
return camera_pb2.CameraResult.RESULT_TIMEOUT
162166
if self == CameraResult.Result.WRONG_ARGUMENT:
163167
return camera_pb2.CameraResult.RESULT_WRONG_ARGUMENT
168+
if self == CameraResult.Result.NO_SYSTEM:
169+
return camera_pb2.CameraResult.RESULT_NO_SYSTEM
164170

165171
@staticmethod
166172
def translate_from_rpc(rpc_enum_value):
@@ -181,6 +187,8 @@ def translate_from_rpc(rpc_enum_value):
181187
return CameraResult.Result.TIMEOUT
182188
if rpc_enum_value == camera_pb2.CameraResult.RESULT_WRONG_ARGUMENT:
183189
return CameraResult.Result.WRONG_ARGUMENT
190+
if rpc_enum_value == camera_pb2.CameraResult.RESULT_NO_SYSTEM:
191+
return CameraResult.Result.NO_SYSTEM
184192

185193
def __str__(self):
186194
return self.name

mavsdk/camera_pb2.py

Lines changed: 42 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mavsdk/core.py

Lines changed: 16 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -64,101 +64,11 @@ def translate_to_rpc(self, rpcConnectionState):
6464

6565

6666

67-
class PluginInfo:
68-
"""
69-
Plugin info type.
70-
71-
Parameters
72-
----------
73-
name : std::string
74-
Name of the plugin
75-
76-
address : std::string
77-
Address where the plugin is running
78-
79-
port : int32_t
80-
Port where the plugin is running
81-
82-
"""
83-
84-
85-
86-
def __init__(
87-
self,
88-
name,
89-
address,
90-
port):
91-
""" Initializes the PluginInfo object """
92-
self.name = name
93-
self.address = address
94-
self.port = port
95-
96-
def __equals__(self, to_compare):
97-
""" Checks if two PluginInfo are the same """
98-
try:
99-
# Try to compare - this likely fails when it is compared to a non
100-
# PluginInfo object
101-
return \
102-
(self.name == to_compare.name) and \
103-
(self.address == to_compare.address) and \
104-
(self.port == to_compare.port)
105-
106-
except AttributeError:
107-
return False
108-
109-
def __str__(self):
110-
""" PluginInfo in string representation """
111-
struct_repr = ", ".join([
112-
"name: " + str(self.name),
113-
"address: " + str(self.address),
114-
"port: " + str(self.port)
115-
])
116-
117-
return f"PluginInfo: [{struct_repr}]"
118-
119-
@staticmethod
120-
def translate_from_rpc(rpcPluginInfo):
121-
""" Translates a gRPC struct to the SDK equivalent """
122-
return PluginInfo(
123-
124-
rpcPluginInfo.name,
125-
126-
127-
rpcPluginInfo.address,
128-
129-
130-
rpcPluginInfo.port
131-
)
132-
133-
def translate_to_rpc(self, rpcPluginInfo):
134-
""" Translates this SDK object into its gRPC equivalent """
135-
136-
137-
138-
139-
rpcPluginInfo.name = self.name
140-
141-
142-
143-
144-
145-
rpcPluginInfo.address = self.address
146-
147-
148-
149-
150-
151-
rpcPluginInfo.port = self.port
152-
153-
154-
155-
156-
15767

15868

15969
class Core(AsyncBase):
16070
"""
161-
Access to the connection state and running plugins.
71+
Access to the connection state and core configurations
16272
16373
Generated by dcsdkgen - MAVSDK Core API
16474
"""
@@ -196,26 +106,25 @@ async def connection_state(self):
196106
finally:
197107
connection_state_stream.cancel()
198108

199-
async def list_running_plugins(self):
109+
async def set_mavlink_timeout(self, timeout_s):
200110
"""
201-
Get a list of currently running plugins.
111+
Set timeout of MAVLink transfers.
202112
203-
Returns
204-
-------
205-
plugin_info : [PluginInfo]
206-
Plugin info
113+
The default timeout used is generally (0.5 seconds) seconds.
114+
If MAVSDK is used on the same host this timeout can be reduced, while
115+
if MAVSDK has to communicate over links with high latency it might
116+
need to be increased to prevent timeouts.
117+
118+
Parameters
119+
----------
120+
timeout_s : double
121+
Timeout in seconds
207122
208123
209124
"""
210125

211-
request = core_pb2.ListRunningPluginsRequest()
212-
response = await self._stub.ListRunningPlugins(request)
213-
214-
215-
216-
plugin_info = []
217-
for plugin_info_rpc in response.plugin_info:
218-
plugin_info.append(PluginInfo.translate_from_rpc(plugin_info_rpc))
126+
request = core_pb2.SetMavlinkTimeoutRequest()
127+
request.timeout_s = timeout_s
128+
response = await self._stub.SetMavlinkTimeout(request)
219129

220-
return plugin_info
221-
130+

0 commit comments

Comments
 (0)