[ros-users] Frame questions

Todd Anderson tdansel88 at gmail.com
Wed Mar 17 16:00:53 UTC 2010


Hello, I am trying to use the point cloud on laser data... but the
transform/frame stuff is messing with me.  I want to be able to get points
with reference to the robot and points with reference to the fixed frame
map.  Currently I am looking up the transform between base_laser_link and
odom which outputs points in a manner that is beyond my spatial
understanding.  Here is the code:

static tf::TransformListener tf_listener;
  //const sensor_msgs::LaserScan::ConstPtr msg_in_myframe =
tf_listener.transformPoint(
  // Get the transform from the laser frame to the odometry frame
  tf::StampedTransform transform;
  try {
    tf_listener.lookupTransform(msg->header.frame_id, "odom",  ros::Time(),
transform);

    // Turn the laser scan into a point cloud, in the odom coordinate frame
    sensor_msgs::PointCloud point_cloud;
    laser_projection.transformLaserScanToPointCloud("odom", *msg,
point_cloud, tf_listener);

    for(vector<geometry_msgs::Point32>::iterator it =
point_cloud.points.begin(); it != point_cloud.points.end(); ++it)
      ss << it->x << ' '<< it->y << endl;

  } catch (tf::TransformException &ex){
    ROS_ERROR("%s", ex.what());
  }

-- 
Todd Anderson
(919) 710-0546
Washington University in St. Louis Class of 2011
School of Engineering and Applied Sciences
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100317/a46c7aa1/attachment-0002.html>


More information about the ros-users mailing list