ROS技术空间

ROS错误问题 | cartography建图报错 Check failed: data.time > std::prev(trajectory.end())->first

ROS错误问题 | cartography建图报错 Check failed: data.time > std::prev(trajectory.end())->first

错误信息

[ INFO] [1607655461.823009732]: Resizing costmap to 192 X 260 at 0.050000 m/pix
F1211 10:57:43.511190   617 map_by_time.h:43] Check failed: data.time > std::prev(trajectory.end())->first (637432522634697380 vs. 637432522634697380) 
[FATAL] [1607655463.511638861]: F1211 10:57:43.000000   617 map_by_time.h:43] Check failed: data.time > std::prev(trajectory.end())->first (637432522634697380 vs. 637432522634697380) 
[ WARN] [1607655464.015987130]: Costmap2DROS transform timeout. Current time: 1607655464.0159, global_pose stamp: 1607655463.5102, tolerance: 0.5000
[ WARN] [1607655464.016105830]: Could not get robot pose, cancelling reconfiguration
*** Check failure stack trace: ***
    @       0x7f88bd0128  google::LogMessage::Fail()
    @       0x7f88bd1f98  google::LogMessage::SendToLog()
    @       0x7f88bcfc90  google::LogMessage::Flush()
    @       0x7f88bd283c  google::LogMessageFatal::~LogMessageFatal()
    @       0x557e6780e4  (unknown)
    @       0x557e62b00c  (unknown)
    @       0x557e674cc0  (unknown)
    @       0x557e65fc34  (unknown)
    @       0x557e65e514  (unknown)
    @       0x557e65eddc  (unknown)
    @       0x557e5c6ef4  (unknown)
    @       0x557e5c8b54  (unknown)
    @       0x557e5c98e4  (unknown)
    @       0x557e5c72e8  (unknown)
    @       0x557e65d574  (unknown)
    @       0x557e65f994  (unknown)
    @       0x557e59595c  (unknown)
    @       0x557e5966e0  (unknown)
    @       0x557e596ac4  (unknown)
    @       0x557e56eff8  (unknown)
    @       0x557e582ab4  (unknown)
    @       0x557e58ed9c  (unknown)
    @       0x7f88186f44  ros::SubscriptionQueue::call()
    @       0x7f88136244  ros::CallbackQueue::callOneCB()
    @       0x7f88137b44  ros::CallbackQueue::callAvailable()
    @       0x7f8818ae64  ros::SingleThreadedSpinner::spin()
    @       0x7f88174ab8  ros::spin()
    @       0x557e568210  (unknown)
    @       0x557e5648d0  (unknown)
    @       0x7f87bf06e0  __libc_start_main
    @       0x557e567d08  (unknown)
[ WARN] [1607655465.020825313]: Costmap2DROS transform timeout. Current time: 1607655465.0207, global_pose stamp: 1607655463.5102, tolerance: 0.5000
[cartographer_node-1] process has died [pid 617, exit code -6,xxxxxxxxx
[ WARN] [1607655472.515959996]: Could not get robot pose, cancelling reconfiguration
[ WARN] [1607655473.415933429]: Costmap2DROS transform timeout. Current time: 1607655473.4159, global_pose stamp: 1607655463.5102, tolerance: 0.5000
[ WARN] [1607655473.516076475]: Could not get robot pose, cancelling reconfiguration
[ERROR] [1607655473.616166812]: Extrapolation Error looking up robot pose: Lookup would require extrapolation into the past.  Requested time 1607655463.510237100 but the earliest data is at time 1607655463.600244522, when looking up transform from frame [base_footprint] to frame [map]

解决方法(不建议)

网上搜寻了很多解决方法,基本上都是更改lua文件。以lingao_slam文件为例更改cartography的lua位置是/lingao_slam/config/lingao_lidar_2d.lualingao_lidar_2d_use_imu.lua里面的odometry_sampling_ratio=1改为0.3或更低(如再出现则改到0.1),下面是我修改后的文件

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

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "imu_link",
  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 = 0.3,
  fixed_frame_pose_sampling_ratio = 1.,
  imu_sampling_ratio = 1.,        
  landmarks_sampling_ratio = 1.,
}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.submaps.num_range_data = 35
TRAJECTORY_BUILDER_2D.min_range = 0.3
TRAJECTORY_BUILDER_2D.max_range = 8.
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1

POSE_GRAPH.optimization_problem.huber_scale = 1e2
POSE_GRAPH.optimize_every_n_nodes = 35
POSE_GRAPH.constraint_builder.min_score = 0.65

return options

问题推测

网上很多没说原因,改odometry_sampling_ratio就好了,但是通过论坛得知谷歌工程师是不建议这样做。

这不是解决方法,只是将问题隐藏了!如果将其置为0.1将删除该主题上除10%之外的所有数据…

出现这个问题似乎是传感器数据以相同的时间戳到达,这可能是由于某些触发引起的。在map_by_time.h中似乎无法很好地处理。


每个人造成原因尽管不同,经过测试但我很快找到问题所在,本历程使用了多状态融合robot_localization包,在通讯期间有数据包丢失造成robot_localization出现时间戳问题,最终导致cartography报错,所以更改odometry_sampling_ratio不是长久之计。
知道问题处理也很简单,写个简单的时间戳过滤程序即可。