Util

exception bosdyn.mission.util.Error[source]

Bases: Exception

exception bosdyn.mission.util.InvalidConversion(original_value, destination_typename)[source]

Bases: bosdyn.mission.util.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.is_string_identifier(string)[source]
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.

bosdyn.mission.util.one_line_str(msg)[source]
bosdyn.mission.util.node_spec_to_short_string(node_spec, maxlen=15)[source]
class bosdyn.mission.util.ResultFromProto[source]

Bases: object

results_from_proto = {1: <Result.FAILURE: 1>, 2: <Result.RUNNING: 2>, 3: <Result.SUCCESS: 3>, 4: <Result.ERROR: 4>}
proto_from_results = {<Result.FAILURE: 1>: 1, <Result.RUNNING: 2>: 2, <Result.SUCCESS: 3>: 3, <Result.ERROR: 4>: 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.

bosdyn.mission.util.most_restrictive_travel_params(travel_params, vel_limit=None)[source]
bosdyn.mission.util.get_value_from_constant_value_message(const_proto)[source]
bosdyn.mission.util.get_value_from_value_message(node, blackboard, value_msg)[source]
bosdyn.mission.util.safe_pb_enum_to_string(value, pb_enum_obj)[source]