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:)

本文解决了一个关于ROS环境中话题类型不匹配的错误,详细描述了从std_msgs::Float64到std_msgs::Float64MultiArray的类型冲突,并通过类型转换成功解决了问题。
305

被折叠的 条评论
为什么被折叠?



