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

Do all messages share a base class?

asked 2017-03-30 11:55:32 -0500

cpagravel gravatar image

I would like to create a map of a topic name to a template function that constructs a message in the context of publishing to a topic. Essentially I would be following the pattern described in this SO post.

However, the caveat is that the objects need to share a parent class. I was looking at the header files and it doesn't seem to be the case, but perhaps there is something that I don't see.

Is there a shared parent class for all messages?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-03-30 12:36:06 -0500

Dirk Thomas gravatar image
edit flag offensive delete link more

Comments

That's what I gathered as well from looking at the header files, but I had hoped I overlooked something. Is there a way to change this without breaking anything?

cpagravel gravatar image cpagravel  ( 2017-03-30 14:20:08 -0500 )edit

Well, you could change the C++ template locally and rebuild all of ROS from source to utilize it. But your code using that would be incompatible with "normal" ROS packages.

Dirk Thomas gravatar image Dirk Thomas  ( 2017-03-30 14:56:12 -0500 )edit

Can I suggest this for the future ROS versions? It's a small change to make.

cpagravel gravatar image cpagravel  ( 2017-03-30 18:46:42 -0500 )edit

Please see why a base class has been removed in the first place: http://answers.ros.org/question/19982...

Dirk Thomas gravatar image Dirk Thomas  ( 2017-03-30 19:03:53 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-03-30 11:55:32 -0500

Seen: 644 times

Last updated: Mar 30 '17