Util

exception bosdyn.mission.util.Error[source]

Bases: Exception

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.type_to_field_name(type_name)[source]

Use type name to reconstruct field name of bosdyn.api.mission.Node.type Example: SimpleParallel becomes simple_parallel

bosdyn.mission.util.proto_from_tuple(tup, pack_nodes=True)[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, 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.

bosdyn.mission.util.most_restrictive_travel_params(travel_params, vel_limit=None, disable_directed_exploration=False, disable_alternate_route_finding=False, path_following_mode=None, ground_clutter_mode=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, is_validation=False)[source]
bosdyn.mission.util.create_value(var: bool | int | float | str | Message) Value[source]

Returns a Value message containing a ConstantValue with the appropriate oneof set.

bosdyn.mission.util.define_blackboard(dict_values: Dict[str, Value]) DefineBlackboard[source]

Returns a DefineBlackboard protobuf message for the key-value pairs in dict_values.

bosdyn.mission.util.set_blackboard(dict_values: Dict[str, Value]) SetBlackboard[source]

Returns a SetBlackboard protobuf message for the key-value pairs in dict_values.