Publishing tf from base_link to camera using Kinect error
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:
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;
};
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)
Instead of writing your own, I suggest you use tf's static_transform_publisher: http://www.ros.org/wiki/tf#static_transform_publisher.