Ask Your Question

Revision history [back]

Hi!

Just for anyone facing a similar issue in the future.

Instead of

if (!camera->nodeHandle.getParam("use_pose_hints", use_pose_hints_)) 
{
    ROS_INFO("Failed to get use_pose_hints flag!");
  }
 ROS_INFO_STREAM("Use pose hints set to " << use_pose_hints_);
 tfListener_.waitForTransform("volume_pose", "camera_depth_optical_frame", ros::Time::now(), ros::Duration(2));
tfListener_.lookupTransform("volume_pose", "camera_depth_optical_frame", ros::Time(0), previous_volume_to_sensor_transform_);
 }
    }

I added a try-catch block as per the tf tutorials.

if (use_pose_hints_) {
    try {
  tfListener_.waitForTransform("volume_pose", "camera_depth_optical_frame", ros::Time::now(), ros::Duration(0.5));
  tfListener_.lookupTransform("volume_pose", "camera_depth_optical_frame", ros::Time(0), previous_volume_to_sensor_transform_);
    }
    catch (tf::TransformException ex){
        ROS_ERROR("%s", ex.what());
    }
}

}

This allowed time for the volume_pose frame to become available when the Kinect fusion node was launched.

And in case the frame is not available the following message will be shown.

[ERROR] [1530122898.477899539, 10.817000000]: "volume_pose" passed to lookupTransform argument target_frame does not exist.

Refer to this issue and this pull request if more details are required.