Ros tf2_ros::Buffer.lookupTransform 运行报错lookupTransform base2laser error

在自动驾驶项目中遇到tf2_ros::Buffer.lookupTransform报错,错误信息提示'base2laser'目标帧不存在。问题源于lookupTransform函数的超时时间设置不当。解决方案是为函数添加较长的超时时间参数,例如1秒,或者在调用前增加短暂的睡眠时间,确保足够等待tf转换的建立。
摘要由CSDN通过智能技术生成

项目场景:

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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值