Frame Helpers

exception bosdyn.client.frame_helpers.Error[source]

Bases: Exception

exception bosdyn.client.frame_helpers.ValidateFrameTreeError[source]

Bases: Error

exception bosdyn.client.frame_helpers.ValidateFrameTreeUnknownFrameError[source]

Bases: ValidateFrameTreeError

exception bosdyn.client.frame_helpers.ValidateFrameTreeCycleError[source]

Bases: ValidateFrameTreeError

exception bosdyn.client.frame_helpers.ValidateFrameTreeDisjointError[source]

Bases: ValidateFrameTreeError

bosdyn.client.frame_helpers.validate_frame_tree_snapshot(frame_tree_snapshot)[source]

Validates that a FrameTreeSnapshot is well-formed.

A FrameTreeSnapshot is expected to be a single tree, but poorly written services can misuse the syntax to construct other data structures. The syntax prevents DAGs from forming, but the data structure could

Valid FrameTrees must be a single-rooted tree. However, the general format of repeated edges may not actually be valid - there could be cycles, disjoint trees, or missing edges in the actual data structure.

Inputs:

frame_tree_snapshot: A snapshot of the data.

Returns:

True if valid

Raises:

ValidateFrameTreeError in a number of cases – Empty tree, invalid frame names in the tree, missing transforms relating the two nodes, cycles in the tree, the tree is actually a DAG, and disconnected trees.

bosdyn.client.frame_helpers.get_a_tform_b(frame_tree_snapshot, frame_a, frame_b, validate=True)[source]

Get the SE(3) pose representing the transform between frame_a and frame_b.

Using frame_tree_snapshot, find the math_helpers.SE3Pose to transform geometry from frame_a’s representation to frame_b’s.

Parameters:
  • frame_tree_snapshot (dict) –

  • frame_a (string) –

  • frame_b (string) –

  • validate (bool) –

Returns:

math_helpers.SE3Pose between frame_a and frame_b if they exist in the tree. None otherwise.

bosdyn.client.frame_helpers.get_se2_a_tform_b(frame_tree_snapshot, frame_a, frame_b, validate=True)[source]

Get the SE(2) pose representing the transform between frame_a and frame_b.

Using frame_tree_snapshot, find the math_helpers.SE2Pose to transform geometry from frame_a’s representation to frame_b’s.

Parameters:
  • frame_tree_snapshot (dict) –

  • frame_a (string) –

  • frame_b (string) –

  • validate (bool) –

Returns:

math_helpers.SE2Pose between frame_a and frame_b if they exist in the tree and frame_a is a gravity aligned frame. None otherwise.

bosdyn.client.frame_helpers.express_se2_velocity_in_new_frame(frame_tree_snapshot, frame_b, frame_c, vel_of_a_in_b, validate=True)[source]
Convert the SE2 Velocity in frame b to a SE2 Velocity in frame c using

the frame tree snapshot.

Parameters:
  • frame_tree_snapshot (dict) –

  • frame_b (string) –

  • frame_c (string) –

  • vel_of_a_in_b (SE2Velocity proto) –

  • validate (bool) –

Returns:

math_helpers.SE2Velocity velocity_of_a_in_c in frame_c if the frames exist in the tree. None otherwise.

bosdyn.client.frame_helpers.express_se3_velocity_in_new_frame(frame_tree_snapshot, frame_b, frame_c, vel_of_a_in_b, validate=True)[source]
Convert the SE(3) Velocity in frame b to an SE(3) Velocity in frame c using

the frame tree snapshot.

Parameters:
  • frame_tree_snapshot (dict) –

  • frame_b (string) –

  • frame_c (string) –

  • vel_of_a_in_b (SE3Velocity proto) SE(3) –

  • validate (bool) –

Returns:

math_helpers.SE3Velocity velocity_of_a_in_c in frame_c if the frames exist in the tree. None otherwise.

bosdyn.client.frame_helpers.get_odom_tform_body(frame_tree_snapshot)[source]

Get the transformation between “odom” frame and “body” frame from the FrameTreeSnapshot.

bosdyn.client.frame_helpers.get_vision_tform_body(frame_tree_snapshot)[source]

Get the transformation between “vision” frame and “body” frame from the FrameTreeSnapshot.

exception bosdyn.client.frame_helpers.GenerateTreeError[source]

Bases: Error

exception bosdyn.client.frame_helpers.ChildFrameInTree[source]

Bases: GenerateTreeError

bosdyn.client.frame_helpers.add_edge_to_tree(frame_tree_snapshot, parent_tform_child, parent_frame_name, child_frame_name)[source]

Appends a child/parent and the transform to the FrameTreeSnapshot.

Parameters:
  • frame_tree_snapshot (dict) –

  • parent_tform_child (SE3Pose proto) –

  • parent_frame_name (string) –

  • child_frame_name (string) –

bosdyn.client.frame_helpers.get_frame_names(frame_tree_snapshot)[source]

Returns a list of all known child or parent frames in the FrameTreeSnapshot.

bosdyn.client.frame_helpers.is_gravity_aligned_frame_name(frame_name)[source]

Checks if the string frame name is a known gravity aligned frame.