ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 - tf2_ros::TransformBroadcaster and rclcpp_lifecycle::LifecycleNode

asked 2018-09-05 04:15:14 -0500

Myzhar gravatar image

I need to create a TransformBroadcaster inside my LifecycleNode, but the constructor of tf2_ros::TransformBroadcaster requires a rclcpp::Node::SharedPtr.

This may be a silly question, but I cannot fill the missing part:

    std::shared_ptr<tf2_ros::TransformBroadcaster> mTransformPoseBroadcaster;
    mTransformPoseBroadcaster = std::make_shared<tf2_ros::TransformBroadcaster>(??????????);

Thank you for help

Walter

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-09-05 16:06:18 -0500

William gravatar image

The tf2_ros interface, which pre-dates lifecycle nodes and the node interfaces in rclcpp, would need to be updated to take the "node interfaces" that it uses, which are the common element between Node and LifecycleNode. For example, maybe it should instead take a pointer to rclcpp::node_interfaces::NodeTopicsInterface and a pointer to an instance of rclcpp::node_interfaces::NodeParametersInterface instead of a pointer to a node.

A separate question is whether or not tf2_ros should create lifecycle topics or normal topics (should it work only in certain lifecycle states or always)?

I'd recommend opening an issue on the ros2/geometry2 issue tracker ( https://github.com/ros2/geometry2/issues ) asking about this. I'm not sure if anyone will have time to implement this for you, but if you're interesting in contributing this feature for tf2 that would probably be a quicker way to get a solution for this.

edit flag offensive delete link more

Comments

Yes, I think that it should be similar to executors that get a pointer to NodeBaseInterface when you add nodes.

Added issue: https://github.com/ros2/geometry2/iss...

Myzhar gravatar image Myzhar  ( 2018-09-06 03:08:56 -0500 )edit

Actually I'm using a simple trick: I publish the TF2 as normal message and I made a "normal" node that subscribes and broadcasts using tf2_ros::TransformBroadcaster

Myzhar gravatar image Myzhar  ( 2018-09-06 03:10:48 -0500 )edit

An update: using the node that subscribes to tf2 messages and broadcasts them it works, but there is a latency issue as i described here: https://answers.ros.org/question/3033...

Myzhar gravatar image Myzhar  ( 2018-09-15 15:06:15 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-09-05 04:15:14 -0500

Seen: 1,078 times

Last updated: Sep 05 '18