Ask Your Question
0

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

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

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

1 Answer

Sort by ยป oldest newest most voted
0

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

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

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

Stats

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

Seen: 441 times

Last updated: Mar 30