Rotate and translate 2D LaserScan message from one frame to another frame
I have two tf2
frames called, for example, laser_base
and estimated_pose
that are both connected to a common map
frame. Furthermore, a LaserScan
message is published, that is attached to the laser_base
frame. What I'm trying to do is rotate and translate the LaserScan
data from the laser_base
frame to the estimated_pose
frame, and was wondering if such a transformation is possible using the tf2
library.
Having looked at the tf2
tutorials, the closest thing I could find that might be able to achieve this was the following:
http://wiki.ros.org/tf2/Tutorials/Usi...
However, upon closer inspection it seems like this will only report the LaserScan
ranges published in the laser_base
frame relative to the estimated_pose
frame, and won't actually rotate and translate the LaserScan
ranges from the laser_base
frame to the estimated_pose
frame.
Since I don't have enough points to post an example image directly to this forum, I've attached an external link here: https://imgur.com/a/iXsXyW0
As can be seen in the attached image, the LaserScan
data is publised in the laser_base
frame located in the top right of the image. However, I'm trying to rotate and translate the LaserScan
data into the estimated_pose
frame located in the bottom center of the image, in order to have the LaserScan
data align more accurately with the map data.
I'm not sure what you're trying to accomplish. The
LaserScan
message contains only ranges, which are always relative to the TF frame. If you change the TF frame in the message toestimated_pose
, the scan will be located there. If you're looking for the (absolute) coordinates of the laser endpoints, you need to transform the 2D scan into a point cloud.