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

generic way to test message equality

asked 2014-10-03 08:53:39 -0600

galou gravatar image

Is there a generic way to test for message equality (or even better for almost equality) in C++?

It would be useful for me, when writing cpp unit-tests.

There should be a way with serialization, at least for strict equality, but how to implement it in a generic manner?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-04 08:42:36 -0600

dornhege gravatar image

If you want something really strict and low level, you can follow your idea and serialize the messages into binary blobs and compare those. I would not recommend that for any algorithms though.

edit flag offensive delete link more


Is there a base class for all ROS message classes for this purpose?

galou gravatar image galou  ( 2014-10-07 03:37:34 -0600 )edit

No, but I think the serialization traits are specialized.

dornhege gravatar image dornhege  ( 2014-10-07 08:06:05 -0600 )edit

Question Tools

1 follower


Asked: 2014-10-03 08:53:39 -0600

Seen: 395 times

Last updated: Oct 04 '14