Mr_matcher的细节3

主要是订阅了playbag发布的scan话题和odom话题

其类型分别为

 

 //cache the static tf from base to laser

getBaseToLaserTf(scan_msg->header.frame_id);

bool LaserScanMatcher::getBaseToLaserTf (const std::string& frame_id)
{
  ros::Time t = ros::Time::now();//广播TF时的时间戳

  tf::StampedTransform base_to_laser_tf;
  try
  {
    tf_listener_.waitForTransform(
      base_frame_, frame_id, t, ros::Duration(1.0));
    tf_listener_.lookupTransform (//父(要将数据转换到本坐标系下)到子(将要转换的坐标系)的变换,从而求出子坐标系在父坐标系中的位置和方向,所以为什么说是base_to_laser的转换,这样就可以理解通了。
      base_frame_, frame_id, t, base_to_laser_tf);//在这里要想到相机在世界坐标系当中的移动,要求出相机在世界坐标系中的位置的话,那么旋转矩阵是从世界坐标系到相机坐标系的一个旋转,
  }
  catch (tf::TransformException ex)
  {
    ROS_WARN("Could not get initial transform from base to laser frame, %s", ex.what());
    return false;
  }
  base_to_laser_ = base_to_laser_tf;
  laser_to_base_ = base_to_laser_.inverse();

  return true;
}

 

posted on 2017-06-22 20:13  gary_123  阅读(310)  评论(0编辑  收藏  举报

导航