Skip to content

Commit f129130

Browse files
committed
Wait 0.5s for TF of new image
1 parent f5139ed commit f129130

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ed_sensor_integration/src/kinect/image_buffer.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,20 @@ bool ImageBuffer::getMostRecentImageTF()
158158
<< ros::Time(rgbd_image->getTimestamp()));
159159
ROS_WARN_STREAM("[IMAGE_BUFFER] Image too old to look-up tf: image timestamp = " << std::fixed
160160
<< ros::Time(rgbd_image->getTimestamp()));
161+
return false;
162+
}
163+
else
164+
{
165+
if(!tf_listener_->waitForTransform(root_frame_, rgbd_image->getFrameId(), ros::Time(rgbd_image->getTimestamp()), ros::Duration(0.5)))
166+
{
167+
ROS_ERROR_STREAM_DELAYED_THROTTLE(10, "[IMAGE_BUFFER] Image too new to look-up tf: image timestamp: " << ros::Time(rgbd_image->getTimestamp()) << ", what: " << ex.what());
168+
ROS_WARN_STREAM("[IMAGE_BUFFER] Image too new to look-up tf: image timestamp: " << ros::Time(rgbd_image->getTimestamp()) << ", what: " << ex.what());
169+
return false;
170+
}
171+
tf::StampedTransform t_sensor_pose;
172+
tf_listener_->lookupTransform(root_frame_, rgbd_image->getFrameId(), ros::Time(rgbd_image->getTimestamp()), t_sensor_pose);
173+
geo::convert(t_sensor_pose, sensor_pose);
161174
}
162-
163-
return false;
164175
}
165176
catch(tf::TransformException& exc)
166177
{

0 commit comments

Comments
 (0)