Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python tf2 buffer does not Detect Jumps in Time #551

Closed
erichlf opened this issue Mar 16, 2023 · 2 comments
Closed

Python tf2 buffer does not Detect Jumps in Time #551

erichlf opened this issue Mar 16, 2023 · 2 comments

Comments

@erichlf
Copy link

erichlf commented Mar 16, 2023

In humble, after setting use_sim_time and running a bag in a loop via
ros2 bag play -l --clock 10 <bag>
I get the Warning: TF_OLD_DATA ignoring data from the past for frame tilt at time ... error message. This does not occur when using rclcpp and only rclpy. I have verified that in the source code for buffer.py the logic for detecting clock jumps is missing, but is in the source for buffer.cpp. Minimum code to reproduce is as follows:

#!/usr/bin/env python3

import rclpy
from rclpy.node import Node
from rclpy.qos import qos_profile_sensor_data
from sensor_msgs.msg import PointCloud2
from tf2_ros import TransformException
from tf2_ros.buffer import Buffer
from tf2_ros.transform_listener import TransformListener

class TestNode(Node):
    def __init__(self):
        super().__init__("test_node")
        # Subscribe to /points
        self.get_logger().info("Subscribing to PointCloud2 topic...")
        self.subscription = self.create_subscription(
            PointCloud2,
            "/points",
            self.callback_main,
            qos_profile_sensor_data,
        )
        self.tf_buffer = Buffer()
        self.tf_listener = TransformListener(self.tf_buffer, self)

    def callback_main(self, pc_msg):
        self.get_logger().info(f"time = {self.get_clock().now()}")


def main(args=None):
    # Init client library
    rclpy.init(args=args)
    # Create the pub/sub
    test_node = TestNode()
    # Spinning...
    try:
        rclpy.spin(
            test_node,
        )
    except KeyboardInterrupt:
        pass

    return 0

And I ran this simply by
ros2 run test test_node --ros-args -p use_sim_time:=true

@erichlf
Copy link
Author

erichlf commented Mar 16, 2023

This is related to #43 and #68.

@erichlf
Copy link
Author

erichlf commented May 31, 2023

Wrong repository. See the ros2 geometry2 repo.

@erichlf erichlf closed this as completed May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant