Error transformPose() takes exactly 3 arguments (4 given)
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)
Asked by thommas on 2019-05-17 00:43:51 UTC
Answers
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.
Asked by tfoote on 2021-03-30 17:28:42 UTC
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...
Asked by mgruhler on 2019-05-17 02:00:10 UTC
Hi,
sure, the manual is http://docs.ros.org/kinetic/api/tf/html/c++/classtf_1_1TransformListener.html. 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?
Asked by thommas on 2019-05-17 02:10:27 UTC
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:
Asked by mgruhler on 2019-05-17 02:28:05 UTC