Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
pose_to_tf::PoseToTF2 Class Reference

Primary logic class for the PoseToTF2 node. More...

#include <PoseToTF2.hpp>

Collaboration diagram for pose_to_tf::PoseToTF2:
Collaboration graph

Public Types

using TransformPublisher = std::function< void(const geometry_msgs::msg::TransformStamped &)>
 

Public Member Functions

 PoseToTF2 (PoseToTF2Config config, TransformPublisher transform_pub, std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > node)
 Constructor. More...
 
void poseStampedCallback (geometry_msgs::msg::PoseStamped::UniquePtr msg)
 Callback for new pose stamped messages. More...
 
void poseWithCovarianceStampedCallback (geometry_msgs::msg::PoseWithCovarianceStamped::UniquePtr msg)
 Callback for new pose stamped messages. More...
 
void poseCallback (geometry_msgs::msg::Pose::UniquePtr msg)
 Callback for new pose stamped messages. More...
 
void poseWithCovarianceCallback (geometry_msgs::msg::PoseWithCovariance::UniquePtr msg)
 Callback for new pose with covariance messages. More...
 

Private Attributes

std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > node_
 
PoseToTF2Config config_
 
TransformPublisher transform_pub_
 

Detailed Description

Primary logic class for the PoseToTF2 node.

Definition at line 33 of file PoseToTF2.hpp.

Member Typedef Documentation

◆ TransformPublisher

using pose_to_tf::PoseToTF2::TransformPublisher = std::function<void(const geometry_msgs::msg::TransformStamped&)>

Definition at line 36 of file PoseToTF2.hpp.

Constructor & Destructor Documentation

◆ PoseToTF2()

pose_to_tf::PoseToTF2::PoseToTF2 ( PoseToTF2Config  config,
TransformPublisher  transform_pub,
std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode >  node 
)

Constructor.

Parameters
transform_pubA callback to trigger transform broadcast

Definition at line 60 of file PoseToTF2.cpp.

61 : config_(config), transform_pub_(transform_pub), node_(node)
62{
63}
PoseToTF2Config config_
Definition: PoseToTF2.hpp:77
std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > node_
Definition: PoseToTF2.hpp:75
TransformPublisher transform_pub_
Definition: PoseToTF2.hpp:78

Member Function Documentation

◆ poseCallback()

void pose_to_tf::PoseToTF2::poseCallback ( geometry_msgs::msg::Pose::UniquePtr  msg)

Callback for new pose stamped messages.

Parameters
msgThe pose message to forward

Definition at line 81 of file PoseToTF2.cpp.

82{
83 geometry_msgs::msg::TransformStamped out_tf;
84 tf2::convert(*msg, out_tf.transform);
85 out_tf.header.stamp = node_->now();
86 out_tf.header.frame_id = config_.default_parent_frame;
87 out_tf.child_frame_id = config_.child_frame;
88 transform_pub_(out_tf);
89}
void convert(const geometry_msgs::msg::PoseWithCovarianceStamped &pose, geometry_msgs::msg::TransformStamped &trans)
Definition: PoseToTF2.cpp:49

References pose_to_tf::PoseToTF2Config::child_frame, config_, tf2::anonymous_namespace{PoseToTF2.cpp}::convert(), pose_to_tf::PoseToTF2Config::default_parent_frame, node_, and transform_pub_.

Referenced by pose_to_tf::PoseToTfNode::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poseStampedCallback()

void pose_to_tf::PoseToTF2::poseStampedCallback ( geometry_msgs::msg::PoseStamped::UniquePtr  msg)

Callback for new pose stamped messages.

Parameters
msgThe pose message to forward

Definition at line 65 of file PoseToTF2.cpp.

66{
67 geometry_msgs::msg::TransformStamped out_tf;
68 tf2::convert(*msg, out_tf);
69 out_tf.child_frame_id = config_.child_frame;
70 transform_pub_(out_tf);
71}

References pose_to_tf::PoseToTF2Config::child_frame, config_, tf2::anonymous_namespace{PoseToTF2.cpp}::convert(), and transform_pub_.

Referenced by pose_to_tf::PoseToTfNode::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poseWithCovarianceCallback()

void pose_to_tf::PoseToTF2::poseWithCovarianceCallback ( geometry_msgs::msg::PoseWithCovariance::UniquePtr  msg)

Callback for new pose with covariance messages.

Parameters
msgThe pose message to forward

Definition at line 91 of file PoseToTF2.cpp.

92{
93 geometry_msgs::msg::TransformStamped out_tf;
94 tf2::convert(*msg, out_tf.transform);
95 out_tf.header.stamp = node_->now();
96 out_tf.header.frame_id = config_.default_parent_frame;
97 out_tf.child_frame_id = config_.child_frame;
98 transform_pub_(out_tf);
99}

References pose_to_tf::PoseToTF2Config::child_frame, config_, tf2::anonymous_namespace{PoseToTF2.cpp}::convert(), pose_to_tf::PoseToTF2Config::default_parent_frame, node_, and transform_pub_.

Referenced by pose_to_tf::PoseToTfNode::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poseWithCovarianceStampedCallback()

void pose_to_tf::PoseToTF2::poseWithCovarianceStampedCallback ( geometry_msgs::msg::PoseWithCovarianceStamped::UniquePtr  msg)

Callback for new pose stamped messages.

Parameters
msgThe pose message to forward

Definition at line 73 of file PoseToTF2.cpp.

74{
75 geometry_msgs::msg::TransformStamped out_tf;
76 tf2::convert(*msg, out_tf);
77 out_tf.child_frame_id = config_.child_frame;
78 transform_pub_(out_tf);
79}

References pose_to_tf::PoseToTF2Config::child_frame, config_, tf2::anonymous_namespace{PoseToTF2.cpp}::convert(), and transform_pub_.

Referenced by pose_to_tf::PoseToTfNode::handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ config_

PoseToTF2Config pose_to_tf::PoseToTF2::config_
private

◆ node_

std::shared_ptr<carma_ros2_utils::CarmaLifecycleNode> pose_to_tf::PoseToTF2::node_
private

Definition at line 75 of file PoseToTF2.hpp.

Referenced by poseCallback(), and poseWithCovarianceCallback().

◆ transform_pub_

TransformPublisher pose_to_tf::PoseToTF2::transform_pub_
private

The documentation for this class was generated from the following files: