bosdyn-mission 5.0.1.1__py3-none-any.whl → 5.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,8 @@
5
5
  # Development Kit License (20191101-BDSDK-SL).
6
6
 
7
7
  """The mission library package.
8
- Sets up some convenience imports for commonly used classes and functions.
8
+
9
+ Sets up some convenience imports for commonly used classes and
10
+ functions.
9
11
  """
10
12
  from .client import MissionClient
11
- from .exceptions import CompileError, Error, UnknownType, ValidationError
bosdyn/mission/client.py CHANGED
@@ -7,7 +7,6 @@
7
7
  """For clients to the mission service."""
8
8
 
9
9
  import collections
10
- from builtins import str as text
11
10
 
12
11
  from google.protobuf import timestamp_pb2
13
12
 
@@ -409,7 +408,7 @@ def _get_state_value(response):
409
408
 
410
409
 
411
410
  def _get_info_value(response):
412
- if response.HasField(text('mission_info')):
411
+ if response.HasField(str('mission_info')):
413
412
  return response.mission_info
414
413
  return None
415
414
 
bosdyn/mission/util.py CHANGED
@@ -11,7 +11,6 @@ import logging
11
11
  import operator
12
12
  import re
13
13
  import typing
14
- from builtins import str as text
15
14
  from typing import Dict, Union
16
15
 
17
16
  import google.protobuf.message
@@ -59,8 +58,7 @@ def tree_to_string(root, start_level=0, include_status=False):
59
58
  if start_level == 0:
60
59
  string += '\n'
61
60
  prefix = '|' + '-' * start_level
62
- string += prefix + text(root) + (' '
63
- if text(root) else '') + '(' + root.__class__.__name__ + ')'
61
+ string += prefix + str(root) + (' ' if str(root) else '') + '(' + root.__class__.__name__ + ')'
64
62
  if include_status:
65
63
  string += '\n' + prefix + 'Status code: [{}]'.format(root.last_result)
66
64
  for child in root.children:
@@ -170,6 +168,12 @@ def proto_from_tuple(tup, pack_nodes=True):
170
168
  else:
171
169
  raise Error('Proto "{}" of type "{}" has {} children!'.format(
172
170
  node.name, inner_type, num_children))
171
+ elif isinstance(inner_proto, nodes_pb2.SimpleParallel):
172
+ if num_children != 2:
173
+ raise Error('Proto "{}" of type "{}" was given {} children but should have 2!'.format(
174
+ node.name, inner_type, num_children))
175
+ inner_proto.primary.CopyFrom(proto_from_tuple(children[0]))
176
+ inner_proto.secondary.CopyFrom(proto_from_tuple(children[1]))
173
177
  elif num_children != 0:
174
178
  raise Error('Proto "{}" of type "{}" was given {} children, but I do not know how to add'
175
179
  ' them!'.format(node.name, inner_type, num_children))
@@ -208,7 +212,8 @@ def python_var_to_value(var) -> util_pb2.ConstantValue:
208
212
 
209
213
 
210
214
  def python_type_to_pb_type(var) -> util_pb2.VariableDeclaration.Type.ValueType:
211
- """Returns the protobuf-schema variable type that corresponds to the given variable."""
215
+ """Returns the protobuf-schema variable type that corresponds to the given
216
+ variable."""
212
217
  if isinstance(var, bool):
213
218
  return util_pb2.VariableDeclaration.TYPE_BOOL
214
219
  elif isinstance(var, int):
@@ -266,7 +271,8 @@ def is_string_identifier(string):
266
271
 
267
272
 
268
273
  def field_desc_to_pb_type(field_desc):
269
- """Returns the protobuf-schema variable type that corresponds to the given descriptor."""
274
+ """Returns the protobuf-schema variable type that corresponds to the given
275
+ descriptor."""
270
276
  if field.label == FieldDescriptor.LABEL_REPEATED:
271
277
  return util_pb2.VariableDeclaration.TYPE_LIST
