Ask Your Question

How to Construct a Broadcaster for this listener?

asked 2014-05-29 16:21:28 -0500

dreamcase gravatar image

Hi, All,

I am trying to interface with the code below. this is a piece of TF listener code trying to convert the incoming laser scan data to base_frame. How do I construct a broadcaster for it?

tf::Stamped<tf::Pose> ident (tf::Transform(tf::createIdentityQuaternion(),
                             ros::Time(), laser_scan->header.frame_id);
tf::Stamped<tf::Pose> laser_pose;
  this->tf_->transformPose(base_frame_id_, ident, laser_pose);
catch(tf::TransformException& e)
  ROS_ERROR("Couldn't transform from %s to %s, "
            "even though the message notifier is in use",
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-29 21:54:05 -0500

fergs gravatar image

There are three standard ways of broadcasting TF data for your robot. If your robot has a URDF file that specifies where the joints and links are and how they are sized, and your drivers output a sensor_msgs/JointState topic with the joint positions, then you can use the robot_state_publisher node to turn joint positions and kinematic model into TF frames. You don't mention what type of robot you have, it might already have this implemented as part of the standard ROS drivers for the platform.

However, if you have a very simple robot, or just some static frames you need to publish (I presume here that the laser is actually fixed to the base, not moving, has no joints in between base_frame and laser frame), then you can use the static_transform publisher, which is part of tf and is documented here:

Finally, you could construct a tf::Broadcaster in a node to publish the transform -- but this is probably not the ideal solution. Tutorials are linked off this page:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-05-29 16:21:28 -0500

Seen: 149 times

Last updated: May 29 '14