Util
- exception bosdyn.mission.util.InvalidConversion(original_value, destination_typename)[source]
Bases:
Error
Could not convert the provided value to the destination type.
- bosdyn.mission.util.tree_to_string(root, start_level=0, include_status=False)[source]
Get a string representation of a Node, interpreted as a tree.
- bosdyn.mission.util.proto_from_tuple(tup)[source]
Return a bosdyn.api.mission Node from a tuple. EXPERIMENTAL.
Example: :: (‘do-A-then-B’, bosdyn.api.mission.nodes_pb2.Sequence(always_restart=True), [ (‘A’, foo.bar.Command(…), []), (‘B’, foo.bar.Command(…), []), ] ) would make a Sequence named ‘do-A-then-B’ that always restarted, executing some Command named ‘A’ followed by the Command named ‘B’. NOTE: The “List of children tuples” will only work if the parent node has ‘child’ or ‘children’ attributes. See tests/test_util.py for a longer example.
- Parameters:
tup – (Name of node, Instantiated implementation of node protobuf, List of children tuples)
- bosdyn.mission.util.python_var_to_value(var)[source]
Returns a ConstantValue with the appropriate oneof set.
- bosdyn.mission.util.python_type_to_pb_type(var)[source]
Returns the protobuf-schema variable type that corresponds to the given variable.
- bosdyn.mission.util.field_desc_to_pb_type(field_desc)[source]
Returns the protobuf-schema variable type that corresponds to the given descriptor.
- bosdyn.mission.util.safe_pb_type_to_string(pb_type)[source]
Return the stringified VariableDeclaration.Type, or “<unknown>” if the type is invalid.
- class bosdyn.mission.util.ResultFromProto[source]
Bases:
object
- results_from_proto = {1: Result.FAILURE, 2: Result.RUNNING, 3: Result.SUCCESS, 4: Result.ERROR}
- proto_from_results = {Result.FAILURE: 1, Result.RUNNING: 2, Result.SUCCESS: 3, Result.ERROR: 4}
- bosdyn.mission.util.proto_enum_to_result_constant(proto_msg)[source]
Returns a Result enum from a util_pb2.Result, or throws InvalidConversion error.
- bosdyn.mission.util.result_constant_to_proto_enum(result)[source]
Returns a protobuf version of the Result enum, RESULT_UNKNOWN on error.