272
278
  elif field_desc.type in (field_desc.TYPE_UINT32, field_desc.TYPE_UINT64,
@@ -289,7 +295,8 @@ def field_desc_to_pb_type(field_desc):
289
295
 
290
296
 
291
297
  def safe_pb_type_to_string(pb_type):
292
- """Return the stringified VariableDeclaration.Type, or "<unknown>" if the type is invalid."""
298
+ """Return the stringified VariableDeclaration.Type, or "<unknown>" if the
299
+ type is invalid."""
293
300
  try:
294
301
  return util_pb2.VariableDeclaration.Type.Name(pb_type)
295
302
  except ValueError:
@@ -322,7 +329,8 @@ class ResultFromProto:
322
329
 
323
330
 
324
331
  def proto_enum_to_result_constant(proto_msg):
325
- """Returns a Result enum from a util_pb2.Result, or throws InvalidConversion error."""
332
+ """Returns a Result enum from a util_pb2.Result, or throws
333
+ InvalidConversion error."""
326
334
  try:
327
335
  return ResultFromProto.results_from_proto[proto_msg]
328
336
  except KeyError:
@@ -330,7 +338,8 @@ def proto_enum_to_result_constant(proto_msg):
330
338
 
331
339
 
332
340
  def result_constant_to_proto_enum(result):
333
- """Returns a protobuf version of the Result enum, RESULT_UNKNOWN on error."""
341
+ """Returns a protobuf version of the Result enum, RESULT_UNKNOWN on
342
+ error."""
334
343
  if not isinstance(result, constants.Result):
335
344
  raise InvalidConversion(result, util_pb2.Result.DESCRIPTOR.full_name)
336
345
  try:
@@ -363,7 +372,7 @@ def most_restrictive_travel_params(travel_params, vel_limit=None,
363
372
  # Look at max_vel using >=, then min_vel using <=.
364
373
  for min_max, comp in (('max_vel', operator.ge), ('min_vel', operator.le)):
365
374
  # If the other doesn't even have this field, skip to the next one.
366
- if not other.HasField(text(min_max)):
375
+ if not other.HasField(str(min_max)):
367
376
  continue
368
377
 
369
378
  lim_returned = getattr(returned, min_max)
@@ -396,10 +405,10 @@ def get_value_from_constant_value_message(const_proto):
396
405
 
397
406
 
398
407
  def get_value_from_value_message(node, blackboard, value_msg, is_validation=False):
399
- if value_msg.HasField(text("constant")):
408
+ if value_msg.HasField(str("constant")):
400
409
  constant = value_msg.constant
401
410
  return get_value_from_constant_value_message(constant)
402
- elif value_msg.HasField(text("runtime_var")):
411
+ elif value_msg.HasField(str("runtime_var")):
403
412
  return blackboard.read(node, value_msg.runtime_var.name)
404
413
  else:
405
414
  raise AttributeError("Value must be a runtime variable or constant.")
@@ -411,14 +420,14 @@ safe_pb_enum_to_string = moved_to(_bosdyn_client_safe_pb_enum_to_string, version
411
420
  def create_value(
412
421
  var: Union[bool, int, float, str, google.protobuf.message.Message, list,
413
422
  dict]) -> util_pb2.Value:
414
- """Returns a Value message containing a ConstantValue with the appropriate oneof set.
415
- """
423
+ """Returns a Value message containing a ConstantValue with the appropriate
424
+ oneof set."""
416
425
  return util_pb2.Value(constant=python_var_to_value(var))
417
426
 
418
427
 
419
428
  def define_blackboard(dict_values: Dict[str, util_pb2.Value]) -> nodes_pb2.DefineBlackboard:
420
- """Returns a DefineBlackboard protobuf message for the key-value pairs in `dict_values`.
421
- """
429
+ """Returns a DefineBlackboard protobuf message for the key-value pairs in
430
+ `dict_values`."""
422
431
  node_to_return = nodes_pb2.DefineBlackboard()
423
432
  for (key, value) in dict_values.items():
424
433
  node_to_return.blackboard_variables.add().CopyFrom(util_pb2.KeyValue(key=key, value=value))
@@ -427,8 +436,8 @@ def define_blackboard(dict_values: Dict[str, util_pb2.Value]) -> nodes_pb2.Defin
427
436
 
428
437
  def set_blackboard(dict_values: Dict[str, util_pb2.Value],
429
438
  subfield_values: Dict[str, util_pb2.Value] = {}) -> nodes_pb2.SetBlackboard:
430
- """Returns a SetBlackboard protobuf message for the key-value pairs in `dict_values`.
431
- """
439
+ """Returns a SetBlackboard protobuf message for the key-value pairs in
440
+ `dict_values`."""
432
441
  node_to_return = nodes_pb2.SetBlackboard()
433
442
  for (key, value) in dict_values.items():
434
443
  node_to_return.blackboard_variables.add().CopyFrom(util_pb2.KeyValue(key=key, value=value))
@@ -455,13 +464,8 @@ _SEVERITY_TO_LOG_LEVEL = {
455
464
 
456
465
 
457
466
  def severity_to_log_level(text_level):
458
- """Converts alert data severity enum to a logger level for printing purposes."""
467
+ """Converts alert data severity enum to a logger level for printing
468
+ purposes."""
459
469
  return _SEVERITY_TO_LOG_LEVEL.get(text_level, logging.INFO)
460
470
 
461
471
 
462
- # We want to be able to port spotcam-ptz missions to the argos-ptz sensor.
463
- def append_alternate_sensor_names(sensor_names):
464
- if "argos-ptz" in sensor_names:
465
- sensor_names.append("spotcam-ptz")
466
-
467
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bosdyn-mission
3
- Version: 5.0.1.1
3
+ Version: 5.1.0
4
4
  Summary: Boston Dynamics mission code
5
5
  Home-page: https://dev.bostondynamics.com/
6
6
  Author: Boston Dynamics
@@ -15,8 +15,8 @@ Classifier: License :: Other/Proprietary License
15
15
  Classifier: Operating System :: OS Independent
16
16
  Requires-Python: >=3.7
17
17
  Description-Content-Type: text/markdown
18
- Requires-Dist: bosdyn-client (==5.0.1.1)
19
- Requires-Dist: bosdyn-api (==5.0.1.1)
18
+ Requires-Dist: bosdyn-client (==5.1.0)
19
+ Requires-Dist: bosdyn-api (==5.1.0)
20
20
 
21
21
  <!--
22
22
  Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.
@@ -0,0 +1,11 @@
1
+ bosdyn/__init__.py,sha256=CMQioQKK1NlMk3kZuY49b_Aw-JyvDeOtuqOCAul1I0s,330
2
+ bosdyn/mission/__init__.py,sha256=OcIVCAK4KYxExJCZnKn_DRhTRIr2IOuvDpWKFRrJc6c,410
3
+ bosdyn/mission/client.py,sha256=N1EVr1Nd9KpFup_qzR3K1LpsCt-6HwiVSJcxIP0hQIc,22403
4
+ bosdyn/mission/constants.py,sha256=oSsl0XR1-fNzHASGNqs541YEO8qi64eewvbY9ICKaxE,435
5
+ bosdyn/mission/remote_client.py,sha256=quGWyqLzpASgrR6MlnEPoRFCmnTMSBZ6tmr-Wyy9YW0,12190
6
+ bosdyn/mission/server_util.py,sha256=xd9D5VwP6mjbxUcUGCV4gN2AvsmRpL9wyvMpKR6Bmxk,1505
7
+ bosdyn/mission/util.py,sha256=bz7SOFAbg6Zju5Nbunm23XKywTsM-kARx04eu4h3WSc,19611
8
+ bosdyn_mission-5.1.0.dist-info/METADATA,sha256=OnzddEfkJ71pFxkziDV7ccZZAdoXP-YWwaLUDn25ikk,1733
9
+ bosdyn_mission-5.1.0.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
10
+ bosdyn_mission-5.1.0.dist-info/top_level.txt,sha256=an2OWgx1ej2jFjmBjPWNQ68ZglvUfKhmXWW-WhTtDmA,7
11
+ bosdyn_mission-5.1.0.dist-info/RECORD,,
@@ -1,125 +0,0 @@
1
- # Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.
2
- #
3
- # Downloading, reproducing, distributing or otherwise using the SDK Software
4
- # is subject to the terms and conditions of the Boston Dynamics Software
5
- # Development Kit License (20191101-BDSDK-SL).
6
-
7
- from builtins import str as text
8
-
9
- from bosdyn.mission import util
10
-
11
-
12
- class Error(Exception):
13
- """Base exception"""
14
-
15
-
16
- class CompileError(Error):
17
- """Error occurred during compilation."""
18
-
19
- def __init__(self, msg='', node_proto=None):
20
- Error.__init__(self, msg)
21
- self.node_proto = node_proto
22
-
23
- def node_name(self):
24
- """Returns the 'name' field of the Node proto if possible, None otherwise"""
25
- if self.node_proto is None:
26
- return None
27
- try:
28
- return self.node_proto.name
29
- except Exception:
30
- return None
31
-
32
- def node_impl(self):
33
- """Returns the proto type of the Node 'impl' field if possible, None otherwise"""
34
- if self.node_proto is None:
35
- return None
36
- try:
37
- return self.node_proto.impl.TypeName()
38
- except Exception:
39
- return None
40
-
41
- def get_node_details(self):
42
- """Get a string of the node detail."""
43
- details = ''
44
- node_impl = self.node_impl()
45
- if node_impl:
46
- details = f' ({node_impl}'
47
-
48
- node_name = self.node_name()
49
- if node_name is not None:
50
- if not details:
51
- details = ' (???'
52
- details += f' with name "{node_name}")'
53
- return details
54
-
55
- def __str__(self):
56
- msg = super(CompileError, self).__str__()
57
- return msg + self.get_node_details()
58
-
59
-
60
- class UnknownType(CompileError):
61
-
62
- def __str__(self):
63
- return 'Do not know how to build {}'.format(self.node_impl())
64
-
65
-
66
- class ValidationError(Error):
67
- """The mission encountered errors in the validate step.
68
-
69
- Args:
70
- tree: The root node of the compiled mission.
71
- errors: List of ValidationErrorReport.
72
- """
73
-
74
- def __init__(self, tree, errors):
75
- self.tree = tree
76
- self.errors = errors
77
-
78
- def __str__(self):
79
- return 'Encountered {} validation errors: \n\t{}'.format(
80
- len(self.errors), '\n\t'.join([text(e) for e in self.errors]))
81
-
82
-
83
- class MissingParameterError(CompileError):
84
- """Could not find a matching parameter.
85
-
86
- Args:
87
- target_name: Name of the parameter that was missing / mismatched.
88
- target_pb_type: Desired type of the parameter. None if any type was acceptable.
89
- stored_pb_type: Type of the parameter that was stored. None if type was unknown.
90
- """
91
-
92
- def __init__(self, target_name, target_pb_type=None, stored_pb_type=None):
93
- self.target_name = target_name
94
- self.target_pb_type = target_pb_type
95
- self.stored_pb_type = stored_pb_type
96
-
97
- def __str__(self):
98
- if self.target_pb_type != self.stored_pb_type:
99
- return 'Mismatched type for "{}". Stored as {}, wanted {}'.format(
100
- self.target_name, util.safe_pb_type_to_string(self.stored_pb_type),
101
- util.safe_pb_type_to_string(self.target_pb_type))
102
- return 'No parameter "{}"'.format(self.target_name)
103
-
104
-
105
- class InaccessibleParameterError(MissingParameterError):
106
- """Could not read the parameter, though one was provided elsewhere."""
107
-
108
-
109
- class MessageOverrideError(CompileError):
110
- """Failed to override a mission node's field with a Message type."""
111
-
112
- def __init__(self, overriding_message, field_name, field_type):
113
- self.overriding_message = overriding_message
114
- self.field_name = field_name
115
- self.field_type = field_type
116
-
117
- def __str__(self):
118
- return 'Override of type {} cannot be written to field "{}" of type {}'.format(
119
- self.overriding_message.TypeName(), self.field_name, self.field_type)
120
-
121
-
122
- class NodeUnreferenceableError(Error):
123
- """Node cannot be referenced."""
124
-
125
-
@@ -1,12 +0,0 @@
1
- bosdyn/__init__.py,sha256=CMQioQKK1NlMk3kZuY49b_Aw-JyvDeOtuqOCAul1I0s,330
2
- bosdyn/mission/__init__.py,sha256=_BpC0ZVGQ5yH5S8rt_DrTMQkAuxzTn5YlPvwDzeFXdQ,483
3
- bosdyn/mission/client.py,sha256=_jjFZ1FCDNaKKcJ0pzHZ6suADTKcaaXHqp0GV5691M8,22437
4
- bosdyn/mission/constants.py,sha256=oSsl0XR1-fNzHASGNqs541YEO8qi64eewvbY9ICKaxE,435
5
- bosdyn/mission/exceptions.py,sha256=UqGT0XK3zA6Bgwo_7KNC44yi_MvW9h3c8_pHKML8ELQ,3941
6
- bosdyn/mission/remote_client.py,sha256=quGWyqLzpASgrR6MlnEPoRFCmnTMSBZ6tmr-Wyy9YW0,12190
7
- bosdyn/mission/server_util.py,sha256=xd9D5VwP6mjbxUcUGCV4gN2AvsmRpL9wyvMpKR6Bmxk,1505
8
- bosdyn/mission/util.py,sha256=n7ODM0E-4I25BHutzV6ThrgmZHpkWB5YdXDYfexmxcc,19489
9
- bosdyn_mission-5.0.1.1.dist-info/METADATA,sha256=gDybefLkCj8_VXmsPTXsAFNsCoSM3iGSG_NMdX2yafA,1739
10
- bosdyn_mission-5.0.1.1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
11
- bosdyn_mission-5.0.1.1.dist-info/top_level.txt,sha256=an2OWgx1ej2jFjmBjPWNQ68ZglvUfKhmXWW-WhTtDmA,7
12
- bosdyn_mission-5.0.1.1.dist-info/RECORD,,