Skip to content

Commit a9e30ed

Browse files
committed
Update to MAVSDK v2.8.0
Signed-off-by: Julian Oes <[email protected]>
1 parent 8320ad7 commit a9e30ed

File tree

7 files changed

+232
-115
lines changed

7 files changed

+232
-115
lines changed

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.7.0
1+
v2.8.0

mavsdk/action.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,31 @@ async def arm(self):
336336
raise ActionError(result, "arm()")
337337

338338

339+
async def arm_force(self):
340+
"""
341+
Send command to force-arm the drone without any checks.
342+
343+
Attention: this is not to be used for normal flying but only bench tests!
344+
345+
Arming a drone normally causes motors to spin at idle.
346+
Before arming take all safety precautions and stand clear of the drone!
347+
348+
Raises
349+
------
350+
ActionError
351+
If the request fails. The error contains the reason for the failure.
352+
"""
353+
354+
request = action_pb2.ArmForceRequest()
355+
response = await self._stub.ArmForce(request)
356+
357+
358+
result = self._extract_result(response)
359+
360+
if result.result != ActionResult.Result.SUCCESS:
361+
raise ActionError(result, "arm_force()")
362+
363+
339364
async def disarm(self):
340365
"""
341366
Send command to disarm the drone.

mavsdk/action_pb2.py

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

mavsdk/action_pb2_grpc.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ def __init__(self, channel):
2020
request_serializer=action_dot_action__pb2.ArmRequest.SerializeToString,
2121
response_deserializer=action_dot_action__pb2.ArmResponse.FromString,
2222
)
23+
self.ArmForce = channel.unary_unary(
24+
'/mavsdk.rpc.action.ActionService/ArmForce',
25+
request_serializer=action_dot_action__pb2.ArmForceRequest.SerializeToString,
26+
response_deserializer=action_dot_action__pb2.ArmForceResponse.FromString,
27+
)
2328
self.Disarm = channel.unary_unary(
2429
'/mavsdk.rpc.action.ActionService/Disarm',
2530
request_serializer=action_dot_action__pb2.DisarmRequest.SerializeToString,
@@ -142,6 +147,19 @@ def Arm(self, request, context):
142147
context.set_details('Method not implemented!')
143148
raise NotImplementedError('Method not implemented!')
144149

150+
def ArmForce(self, request, context):
151+
"""
152+
Send command to force-arm the drone without any checks.
153+
154+
Attention: this is not to be used for normal flying but only bench tests!
155+
156+
Arming a drone normally causes motors to spin at idle.
157+
Before arming take all safety precautions and stand clear of the drone!
158+
"""
159+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
160+
context.set_details('Method not implemented!')
161+
raise NotImplementedError('Method not implemented!')
162+
145163
def Disarm(self, request, context):
146164
"""
147165
Send command to disarm the drone.
@@ -369,6 +387,11 @@ def add_ActionServiceServicer_to_server(servicer, server):
369387
request_deserializer=action_dot_action__pb2.ArmRequest.FromString,
370388
response_serializer=action_dot_action__pb2.ArmResponse.SerializeToString,
371389
),
390+
'ArmForce': grpc.unary_unary_rpc_method_handler(
391+
servicer.ArmForce,
392+
request_deserializer=action_dot_action__pb2.ArmForceRequest.FromString,
393+
response_serializer=action_dot_action__pb2.ArmForceResponse.SerializeToString,
394+
),
372395
'Disarm': grpc.unary_unary_rpc_method_handler(
373396
servicer.Disarm,
374397
request_deserializer=action_dot_action__pb2.DisarmRequest.FromString,
@@ -502,6 +525,23 @@ def Arm(request,
502525
options, channel_credentials,
503526
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
504527

528+
@staticmethod
529+
def ArmForce(request,
530+
target,
531+
options=(),
532+
channel_credentials=None,
533+
call_credentials=None,
534+
insecure=False,
535+
compression=None,
536+
wait_for_ready=None,
537+
timeout=None,
538+
metadata=None):
539+
return grpc.experimental.unary_unary(request, target, '/mavsdk.rpc.action.ActionService/ArmForce',
540+
action_dot_action__pb2.ArmForceRequest.SerializeToString,
541+
action_dot_action__pb2.ArmForceResponse.FromString,
542+
options, channel_credentials,
543+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
544+
505545
@staticmethod
506546
def Disarm(request,
507547
target,

mavsdk/info.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@ class FlightInfo:
1818
flight_uid : uint64_t
1919
Flight counter. Starts from zero, is incremented at every disarm and is never reset (even after reboot)
2020
21+
duration_since_arming_ms : uint32_t
22+
Duration since arming in milliseconds
23+
24+
duration_since_takeoff_ms : uint32_t
25+
Duration since takeoff in milliseconds
26+
2127
"""
2228

2329

2430

2531
def __init__(
2632
self,
2733
time_boot_ms,
28-
flight_uid):
34+
flight_uid,
35+
duration_since_arming_ms,
36+
duration_since_takeoff_ms):
2937
""" Initializes the FlightInfo object """
3038
self.time_boot_ms = time_boot_ms
3139
self.flight_uid = flight_uid
40+
self.duration_since_arming_ms = duration_since_arming_ms
41+
self.duration_since_takeoff_ms = duration_since_takeoff_ms
3242

3343
def __eq__(self, to_compare):
3444
""" Checks if two FlightInfo are the same """
@@ -37,7 +47,9 @@ def __eq__(self, to_compare):
3747
# FlightInfo object
3848
return \
3949
(self.time_boot_ms == to_compare.time_boot_ms) and \
40-
(self.flight_uid == to_compare.flight_uid)
50+
(self.flight_uid == to_compare.flight_uid) and \
51+
(self.duration_since_arming_ms == to_compare.duration_since_arming_ms) and \
52+
(self.duration_since_takeoff_ms == to_compare.duration_since_takeoff_ms)
4153

4254
except AttributeError:
4355
return False
@@ -46,7 +58,9 @@ def __str__(self):
4658
""" FlightInfo in string representation """
4759
struct_repr = ", ".join([
4860
"time_boot_ms: " + str(self.time_boot_ms),
49-
"flight_uid: " + str(self.flight_uid)
61+
"flight_uid: " + str(self.flight_uid),
62+
"duration_since_arming_ms: " + str(self.duration_since_arming_ms),
63+
"duration_since_takeoff_ms: " + str(self.duration_since_takeoff_ms)
5064
])
5165

5266
return f"FlightInfo: [{struct_repr}]"
@@ -59,7 +73,13 @@ def translate_from_rpc(rpcFlightInfo):
5973
rpcFlightInfo.time_boot_ms,
6074

6175

62-
rpcFlightInfo.flight_uid
76+
rpcFlightInfo.flight_uid,
77+
78+
79+
rpcFlightInfo.duration_since_arming_ms,
80+
81+
82+
rpcFlightInfo.duration_since_takeoff_ms
6383
)
6484

6585
def translate_to_rpc(self, rpcFlightInfo):
@@ -78,6 +98,18 @@ def translate_to_rpc(self, rpcFlightInfo):
7898

7999

80100

101+
102+
103+
rpcFlightInfo.duration_since_arming_ms = self.duration_since_arming_ms
104+
105+
106+
107+
108+
109+
rpcFlightInfo.duration_since_takeoff_ms = self.duration_since_takeoff_ms
110+
111+
112+
81113

82114

83115
class Identification:

mavsdk/info_pb2.py

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

proto

Submodule proto updated from 1acb789 to e3f50d4

0 commit comments

Comments
 (0)