TF_OLD_DATA ignoring data from the past for frame base_link at time X

asked 2022-07-08 12:40:37 -0500

marpeja gravatar image

updated 2022-07-10 12:08:09 -0500

lucasw gravatar image

I know there are different questions with a similar topic, but I am not able to solve this following their advices, and I need to get this solved for my career project.

Here it is my launch file, where I launch the robot_state publisher to publish the tf2 transforms, and the joint_state_broadcaster to broadcast the joints position through the /joint_states topic, needed by the robot_state_publisher:

def generate_launch_description():

simulation_parameters_yaml = os.path.join(
    get_package_share_directory('rm3_gazebo'),
    'config',
    'simulation_parameters.yaml'
    )

with open(simulation_parameters_yaml, 'r') as file:
    # The FullLoader parameter handles the conversion from YAML
    # scalar values to Python the dictionary format
    sim_params = yaml.load(file, Loader=yaml.FullLoader)


world_path = PathJoinSubstitution(
    [FindPackageShare("rm3_gazebo"), "worlds", sim_params["world"] + ".world"]
)
steering_node = launch_ros.actions.Node(
    package='robominer_locomotion_control',
    executable='open_loop_steering',
    name='open_loop_steering',
    output='screen',
    parameters=[{'on_robot': False},
                {'which_sim': 'gazebo'},
                ]
    )

rm3_gazebo_path = os.path.join(
    get_package_share_directory('rm3_gazebo'))

xacro_file = os.path.join(rm3_gazebo_path,
                          'urdf',
                          'RM3_robot.xacro.urdf')

doc = xacro.parse(open(xacro_file))
xacro.process_doc(doc)
params = {'robot_description': doc.toxml()}

node_robot_state_publisher = Node(
    package='robot_state_publisher',
    executable='robot_state_publisher',
    output='screen',
    parameters=[params]
)

spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
                    arguments=['-topic', 'robot_description',
                               '-entity', 'RM3',
                               '-x', '-0.5',
                               '-y', '0.0',
                               '-z', '0.32',
                               ],
                    output='screen')

load_joint_state_controller = ExecuteProcess(
    cmd=['ros2', 'control', 'load_controller', '--set-state', 'start',
         'joint_state_broadcaster'],
    output='screen',
)

load_joint_trajectory_controller = ExecuteProcess(
    cmd=['ros2', 'control', 'load_controller', '--set-state', 'start',
         'velocity_controller'],
    output='screen',
)


return LaunchDescription([

    ExecuteProcess(
        cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so',  '-s', 'libgazebo_ros_init.so', world_path],
        output='screen'
    ),

    Node(
        package='rm3_gazebo',
        executable='motor_to_body_vel.py',
        name='motor2bodyvel',
        output='screen',
    ),

    RegisterEventHandler(
        event_handler=OnProcessExit(
            target_action=spawn_entity,
            on_exit=[load_joint_state_controller],
        )
    ),
    RegisterEventHandler(
        event_handler=OnProcessExit(
            target_action=load_joint_state_controller,
            on_exit=[load_joint_trajectory_controller],
        )
    ),
    steering_node,
    node_robot_state_publisher,
    spawn_entity,

])

The problem is that just by launching Rviz2 using ros2 run rviz2 rviz2, although I am able to see my tf2 coordinate frames, I keep getting the warning of the title of this question.

By doing an echo of my /tf topic I am able to see the timestamps of the different transforms, and I realized that those timestamps are given in seconds from 1970, whereas the message I get from Rviz about the base_link frame gives the time in seconds since the moment I launched the simulation:

Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 8.860000 according to authority Authority undetectable
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
         at line 332 in /tmp/binarydeb/ros-foxy-tf2-0.13.13/src/buffer_core.cpp
Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 8.910000 according to authority Authority undetectable
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
         at line 332 in /tmp/binarydeb/ros-foxy-tf2-0.13.13/src/buffer_core.cpp
Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 8.960000 according to authority Authority undetectable
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
         at line 332 in /tmp/binarydeb/ros-foxy-tf2-0.13.13/src/buffer_core.cpp
Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 9.010000 according to authority Authority undetectable
Possible reasons are listed at http://wiki.ros.org/tf/Errors ...
(more)
edit retag flag offensive close merge delete