ros_sugar.tf#

ROS TF Listener

Module Contents#

Classes#

TFListenerConfig

TF listener config

TFListener

ROS TF listener class to lookup a transformation and execute it

API#

class ros_sugar.tf.TFListenerConfig#

Bases: ros_sugar.config.BaseAttrs

TF listener config

asdict(filter: Optional[Callable] = None) Dict#
to_dict() Dict#
asdict_explicit() Dict#
from_dict(dict_obj: Dict) None#
from_file(file_path: str, nested_root_name: Union[str, None] = None, get_common: bool = False) bool#
to_json() Union[str, bytes, bytearray]#
from_json(json_obj: Union[str, bytes, bytearray]) None#
has_attribute(attr_name: str) bool#
get_attribute_type(attr_name: str) Optional[type]#
update_value(attr_name: str, attr_value: Any) bool#
classmethod get_fields_info(class_object) Dict[str, Dict[str, Any]]#
class ros_sugar.tf.TFListener(tf_config: Optional[ros_sugar.tf.TFListenerConfig] = None, node_name: str = '', buffer: Optional[tf2_ros.buffer.Buffer] = None)#

ROS TF listener class to lookup a transformation and execute it

property is_identity: bool#

Whether this listener resolves without any TF lookup.

True when source and goal are the same frame, in which case the transform is the identity and no timer needs to run.

Returns:

Whether the lookup is a no-op

Return type:

bool

property translation: Optional[numpy.ndarray]#

Getter of transform listener TF translation as numpy array

Returns:

Translation vector

Return type:

Optional[np.ndarray]

property rotation: Optional[numpy.ndarray]#

Getter of transform listener TF rotation as numpy array

Returns:

Rotation Quaternion vector

Return type:

Optional[np.ndarray]

property tf_buffer#

Getter of transform listener TF buffer

Returns:

Return type:

Buffer

set_listener(tf_listener: tf2_ros.transform_listener.TransformListener)#

Set the TF listener created in the node

Parameters:

tf_listener (TransformListener) – Node transform listener

property timer: Optional[rclpy.timer.Timer]#

Timer used for the transformation lookup

Returns:

Return type:

Timer

timer_callback()#

Timer callback to perform the requested transformation lookup

check_tf() bool#

Check if the transform is found

Returns:

Transform lookup found

Return type:

bool