Ask Your Question
0

How to define a tranform listener

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

alfa_80 gravatar image

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

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 -0600

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 imagealfa_80 ( 2011-12-25 19:41:59 -0600 )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 imagedornhege ( 2011-12-26 12:24:35 -0600 )edit
Thanks a lot for the explanation. I got it.
alfa_80 gravatar imagealfa_80 ( 2011-12-26 16:44:14 -0600 )edit

Your Answer

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

Add Answer

Question Tools

Stats

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

Seen: 182 times

Last updated: Dec 25 '11