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

Subscriber node

asked 2011-07-08 04:59:27 -0500

qdocehf gravatar image

In the ROS tutorial, they give an example of publisher and subscriber nodes.


  34 void chatterCallback(const std_msgs::String::ConstPtr& msg)
  35 {
  36   ROS_INFO("I heard: [%s]", msg->data.c_str());
  37 }

I am trying to write a subscriber node for transform_broadcaster, so it will have to receive tfMessages instead of Strings. I will obviously change the body, but I am unsure of how to replace the parameter to accept tfMessages. How should I replace it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-07-08 05:09:58 -0500

dornhege gravatar image

Instead of a std_msgs::String you would put a tf::tfMessage.

Warning: This is OK, for playing around and testing (maybe a laser or similar might be more suited), but you should not use that for actual working with tf. The tf library features dedicated classes encapsulating tf messages for broadcasting and subscribing (TransformListener).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-07-08 04:59:27 -0500

Seen: 517 times

Last updated: Jul 08 '11