gpt4 book ai didi

python - 属性错误: 'Point' object has no attribute 'point'

转载 作者:太空宇宙 更新时间:2023-11-03 14:32:58 29 4
gpt4 key购买 nike

我正在使用 tf2 将点从源帧转换为目标帧。下面是代码片段:

import tf2_ros
import tf2_geometry_msgs

transform = tf_buffer.lookup_transform(target_frame, source_frame, rospy.Time(0), rospy.Duration(1.0))
pose_transformed = tf2_geometry_msgs.do_transform_point(point_wrt_kinect, transform)
print pose_transformed

代码抛出以下错误:

Traceback (most recent call last):
File "q1.py", line 29, in <module>
pose_transformed = tf2_geometry_msgs.do_transform_point(point_wrt_kinect, transform)
File "/opt/ros/indigo/lib/python2.7/dist-packages/tf2_geometry_msgs/tf2_geometry_msgs.py", line 59, in do_transform_point
p = transform_to_kdl(transform) * PyKDL.Vector(point.point.x, point.point.y, point.point.z)
AttributeError: 'Point' object has no attribute 'point'

tf_geometry_msgs.py可以在线查看here 。这看起来很愚蠢,因为他们正在调用 point.point.x

他们在谈论哪一点?我相信应该是geometry_msgs/Point ,我通过以下方式声明:

from geometry_msgs.msg import Point
point_wrt_kinect = Point()
point_wrt_kinect.x = -0.41
point_wrt_kinect.y = -0.13
point_wrt_kinect.z = 0.77

请问有什么解决办法吗?

最佳答案

do_transform_point(point_wrt_kinect, 变换)

point_wrt_kinect是Point类的对象。在文档中它应该是 PointStamped 类对象。这是文档的错误。 您必须创建 PointStamped 类的对象而不是 Point 类。

关于python - 属性错误: 'Point' object has no attribute 'point' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47149685/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com