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

TF not compiling under Groovy?

asked 2014-09-22 08:10:58 -0500

Ruud gravatar image

updated 2014-10-28 04:28:00 -0500

gvdhoorn gravatar image

I am trying to implement some TF under groovy, but ran into compilation errors quickly. I just installed a fresh Ubuntu 12.04 with ROS Groovy. To be sure, I tried to implement the tutorial ( ) to see if the error also replicates there when compiled, and it does:

Built target
/home/ruud/Dropbox/ros/catkin_workspace/src/learning_tf/src/turtle_tf_broadcaster.cpp: In function ‘void poseCallback(const PoseConstPtr&)’:
/home/ruud/Dropbox/ros/catkin_workspace/src/learning_tf/src/turtle_tf_broadcaster.cpp:14:44: warning: ‘tf::Quaternion::Quaternion(const tfScalar&, const tfScalar&, const tfScalar&)’ is deprecated (declared at /opt/ros/groovy/include/tf/LinearMath/Quaternion.h:51) [-Wdeprecated-declarations]
/home/ruud/Dropbox/ros/catkin_workspace/src/learning_tf/src/turtle_tf_broadcaster.cpp:14:46: error: no matching function for call to ‘tf::Quaternion::setRPY(tf::Quaternion)’
/home/ruud/Dropbox/ros/catkin_workspace/src/learning_tf/src/turtle_tf_broadcaster.cpp:14:46: note: candidate is:
/opt/ros/groovy/include/tf/LinearMath/Quaternion.h:94:8: note: void tf::Quaternion::setRPY(const tfScalar&, const tfScalar&, const tfScalar&)
/opt/ros/groovy/include/tf/LinearMath/Quaternion.h:94:8: note:   candidate expects 3 arguments, 1 provided
make[2]: *** [learning_tf/CMakeFiles/turtle_tf_broadcaster.dir/src/turtle_tf_broadcaster.cpp.o] Error 1
make[1]: *** [learning_tf/CMakeFiles/turtle_tf_broadcaster.dir/all] Error 2
make: *** [all] Error 2

Anyone had this issue before?

Thanks! Ruud


In the tutorial it says (see below) that you have to change line 14 of the code. I did that but then I get the error. If I switch back to the original code, then it compiles fine!

"Looks like Quaternion API has changed (sorry but not sure when it occurred...Here it's assumed at some point between electric and fuerte) so that the order of the arguments needs changed (Relevant QA thread). That said, if you're on a version prior to the API change, you need to change line 14 to: q.setRPY( tf::Quaternion(msg->theta, 0, 0) );"

Please also take a look here if you have this error:

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-09-22 09:06:47 -0500

dornhege gravatar image

Are you sure that you are following the exact code?

The offending line in the compile is listed in the tutorial as:

13   tf::Quaternion q;
14   q.setRPY(0, 0, msg->theta);

which is exactly the candidate that your error points to.

edit flag offensive delete link more



Thanks for the quick reply! Yes I saved the source from internet directly.

Apparently the quaternion needs to be initialized with 4 values, not with 3 as in the tutorial code:

transform.setRotation( tf::Quaternion(0, 0, 0) ) is deprecated and you need x,y,z and w to initialize.

Ruud gravatar image Ruud  ( 2014-09-22 09:42:13 -0500 )edit

Question Tools


Asked: 2014-09-22 08:10:58 -0500

Seen: 536 times

Last updated: Oct 28 '14