Rviz2 not showing tf for real Turtlebot

@girishkumar.kannan @rtellez @duckfrost2 I am still stuck. I don’t even get tf to show up properly in rviz2 after establishing the ros1_bridge and launching the cartographer.

I also get this warning: [cartographer_node-1] [WARN] [1693981460.197128385] [cartographer_ros]: W0906 06:24:20.000000 6445 tf_bridge.cc:67] Lookup would require extrapolation into the past. Requested time 1693981459.655794 but the earliest data is at time 1693981459.782910, when looking up transform from frame [odom] to frame [base_footprint].

I’m really suspecting the dynamic_bridge is too slow because it bridges all topics, but I just cannot get parameter_bridge working.

Maybe there’s something wrong with my parameter_bridge files:

load_params.launch

<?xml version="1.0"?>
<launch>
    <rosparam file="/home/user/catkin_ws/src/load_params/params/topics_turtlebot.yaml" command="load"/>
</launch>

topics_turtlebot.yaml

topics: [{topic: /tf, type: tf2_msgs/msg/TFMessage, queue_size: 500}, {topic: /tf_static, type: tf2_msgs/msg/TFMessage, queue_size: 500}, {topic: /scan, type: sensor_msgs/msg/LaserScan, queue_size: 100}, {topic: /odom, type: nav_msgs/msg/Odometry, queue_size: 100}, {topic: /clock, type: rosgraph_msgs/msg/Clock, queue_size: 100}, {topic: cmd_vel, type: geometry_msgs/msg/Twist, queue_size: 100}] 

I understand that you can try to run the parameter_bridge without entering roslaunch load_params load_params.launch first, but that doesn’t work for me either.

For the possibility that there’s something wrong with my cartographer code, here it is:

cartographer.lua

include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_footprint",
  published_frame = "odom",
  odom_frame = "odom",
  provide_odom_frame = false,
  publish_frame_projected_to_2d = true,
  use_odometry = true,
  use_nav_sat = false,
  use_landmarks = false,
  num_laser_scans = 1,
  num_multi_echo_laser_scans = 0,
  num_subdivisions_per_laser_scan = 1,
  num_point_clouds = 0,
  lookup_transform_timeout_sec = 0.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
  trajectory_publish_period_sec = 30e-3,
  rangefinder_sampling_ratio = 1.,
  odometry_sampling_ratio = 1.,
  fixed_frame_pose_sampling_ratio = 1.,
  imu_sampling_ratio = 1.,
  landmarks_sampling_ratio = 1.,
}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.min_range = 0.12
TRAJECTORY_BUILDER_2D.max_range = 3.5
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 3.0
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true 
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.1)

POSE_GRAPH.constraint_builder.min_score = 0.65
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.7

-- POSE_GRAPH.optimize_every_n_nodes = 0

return options

cartographer.launch.py

import os
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node

def generate_launch_description():

    cartographer_config_dir = os.path.join(get_package_share_directory('project_mapping'), 'config')
    configuration_basename = 'cartographer.lua'

    return LaunchDescription([
        
        Node(
            package='cartographer_ros', 
            executable='cartographer_node', 
            name='cartographer_node',
            output='screen',
            parameters=[{'use_sim_time': True}],
            arguments=['-configuration_directory', cartographer_config_dir,
                       '-configuration_basename', configuration_basename]),

        Node(
            package='cartographer_ros',
            executable='occupancy_grid_node',
            output='screen',
            name='occupancy_grid_node',
            parameters=[{'use_sim_time': True}],
            arguments=['-resolution', '0.05', '-publish_period_sec', '1.0']
        ),
    ]) 

Can anyone try to replicate my errors with the real Turtlebot, please?