项目场景:
tf2_ros::buffer.lookupTransform()用法及注意事项
问题描述
在tf树已经查到坐标之间的关系,但是在监听其中两个坐标之间关系时,却显示:运行报错,提示运行报错 lookupTransform base2laser error,“base_footprint” passed to lookupTransform argument target_frame does not exist.
原因分析:
// 参考tf2源码: https://docs.ros.org/en/noetic/api/tf2_ros/html/c++/classtf2__ros_1_1Buffer.html
用法: Buffer::lookupTransform(const std::string& target_frame, const std::string& source_frame,
const ros::Time& time, const ros::Duration timeout) const
作用:Get the transform between two frames by frame ID.
参数意义:
target_frame The frame to which data should be transformed(目标坐标系)
source_frame The frame where the data originated(原坐标系)
time The time at which the value of the transform is desired. (0 will get the lat