rigid_body_motion.ros.Transformer¶
- class rigid_body_motion.ros.Transformer(cache_time=None)[source]¶
Bases:
object
Wrapper class for tf2_ros.Buffer.
Can be constructed from a ReferenceFrame instance.
- __init__(cache_time=None)[source]¶
Constructor.
- Parameters
- cache_timefloat, optional
Cache time of the buffer in seconds.
Methods
__init__
([cache_time])Constructor.
can_transform
(target_frame, source_frame[, time])Check if transform from source to target frame is possible.
from_reference_frame
(reference_frame)Construct Transformer instance from static reference frame tree.
lookup_transform
(target_frame, source_frame)Get the transform from the source frame to the target frame.
set_transform_static
(reference_frame)Add static transform from reference frame to buffer.
set_transforms
(reference_frame)Add transforms from moving reference frame to buffer.
transform_point
(p, target_frame, source_frame)Transform a point from the source frame to the target frame.
transform_pose
(p, o, target_frame, source_frame)Transform a pose from the source frame to the target frame.
transform_quaternion
(q, target_frame, …[, …])Transform a quaternion from the source frame to the target frame.
transform_vector
(v, target_frame, source_frame)Transform a vector from the source frame to the target frame.
- can_transform(target_frame, source_frame, time=0.0)[source]¶
Check if transform from source to target frame is possible.
- Parameters
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- bool
True if the transform is possible, false otherwise.
- static from_reference_frame(reference_frame)[source]¶
Construct Transformer instance from static reference frame tree.
- Parameters
- reference_frameReferenceFrame
Reference frame instance from which to construct the transformer.
- Returns
- Transformer
Transformer instance.
- lookup_transform(target_frame, source_frame, time=0.0)[source]¶
Get the transform from the source frame to the target frame.
- Parameters
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- ttuple, len 3
The translation between the frames.
- rtuple, len 4
The rotation between the frames.
- set_transform_static(reference_frame)[source]¶
Add static transform from reference frame to buffer.
- Parameters
- reference_frameReferenceFrame
Static reference frame to add.
- set_transforms(reference_frame)[source]¶
Add transforms from moving reference frame to buffer.
- Parameters
- reference_frameReferenceFrame
Static reference frame to add.
- transform_point(p, target_frame, source_frame, time=0.0)[source]¶
Transform a point from the source frame to the target frame.
- Parameters
- piterable, len 3
Input point in source frame.
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- tuple, len 3
Transformed point in target frame.
- transform_pose(p, o, target_frame, source_frame, time=0.0)[source]¶
Transform a pose from the source frame to the target frame.
- Parameters
- piterable, len 3
Input position in source frame.
- oiterable, len 3
Input orientation in source frame.
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- pttuple, len 3
Transformed position in target frame.
- ottuple, len 4
Transformed orientation in target frame.
- transform_quaternion(q, target_frame, source_frame, time=0.0)[source]¶
Transform a quaternion from the source frame to the target frame.
- Parameters
- qiterable, len 4
Input quaternion in source frame.
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- tuple, len 4
Transformed quaternion in target med quaternion in target frame.
- transform_vector(v, target_frame, source_frame, time=0.0)[source]¶
Transform a vector from the source frame to the target frame.
- Parameters
- viterable, len 3
Input vector in source frame.
- target_framestr
Name of the frame to transform into.
- source_framestr
Name of the input frame.
- timefloat, default 0.0
Time at which to get the transform. (0 will get the latest)
- Returns
- tuple, len 3
Transformed vector in target frame.