Rviz2 requests data ahead of system clock -> requires extrapolation into the future
This problem is similar to, but not the same as: https://answers.ros.org/question/3822...
I am having synchronization issues in Rviz2 when trying to visualize my transforms. The transformation is updated using the following code:
rclcpp::Time now = this->get_clock()->now();
geometry_msgs::msg::TransformStamped t;
// Read message content and assign it to
// corresponding tf variables
t.header.stamp = now;
t.header.frame_id = "world";
t.child_frame_id = msg->child_frame_id;
t.transform.translation.x = msg->pose.pose.position.x;
t.transform.translation.y = msg->pose.pose.position.y;
t.transform.rotation = msg->pose.pose.orientation;
// Send the transformation
tf_broadcaster_->sendTransform(t);
I use the system clock through a call to the current node, so this should be the newest timestamp. However, I still get the following error in Rviz2 when I try to visualize it all:
No transform to fixed frame [world]. TF error: [Lookup would require extrapolation into the future. Requested time 1644326574,469065 but the latest data is at time 1644326574,468505, when looking up transform from frame [F15] to frame [world]]
As you can see, Rviz is requesting data ahead by approx. 5 ms. This is a very small difference, shouldn't Rviz be a little bit more patient? Is Rviz2 on a different clock?
If I run tf2_monitor:
RESULTS: for all Frames
Frames:
Frame: /F15, published by <no authority available>, Average Delay: 0.000386881, Max Delay: 0.00139952
All Broadcasters:
Node: <no authority available> 10.0274 Hz, Average Delay: 0.000386881 Max Delay: 0.00139952
Ubuntu 20.04
Ros2 Foxy