Ask Your Question

Revision history [back]

There are four things you'll need to change. The creation of the listener will need to be this:

tf2_ros::Buffer tfBuffer(ros::Duration(10));
tf2_ros::TransformListener tfListener(tfBuffer);

You'll have to pass the tfBuffer object to the transformPoint function instead of the listener object.

The transform point operation can be done using the transform method of the buffer object:

tfBuffer.transform("base_link", laser_point, base_point);

Finally the type of the exception object will need to be changed to:

catch (tf2::TransformException &ex)
...

Hope this helps.

There are four things you'll need to change. The creation of the listener will need to be this:

tf2_ros::Buffer tfBuffer(ros::Duration(10));
tf2_ros::TransformListener tfListener(tfBuffer);

You'll have to pass the tfBuffer object to the transformPoint function instead of the listener object.

The transform point operation can be done using the transform method of the buffer object:

tfBuffer.transform("base_link", laser_point, base_point);

Finally the type of the exception object will need to be changed to:

catch (tf2::TransformException &ex)
...

Hope this helps.

UPDATE :

3 things, if you look carefully there are a few differences between your new code and what I suggested.

  1. The namespace of TransformException should be tf2 not tf2_ros
  2. You're still passing the listener object to transform point you need to change this to the Buffer object.
  3. The method used to transform the point is now called transform not transformPoint.