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

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

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

thommas gravatar image


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


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 image mgruhler  ( 2019-05-17 02:00:10 -0600 )edit


sure, the manual is . 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 image thommas  ( 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 image mgruhler  ( 2019-05-17 02:28:05 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-30 17:28:42 -0600

tfoote gravatar image

The API pointed to by @mgruhler is correctand consistent with your error. The python API returns the result and does not take the resultant output by reference like the c++ API.

You should be using new_pt = tf_l.transformPose(data.header.frame_id,mapPose)

The C++ API uses different syntax to let you take advantage of the language capabilities.

edit flag offensive delete link more

Question Tools

1 follower


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

Seen: 704 times

Last updated: Mar 30 '21