[ros-users] Frame questions

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Todd Anderson
Date:  
To: ros-users
Subject: [ros-users] Frame questions
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