ROS datatype/md5sum错误

I got this error today.

Problem

[ERROR] [1576785283.032878520]: Client [/rostopic_21515_1576784759002] wants topic /timestamp to have datatype/md5sum std_msgs/Float64MultiArray/4b7d974086d4060e7db4613a7e6c3ba4], but our version has [std_msgs/Float64/fdb28210bfa9d7c91146260178d9a584]. Dropping connection.

What I did is that I wanted to publish a topic with std_msgs::Float64.

define:

std_msgs::Float64 time_msg;
std::chrono::duration<double> t;

assignment:

time_msg.data = t.count();
time_pub_.publish(time_msg);

Solution

Becuase the error showed that the type of message is error (std_msgs::Float64-> std_msgs::Float64MultiArray), so I think the mistake is on t.count(). It looks like std_msgs::Float64MultiArray.
I add a type conversion for it.

time_msg.data = (double)t.count();

It does work!!!
Super:)

发布了16 篇原创文章 · 获赞 1 · 访问量 263

猜你喜欢

转载自blog.csdn.net/weixin_45366564/article/details/103626259