Error transformPose() takes exactly 3 arguments (4 given)

asked 2019-05-17 00:43:51 -0600

thommas gravatar image

Hi,

I am using transformPose with 3 arguments as in the manual, but it seems that python adds "self" implicitly as first argument so I gut the error that transformPose takes exactly 3 argument (4 given). How can I get around this problem?

global mapPose

tf_l = tf.TransformListener(rospy.Duration(10))
new_pt = PoseStamped()

tf_l.waitForTransform(data.header.frame_id, mapPose.header.frame_id, rospy.Time(0), rospy.Duration(0))
tf_l.transformPose(data.header.frame_id,mapPose, new_pt)
edit retag flag offensive close merge delete

Comments

Can you link to the "manual" you are mentioning? The signature of transformPose is actually just with 3 arguments (self included)...

So I guess this is an error in the manual, not the library...

mgruhler gravatar imagemgruhler ( 2019-05-17 02:00:10 -0600 )edit

Hi,

sure, the manual is http://docs.ros.org/kinetic/api/tf/ht... . As you said, the signature just has 3 arguments, which I am passing. I just don't understand why I get this error message, why does ROS think I am passing 4 arguments?

thommas gravatar imagethommas ( 2019-05-17 02:10:27 -0600 )edit

Well, this is the C++ API, not the python one (I linked the python version above). Obviously, one could argue that they should be the same, but they are not ;-)

So you need to use the python API, which is, in the end, simply:

transformPose(target_frame, pose_stamped)
mgruhler gravatar imagemgruhler ( 2019-05-17 02:28:05 -0600 )edit