Ask Your Question
1

tf message type error [closed]

asked 2015-09-18 04:35:52 -0600

Hi,All,

I have written some codes to subscribe the /tf topic as below:

void msgcbTf(const geometry_msgs::TransformStamped & msgTf){
    ROS_INFO("Sequence ID:[%d]",msgTf.header.seq);
    ROS_INFO("msg time:[%d,%d]",msgTf.header.stamp.sec,msgTf.header.stamp.nsec);
    ROS_INFO("tf[x=%f,y=%f]",msgTf.transform.translation.x,msgTf.transform.translation.y);
}
int main(int argc, char *argv[])
{
    ros::init(argc,argv,"CyberMapInfo");
    ros::NodeHandle n; 

    ros::Subscriber subTf=n.subscribe("tf",40,msgcbTf);
    ROS_INFO("Substribe /tf.");
    ros::spin();
}

There was a fatal error when the node run and the callback function msgcbTf had not been called successfully:

[ERROR] [1442566935.682455302]: Client [/CyberMapInfo] wants topic /tf to have datatype/md5sum [geometry_msgs/TransformStamped/b5764a33bfeb3588febc2682852579b0], but our version has [tf2_msgs/TFMessage/94810edda583a504dfda3829e70d7eec]. Dropping connection.

So what message type should I use to take place of geometry_msgs::TransformStamped in msgcbTf function or how can I solve this problem by other way?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by redskydeng
close date 2015-09-20 05:55:19.505171

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-09-18 18:14:30 -0600

tfoote gravatar image

updated 2015-09-18 18:15:23 -0600

If you're trying to subscribe to the /tf topic you need to use the other datatype mentioned in your error message tf2_msgs/TFMessage

You could find that out by using rostopic info /tf.

I suggest you work through some of the core ROS tutorials which will help with your debugging.

It's also not recommended to subscribe to /tf directly but use a TransformListener as described in the tf Tutorials

edit flag offensive delete link more

Comments

Thanks a lot!

redskydeng gravatar imageredskydeng ( 2015-09-20 05:54:46 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-09-18 04:35:52 -0600

Seen: 563 times

Last updated: Sep 18 '15