ravi
ravi

Reputation: 6338

AttributeError: 'Point' object has no attribute 'point'

I am transforming a point from source frame to target frame using tf2. Below is the code snippet:

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

The code throws following error:

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'

The tf_geometry_msgs.py can be seen online at here. This seems silly as they are calling point.point.x.

Which point are they talking about? I believe it should be geometry_msgs/Point, which I declared in the following way:

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

Any workaround, please?

Upvotes: 1

Views: 2117

Answers (1)

Arpit Singh
Arpit Singh

Reputation: 416

do_transform_point(point_wrt_kinect, transform)

point_wrt_kinect is the object of Point class. In documentation it should be PointStamped class object. its the error of documentation. you have to create object of PointStamped class instead of Point class.

Upvotes: 2

Related Questions