ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Instead of trying to transform individual points, I am now transforming the entire point cloud to another frame. The code is as follows,

void Convert::convertCallback(const sensor_msgs::PointCloud2 &inputCloud){

    sensor_msgs::PointCloud2 outCloud;
    bool val = mTransformListener->waitForTransform("/base_link", inputCloud.header.frame_id, inputCloud.header.stamp, ros::Duration(10.0));
    pcl_ros::transformPointCloud("/base_link", inputCloud, outCloud, *mTransformListener);

Instead of trying to transform individual points, I am now transforming the entire point cloud to another frame. The code is as follows,

void Convert::convertCallback(const sensor_msgs::PointCloud2 &inputCloud){

    sensor_msgs::PointCloud2 outCloud;
    bool val = mTransformListener->waitForTransform("/base_link", inputCloud.header.frame_id, inputCloud.header.stamp, ros::Duration(10.0));
    pcl_ros::transformPointCloud("/base_link", inputCloud, outCloud, *mTransformListener);
    /* Process the point cloud */
}

It initially worked for the first time, and I could transform the Point Cloud, however, now I am getting a strange error,

[ERROR] [1340908167.092985478]: Lookup would require extrapolation into the past.  

Requested time 1340908154.777419783 but the earliest data is at time 1340908155.041740035, when looking up transform from frame [/narrow_stereo_optical_frame] to frame [/base_link]
Failed to find a field named: 'x'. Cannot convert message to PCL type.
terminate called after throwing an instance of 'pcl::InvalidConversionException'
  what():  Failed to find a field named: 'x'. Cannot convert message to PCL type.
Aborted

Can anyone tell me what's wrong?