cartographer-project / cartographer_turtlebot

Provides TurtleBot integration for Cartographer.
Apache License 2.0
151 stars 96 forks source link

"odom" passed to lookupTransform argument source_frame does not exist. #103

Open Milalaa opened 2 years ago

Milalaa commented 2 years ago

When I used the data package I recorded to build the map, I encountered the following warning, and there was no odom information in the tf tree. The basic configuration is consistent with the field mapping (I think it should be consistent). I am new to slam and this problem has been bothering me for a long time, I hope to be able to get help

 [ WARN] [1650341808.064493401, 1649214958.654808982]: Could not compute submap fading: "map" passed to lookupTransform argument target_frame does not exist. 
    [ WARN] [1650341808.479196164, 1649214959.074182483]: W0419 12:16:48.000000  6541 tf_bridge.cc:52] "odom" passed to lookupTransform argument source_frame does not exist.
bag information
mina@ubuntu:~/bagfiles$ rosbag info 17.bag 
path:        17.bag
version:     2.0
duration:    15:45s (945s)
start:       Mar 24 2022 15:50:08.60 (1648108208.60)
end:         Mar 24 2022 16:05:54.56 (1648109154.56)
size:        132.8 MB
messages:    154499
compression: none [175/175 chunks]
types:       nav_msgs/Odometry     [cd5e73d190d741a2f92e81eda573aca7]
             sensor_msgs/Imu       [6a62c6daae103f4ff57a132d6f95cec2]
             sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369]
topics:      /mobile_base/sensors/imu_data_raw   97682 msgs    : sensor_msgs/Imu      
             /odom                               45421 msgs    : nav_msgs/Odometry    
             /scan                               11396 msgs    : sensor_msgs/LaserScan

.launch file

  <include file="$(find turtlebot_bringup)/launch/minimal.launch" />
  <!-- bag的地址与名称 -->
  <arg name="bag_filename" default="/home/mina/bagfiles/17.bag"/>

  <node pkg="tf2_ros" type="static_transform_publisher" name="base_linktolaser"
        args="0 0 0.95 0 0 0 base_link laser" />

  <!-- 使用bag的时间戳 -->
  <param name="/use_sim_time" value="true" />
  <!-- 启动cartographer -->
  <node name="cartographer_node" pkg="cartographer_ros"
        type="cartographer_node" args="
          -configuration_directory
              $(find cartographer_turtlebot)/configuration_files
          -configuration_basename turtlebot_rplidar_lidar_2d.lua"
        output="screen">
    <remap from="scan" to="/scan" />
    <!--<remap from="imu" to="/imu_out" />-->
  </node>

  <!-- 生成ros格式的地图 -->
  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
        type="cartographer_occupancy_grid_node" args="-resolution 0.05" />

  <node name="flat_world_imu_node" pkg="cartographer_turtlebot"
        type="cartographer_flat_world_imu_node" output="screen">
    <!--<remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />-->
    <remap from="imu_in" to="/mobile_base/sensors/imu_data_raw" />
    <remap from="imu_out" to="/imu" />
  </node>
  <!-- 启动rviz -->
  <node name="rviz" pkg="rviz" type="rviz" required="true"
        args="-d $(find cartographer_turtlebot
          )/configuration_files/demo_turtlebot.rviz" />
  <!-- 启动rosbag -->
  <node name="playbag" pkg="rosbag" type="play"
        args="--clock $(arg bag_filename)" />

</launch>

.lua file

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

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "gyro_link", --gyro_link
  published_frame = "odom",
  odom_frame = "odom",
  provide_odom_frame = false,
  publish_frame_projected_to_2d = false,
  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,--0.2
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3 , --5e-3
  trajectory_publish_period_sec = 30e-3,
  rangefinder_sampling_ratio = 1., --1.
  odometry_sampling_ratio = 1, --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.1 --0.1
TRAJECTORY_BUILDER_2D.max_range = 8. --8.
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 5.
TRAJECTORY_BUILDER_2D.use_imu_data = true
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 --0.65
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.7