mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
mrs_lib::TransformBroadcaster Class Reference

Wrapper for the tf2_ros::TransformBroadcaster. With each sendTransform() command, the message is checked against the last message with the same frame IDs. If the transform was already published in this ros::Time step, then the transform is skipped. Prevents endless stream of warnings from spamming the console output. The sendTransform() methods can be called from multiple threads at the same time. More...

#include <transform_broadcaster.h>

Classes

struct  NotInitializedException
 is thrown when calculating of heading is not possible due to atan2 exception More...

Public Member Functions

 TransformBroadcaster ()
 constructor, internally starts the TransformBroadcaster
 TransformBroadcaster (const rclcpp::Node::SharedPtr &node)
 constructor, internally starts the TransformBroadcaster
TransformBroadcaster & operator= (TransformBroadcaster &&other)
 A convenience move assignment operator.
void sendTransform (const geometry_msgs::msg::TransformStamped &transform)
 check if the transform is newer than the last published one and publish it. Transform is skipped if a duplicit timestamp is found
void sendTransform (const std::vector< geometry_msgs::msg::TransformStamped > &transforms)
 check if the transforms are newer than the last published ones and publish them. A transform is skipped if a duplicit timestamp is found

Detailed Description

Wrapper for the tf2_ros::TransformBroadcaster. With each sendTransform() command, the message is checked against the last message with the same frame IDs. If the transform was already published in this ros::Time step, then the transform is skipped. Prevents endless stream of warnings from spamming the console output. The sendTransform() methods can be called from multiple threads at the same time.

Member Function Documentation

◆ operator=()

TransformBroadcaster & mrs_lib::TransformBroadcaster::operator= ( TransformBroadcaster && other)

A convenience move assignment operator.

This operator moves all data from the object that is being assigned from, invalidating it.

Parameters
otherthe object to assign from. It will be invalid after this method returns.
Returns
a reference to the object being assigned to.

◆ sendTransform() [1/2]

void mrs_lib::TransformBroadcaster::sendTransform ( const geometry_msgs::msg::TransformStamped & transform)

check if the transform is newer than the last published one and publish it. Transform is skipped if a duplicit timestamp is found

Parameters
transformto be published

◆ sendTransform() [2/2]

void mrs_lib::TransformBroadcaster::sendTransform ( const std::vector< geometry_msgs::msg::TransformStamped > & transforms)

check if the transforms are newer than the last published ones and publish them. A transform is skipped if a duplicit timestamp is found

The transforms that pass the check are published together in a single tf message.

Parameters
transformsvector of transforms to be published

The documentation for this class was generated from the following files:
  • /home/runner/work/mrs_lib/mrs_lib/include/mrs_lib/transform_broadcaster.h
  • /home/runner/work/mrs_lib/mrs_lib/src/transform_broadcaster/transform_broadcaster.cpp