ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

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 = rospy.Time.now();                                                              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
1

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

Comments

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 http://wiki.ros.org/tf/Tutorials that explain most causes of exceptions.

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

Question Tools

1 follower

Stats

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

Seen: 2,565 times

Last updated: Jun 15 '16