Cannot understand tf cpp code

asked 2017-03-04 09:52:22 -0500

Bill5785 gravatar image

updated 2017-03-04 09:56:48 -0500

The following code:

SlamGMapping::initMapper(const sensor_msgs::LaserScan& scan)
                {
                  laser_frame_ = scan.header.frame_id;
                  // Get the laser's pose, relative to base.
                  tf::Stamped<tf::Pose> ident;
                  tf::Stamped<tf::Transform> laser_pose;
                  ident.setIdentity(); // set transformation matrix to identity
                  ident.frame_id_ = laser_frame_;
                  ident.stamp_ = scan.header.stamp;
                  try
                  {
                    tf_.transformPose(base_frame_, ident, laser_pose);
                  }

This is part of gmapping source code. I have known what tf does is try to correlate "base_link" to "laser". But I have difficulty understanding the code in detail.

I checked tf header description, and according ot it, tf_.transformPose(base_frame_, ident, laser_pose) in which ident should be stamped_in and laser_pose should be stamped out. But I dont understand what is exactly doing. What is stamped in or out?

edit retag flag offensive close merge delete