问题描述
小编在运行自己编写的odom跑cartographer时候出现下列错误:
$ roslaunch cartographer_ros xxx.launch bag_filename:=xxx.bag
[ WARN] [1623375390.352953001, 1623136574.864343084]: W0610 18:36:30.000000 63556 tf_bridge.cc:52] Invalid argument passed to lookupTransform argument source_frame in tf2 frame_ids cannot be empty Warning: Invalid argument passed to canTransform argument source_frame in tf2 frame_ids cannot be empty
原因分析
通过查看话题消息
$ rostopic echo /odom/data
发现 frame_id: ''
和 child_frame_id: ''
均为空
于是设置如下的值
nav_msgs::Odometry odom_msg;
odom_msg.header.frame_id = "odom"; // 对应odom_frame 的值
odom_msg.child_frame_id="base_link";
与之对应的lua配置如下
map_frame = "map",
tracking_frame = "base_link",--base_footprint base_link
published_frame = "base_link",
odom_frame = "odom",--odom
provide_odom_frame = true,--true
publish_frame_projected_to_2d = false,
use_pose_extrapolator = true,--true
use_odometry = true,--false
重新发布odom话题后,顺利运行。