Ask Your Question

Why TransformListener initializiton giving an AttributeError?

asked 2016-06-15 15:45:31 -0500

anilmullapudi gravatar image

updated 2016-06-15 15:51:11 -0500

I am trying to transform a point from a map frame to camera frame. But i was getting an AttributeError. I followed this api and wrote the following code.

target = "wide_stereo_optical_frame";
point = PointStamped()
point.point.x =2;
point.point.y = 1;
point.point.z = 1;
point.header.frame_id = "map";
point.header.stamp =;                                                              tf = tf.TransformListener();                                                                        tf.waitForTransform(target, point.header.frame_id, rospy.Time(), rospy.Duration(5.0));
camera_target = tf.transformPoint(target, point)

In the above code, i was created a point in "map" frame and trying to transform into "wide_stereo_optical_frame" frame. But, I was getting an error tf.Exception: AttributeError: 'TransformListener' object has no attribute 'Exception'

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-15 18:58:50 -0500

tfoote gravatar image

Your line

tf = tf.TransformListener();

Is overrideing the tf module with an instance of a TransformListener.

Thus if any subsequent call to use part of the tf module will fail unless it's implemented in the TransformListener class.

As a general rule you should consider module names protected and not use colliding variable names.

edit flag offensive delete link more


TransformListener initialization is successful now. But the above code giving tf exception. I am not sure where i am wrong. Do i need to raise new question?

anilmullapudi gravatar image anilmullapudi  ( 2016-06-16 12:16:23 -0500 )edit

Yes, please ask a new question. Make sure it's fully self contained as the people reading that question might not have seen this one. Before you ask your question though please make sure to read the tf Tutorials that explain most causes of exceptions.

tfoote gravatar image tfoote  ( 2016-06-16 12:44:05 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-15 15:45:31 -0500

Seen: 1,272 times

Last updated: Jun 15 '16