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

extend JointState with more data

asked 2014-11-17 09:02:23 -0500

mark_vision gravatar image

Hi all, the JointState message is useful but it contains only a subset of the data I want to show. How can I add more data on the JointState msgs? Do I need to create a custom msg? How about Rviz and other software are then able to understand them?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-18 16:02:06 -0500

Wolf gravatar image

updated 2014-12-05 08:35:16 -0500

Yes and no. Yes if you want to parcel additional data in the same message with a JointState message you will have to create an custom message that contains a jointstate message as one message field and some other fields for your specifc data. And no, Rviz will no longer understand your custom message as ros messages do not provide some kind of inheritance such that a base message would still be available in a derived type without changes of the application code.

As I guess this it not the answer you where hoping for I'd like to suggest another workaround. If you want to publish some data along with the jointstate from one of your nodes to another of your nodes (I guess that's the case as rviz etc. cannot be your target subscriber as they won't "understand" your additional information anyway) you can publish the jointstate message along with another additional message of a custom type. Be sure to add message Header field to your custom message and copy exactly the same timestamp to the message header in the jointstate message and your custom message.

Then in your subscribing node(s) set up a message filter for synchronization with exact time policy:

Then you get a common callback for the jointstate message and your custom message with additional information and you can do the processing of the combined data there!

edit flag offensive delete link more


I wanted to avoid this solution, but it seems unavoidable. And anyway thank you. Maybe we should suggest inheritance as new feature for newer version of ROS.

mark_vision gravatar image mark_vision  ( 2014-12-05 05:52:06 -0500 )edit

Question Tools


Asked: 2014-11-17 09:02:23 -0500

Seen: 448 times

Last updated: Dec 05 '14