pycram.local_transformer#

Classes#

Module Contents#

class pycram.local_transformer.LocalTransformer#

Bases: pytransform3d.transform_manager.TransformManager

_instance = None#
prospection_prefix: str = 'prospection/'#
world: pycram.datastructures.world.World = None#
prospection_world: pycram.datastructures.world.World = None#
_initialized = True#
transform_to_object_frame(pose: pycram.datastructures.pose.PoseStamped, world_object: pycram.world_concepts.world_object.Object, link_name: str = None) typing_extensions.Union[pycram.datastructures.pose.PoseStamped, None]#

Transforms the given PoseStamped to the object coordinate frame

Parameters:
  • pose – The Pose that should be transformed

  • world_object – The world object to which coordinate frame should be transformed

  • link_name – An optional link name of the object

Returns:

The transformed PoseStamped

update_transforms_for_objects(objects: typing_extensions.List[pycram.world_concepts.world_object.Object]) None#

Updates the transforms for objects affected by the transformation. The objects are identified by their names.

Parameters:

objects – List of objects for which the transforms should be updated

transform_pose(pose: pycram.datastructures.pose.PoseStamped, target_frame: str) typing_extensions.Optional[pycram.datastructures.pose.PoseStamped]#

Transforms the given PoseStamped to an arbitrary coordinate frame

Parameters:
  • pose – The pose that should be transformed

  • target_frame – The name of the target frame

Returns:

The transformed PoseStamped in target frame

get_object_from_frame(frame: str) typing_extensions.Optional[pycram.world_concepts.world_object.Object]#

Get the name of the object that is associated with the given frame.

Parameters:

frame – The frame for which the object name should be returned

Returns:

The name of the object associated with the frame

static translate_pose_along_local_axis(pose: pycram.datastructures.pose.PoseStamped, axis: typing_extensions.List, distance: float) pycram.datastructures.pose.PoseStamped#

Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate frame of the pose. The axis is normalized and then scaled by the distance.

Parameters:
  • pose – The pose that should be translated

  • axis – The local axis along which the translation should be performed

  • distance – The distance by which the pose should be translated

Returns:

The translated pose

Get the name of the object that is associated with the given link frame.

Parameters:

link_frame – The frame of the link for which the object name should be returned

Returns:

The name of the object associated with the link frame

get_world_from_frame(frame: str) pycram.datastructures.world.World#

Get the world that is associated with the given frame name.

Parameters:

frame – The frame name.

lookup_transform_from_source_to_target_frame(source_frame: str, target_frame: str, time: typing_extensions.Optional[pycram.ros.Time] = None) pycram.datastructures.pose.TransformStamped#
update_transforms(transforms: typing_extensions.Iterable[pycram.datastructures.pose.TransformStamped], time: pycram.ros.Time = None) None#

Updates transforms by updating the time stamps of the header of each transform. If no time is given the current time is used.

static xyzw_to_wxyz(xyzw: typing_extensions.List[float]) typing_extensions.List[float]#

Convert a quaternion from XYZW to WXYZ format.

Parameters:

xyzw – The quaternion in XYZW format.

get_all_frames() typing_extensions.Dict[typing_extensions.Tuple[typing_extensions.Hashable, typing_extensions.Hashable], pycram.datastructures.pose.Transform]#
static _check_pose_integrity(pose: pycram.datastructures.pose.PoseStamped) None#

Check the integrity of the pose. This is a placeholder for any integrity checks that might be needed.