0
$\begingroup$

Rosanswers logo

Hello!

I am using a realsense d435 rgbd camera to capture the world around the robot.

I am performing coordinate transformation in the camera callback pcCallback(const sensor_msgs::PointCloud2ConstPtr& cloud_msg) (in cca every 1 sec, just if a condition is satisfied..)

I perform the transformation with:

success = camTfListener->waitForTransform(REF_FRAME,SOURCE_FRAME,ros::Time(0),ros::Duration(10.0),ros::Duration(0.01),&error_msg);

I only continue with the processing if success is true (so if the transformation was successful - i assume...)

But what i experience is, that even if the transformation is unsuccessful, the function waitForTransform returns true. Is this possible?

So i get in the same time:

1)success=true and

2)[ERROR]: Lookup would require extrapolation into the future. Requested time 1566215389.147320515 but the latest data is at time 1566215389.029921464, when looking up transform from frame [camera_color_optical_frame] to frame [base_link]

Also since success was true, i my algorithm continues with image processing and i get lots of errors such as [pcl::VoxelGrid::applyFilter] Input dataset doesn't have x/y/z coordinates, etc...

Can you please give some hints how to solve this issue?

Remark: the camera works on 30 fps, i have also a static_transform_publisher running on 100Hz - that links the camera_link to the end_effector of the robot.

Thank you in advance.


Originally posted by akosodry on ROS Answers with karma: 121 on 2019-08-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

There are few things you can try. First try using ros::Time::now() instead of ros::Time(0) in your waitForTransform to get the transform at the current time instead of the latest transform.

Also you can try to catch the exception instead of using success. For example with the following you retain the same functionality:

  try {
    camTfListener->waitForTransform(REF_FRAME, SOURCE_FRAME, ros::Time(0), ros::Duration(10.0),
                                    ros::Duration(0.01), &error_msg);
  } catch (tf2::ExtrapolationException &e) {
    ROS_ERROR_STREAM("ExtrapolationException: " << e.what());
    return;
  }

Originally posted by pavel92 with karma: 1655 on 2019-08-19

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by pavel92 on 2019-08-19:
also you can catch the tf2::TransformException exception if you are transforming a pose via camTfListener.transformPose()

Comment by akosodry on 2019-08-19:
Thank you, im trying in 5 mins i will report what i got

Comment by akosodry on 2019-08-19:
@pavel92 Thank you once more for the help!

Out of 112 times the error did not appear :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.