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

Publishing tf from base_link to camera using Kinect error

asked 2013-07-25 08:18:32 -0600

Pino gravatar image

updated 2014-01-28 17:17:25 -0600

ngrennan gravatar image

Hello, I'm publishing a tf from base_link to camera_rgb_optical_frame in order to calculate robot motion from camera motion. When doing this using a frame_tf_broadcaster similar to the one seen in the tf tutorials I get the following warning:

[ WARN] [1374775573.363920696]: TF exception:
Lookup would require extrapolation into the future.  Requested time 1374775573.291255712 but the latest data is at time 1374775573.259098846, when looking up transform from frame [/camera_depth_optical_frame] to frame [/camera_rgb_optical_frame]

So, when I look at the frames I see the following: image description

As you can see the frame tf broadcast is not being recognized.

Am I publishing to the correct frames (base_link -> camera_rgb_optical_frame)? Any idea why the tf isn't being recognized?

Thanks,

EDIT: adding the code of the frame_tf_broadcaster

#include <ros/ros.h>
#include <tf/transform_broadcaster.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "my_tf_broadcaster");
  ros::NodeHandle node;

  tf::TransformBroadcaster br;
  tf::Transform transform;

  ros::Rate rate(10.0);
  while (node.ok()){
    transform.setOrigin( tf::Vector3(0.0, 0.0, 2.0) );
    transform.setRotation( tf::Quaternion(0, 0, 0) );
    br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_link", "camera_rgb_optical_frame"));
    rate.sleep();
  }
  return 0;
};
edit retag flag offensive close merge delete

Comments

mmm I don't know if this would make any difference, but have you tried using higher publication rate? maybe ros::Rate rate(30.0)

Martin Peris gravatar image Martin Peris  ( 2013-07-25 17:44:39 -0600 )edit

Instead of writing your own, I suggest you use tf's static_transform_publisher: http://www.ros.org/wiki/tf#static_transform_publisher.

Stephan gravatar image Stephan  ( 2013-07-26 02:34:24 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
4

answered 2013-07-26 02:43:45 -0600

Stephan gravatar image

Your camera_rgb_optical_frame already has the parent camera_rgb_frame. So publishing base_link->camera_rgb_optical_frame is not allowed (the structure has to be a tree). Try publishing base_link->camera_link instead.

edit flag offensive delete link more

Comments

I believe this worked, the warning is no longer present. Also using static_transform_publisher was a good suggestion. I have a question though, I'm trying to change from "x-right, y-down and z-front" to "x-forward, y-left and z-up", for this I publish how you suggested, but I'm unsure...

Pino gravatar image Pino  ( 2013-08-13 09:25:10 -0600 )edit

... about the values. This is how I publish the TF: $ rosrun tf static_transform_publisher 0 0 -1.57079633 1.57079633 0 base_link camera_link 100 but this doesn't seem to achieve the transformation I need, is this the correct method to do this?

Pino gravatar image Pino  ( 2013-08-13 09:26:26 -0600 )edit
0

answered 2015-03-23 05:31:20 -0600

Rookie92 gravatar image

updated 2015-03-23 05:33:27 -0600

Please can you help me writing your final code? I have the same problem, I am noob and it's been very dificult to me, I dont know the right way to do tf with kinect.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-07-25 08:18:32 -0600

Seen: 2,622 times

Last updated: Mar 23 '15