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

How to define a tranform listener

asked 2011-12-25 03:03:26 -0500

alfa_80 gravatar image

updated 2014-01-28 17:11:03 -0500

ngrennan gravatar image

I am using this code in order to relate the point cloud with the pose information.

Also, the code found here looks like below:

laser_geometry::LaserProjection projector_;
tf::TransformListener listener_;

void scanCallback (const sensor_msgs::LaserScan::ConstPtr& scan_in)
{
  sensor_msgs::PointCloud cloud;
  projector_.transformLaserScanToPointCloud("base_link",*scan_in,cloud,listener_);

  // Do something with cloud.
}

How should I define the "listener_" variable in order to use it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-12-25 12:42:35 -0500

dornhege gravatar image

Just as done in the example. Put it somewhere, the only important thing is that it is persistent, i.e. it doesn't go out of scope and is recreated all the time.

edit flag offensive delete link more

Comments

Did you mean "listener_" variable there something need not be defined ourselves but it's configured/(storing values) by itself?
alfa_80 gravatar image alfa_80  ( 2011-12-25 19:41:59 -0500 )edit
Yes, it does everything by itself. It just needs to stay to collect some data instead of being recreated all the time.
dornhege gravatar image dornhege  ( 2011-12-26 12:24:35 -0500 )edit
Thanks a lot for the explanation. I got it.
alfa_80 gravatar image alfa_80  ( 2011-12-26 16:44:14 -0500 )edit

Question Tools

Stats

Asked: 2011-12-25 03:03:26 -0500

Seen: 246 times

Last updated: Dec 25 '11