Skip to content

Commit fd6a162

Browse files
Merge pull request #353 from mavlink/update-to-v0.40.0
Update mavsdk to v0.40.0
2 parents 225acdc + d6aa6ba commit fd6a162

File tree

9 files changed

+260
-100
lines changed

9 files changed

+260
-100
lines changed

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
v0.39.0
2-
3-
4-
1+
v0.40.0

mavsdk/action.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,36 @@ async def hold(self):
617617
raise ActionError(result, "hold()")
618618

619619

620+
async def set_actuator(self, index, value):
621+
"""
622+
Send command to set the value of an actuator.
623+
624+
Parameters
625+
----------
626+
index : int32_t
627+
Index of actuator (starting with 1)
628+
629+
value : float
630+
Value to set the actuator to (normalized from [-1..1])
631+
632+
Raises
633+
------
634+
ActionError
635+
If the request fails. The error contains the reason for the failure.
636+
"""
637+
638+
request = action_pb2.SetActuatorRequest()
639+
request.index = index
640+
request.value = value
641+
response = await self._stub.SetActuator(request)
642+
643+
644+
result = self._extract_result(response)
645+
646+
if result.result is not ActionResult.Result.SUCCESS:
647+
raise ActionError(result, "set_actuator()", index, value)
648+
649+
620650
async def transition_to_fixedwing(self):
621651
"""
622652
Send command to transition the drone to fixedwing.

mavsdk/action_pb2.py

Lines changed: 147 additions & 49 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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def __init__(self, channel):
7575
request_serializer=action_dot_action__pb2.HoldRequest.SerializeToString,
7676
response_deserializer=action_dot_action__pb2.HoldResponse.FromString,
7777
)
78+
self.SetActuator = channel.unary_unary(
79+
'/mavsdk.rpc.action.ActionService/SetActuator',
80+
request_serializer=action_dot_action__pb2.SetActuatorRequest.SerializeToString,
81+
response_deserializer=action_dot_action__pb2.SetActuatorResponse.FromString,
82+
)
7883
self.TransitionToFixedwing = channel.unary_unary(
7984
'/mavsdk.rpc.action.ActionService/TransitionToFixedwing',
8085
request_serializer=action_dot_action__pb2.TransitionToFixedwingRequest.SerializeToString,
@@ -258,6 +263,14 @@ def Hold(self, request, context):
258263
context.set_details('Method not implemented!')
259264
raise NotImplementedError('Method not implemented!')
260265

266+
def SetActuator(self, request, context):
267+
"""
268+
Send command to set the value of an actuator.
269+
"""
270+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
271+
context.set_details('Method not implemented!')
272+
raise NotImplementedError('Method not implemented!')
273+
261274
def TransitionToFixedwing(self, request, context):
262275
"""
263276
Send command to transition the drone to fixedwing.
@@ -393,6 +406,11 @@ def add_ActionServiceServicer_to_server(servicer, server):
393406
request_deserializer=action_dot_action__pb2.HoldRequest.FromString,
394407
response_serializer=action_dot_action__pb2.HoldResponse.SerializeToString,
395408
),
409+
'SetActuator': grpc.unary_unary_rpc_method_handler(
410+
servicer.SetActuator,
411+
request_deserializer=action_dot_action__pb2.SetActuatorRequest.FromString,
412+
response_serializer=action_dot_action__pb2.SetActuatorResponse.SerializeToString,
413+
),
396414
'TransitionToFixedwing': grpc.unary_unary_rpc_method_handler(
397415
servicer.TransitionToFixedwing,
398416
request_deserializer=action_dot_action__pb2.TransitionToFixedwingRequest.FromString,
@@ -648,6 +666,23 @@ def Hold(request,
648666
options, channel_credentials,
649667
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
650668

669+
@staticmethod
670+
def SetActuator(request,
671+
target,
672+
options=(),
673+
channel_credentials=None,
674+
call_credentials=None,
675+
insecure=False,
676+
compression=None,
677+
wait_for_ready=None,
678+
timeout=None,
679+
metadata=None):
680+
return grpc.experimental.unary_unary(request, target, '/mavsdk.rpc.action.ActionService/SetActuator',
681+
action_dot_action__pb2.SetActuatorRequest.SerializeToString,
682+
action_dot_action__pb2.SetActuatorResponse.FromString,
683+
options, channel_credentials,
684+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
685+
651686
@staticmethod
652687
def TransitionToFixedwing(request,
653688
target,

mavsdk/core.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ class ConnectionState:
1212
1313
Parameters
1414
----------
15-
uuid : uint64_t
16-
UUID of the vehicle
17-
1815
is_connected : bool
1916
Whether the vehicle got connected or disconnected
2017
@@ -24,10 +21,8 @@ class ConnectionState:
2421

2522
def __init__(
2623
self,
27-
uuid,
2824
is_connected):
2925
""" Initializes the ConnectionState object """
30-
self.uuid = uuid
3126
self.is_connected = is_connected
3227

3328
def __equals__(self, to_compare):
@@ -36,7 +31,6 @@ def __equals__(self, to_compare):
3631
# Try to compare - this likely fails when it is compared to a non
3732
# ConnectionState object
3833
return \
39-
(self.uuid == to_compare.uuid) and \
4034
(self.is_connected == to_compare.is_connected)
4135

4236
except AttributeError:
@@ -45,7 +39,6 @@ def __equals__(self, to_compare):
4539
def __str__(self):
4640
""" ConnectionState in string representation """
4741
struct_repr = ", ".join([
48-
"uuid: " + str(self.uuid),
4942
"is_connected: " + str(self.is_connected)
5043
])
5144

@@ -56,9 +49,6 @@ def translate_from_rpc(rpcConnectionState):
5649
""" Translates a gRPC struct to the SDK equivalent """
5750
return ConnectionState(
5851

59-
rpcConnectionState.uuid,
60-
61-
6252
rpcConnectionState.is_connected
6353
)
6454

@@ -68,12 +58,6 @@ def translate_to_rpc(self, rpcConnectionState):
6858

6959

7060

71-
rpcConnectionState.uuid = self.uuid
72-
73-
74-
75-
76-
7761
rpcConnectionState.is_connected = self.is_connected
7862

7963

mavsdk/core_pb2.py

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

mavsdk/info.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,38 @@ class Identification:
8989
hardware_uid : std::string
9090
UID of the hardware. This refers to uid2 of MAVLink. If the system does not support uid2 yet, this is all zeros.
9191
92+
legacy_uid : uint64_t
93+
Legacy UID of the hardware, referred to as uid in MAVLink (formerly exposed during system discovery as UUID).
94+
9295
"""
9396

9497

9598

9699
def __init__(
97100
self,
98-
hardware_uid):
101+
hardware_uid,
102+
legacy_uid):
99103
""" Initializes the Identification object """
100104
self.hardware_uid = hardware_uid
105+
self.legacy_uid = legacy_uid
101106

102107
def __equals__(self, to_compare):
103108
""" Checks if two Identification are the same """
104109
try:
105110
# Try to compare - this likely fails when it is compared to a non
106111
# Identification object
107112
return \
108-
(self.hardware_uid == to_compare.hardware_uid)
113+
(self.hardware_uid == to_compare.hardware_uid) and \
114+
(self.legacy_uid == to_compare.legacy_uid)
109115

110116
except AttributeError:
111117
return False
112118

113119
def __str__(self):
114120
""" Identification in string representation """
115121
struct_repr = ", ".join([
116-
"hardware_uid: " + str(self.hardware_uid)
122+
"hardware_uid: " + str(self.hardware_uid),
123+
"legacy_uid: " + str(self.legacy_uid)
117124
])
118125

119126
return f"Identification: [{struct_repr}]"
@@ -123,7 +130,10 @@ def translate_from_rpc(rpcIdentification):
123130
""" Translates a gRPC struct to the SDK equivalent """
124131
return Identification(
125132

126-
rpcIdentification.hardware_uid
133+
rpcIdentification.hardware_uid,
134+
135+
136+
rpcIdentification.legacy_uid
127137
)
128138

129139
def translate_to_rpc(self, rpcIdentification):
@@ -136,6 +146,12 @@ def translate_to_rpc(self, rpcIdentification):
136146

137147

138148

149+
150+
151+
rpcIdentification.legacy_uid = self.legacy_uid
152+
153+
154+
139155

140156

141157
class Product:

mavsdk/info_pb2.py

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

proto

Submodule proto updated from 65d1121 to a968c01

0 commit comments

Comments
 (0)