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

From structure to message

asked 2011-11-07 03:39:41 -0500

Guido gravatar image

updated 2011-11-07 21:49:20 -0500

Hi everybody,

Does someone has ideas about how to directly send a C structure over topics/services/actions ? Currently I read some data from a file and end up with this data in a structure S, then I copy the data in S into a ROS msg data structure ROS_S (which is identical to S). This copy-past step bothers me and I would like to know if someone has a simple solution about this.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-11-07 04:11:32 -0500

bhaskara gravatar image

To avoid the extra step of converting from S to ROS_S on the publisher, you can define custom serialization functions for S.

edit flag offensive delete link more


This should work quit fine. Thank you.
Guido gravatar image Guido  ( 2011-11-07 21:57:51 -0500 )edit

answered 2011-11-07 04:12:44 -0500

tfoote gravatar image

If they're actually identical you could just use ROS_S instead of S the first time.

edit flag offensive delete link more


Indeed it would be simpler. However I don't have control on the first reading step (from data to S) so I can't read the data and put it directly in ROS_S.
Guido gravatar image Guido  ( 2011-11-07 21:50:38 -0500 )edit

Question Tools


Asked: 2011-11-07 03:39:41 -0500

Seen: 2,864 times

Last updated: Nov 07 '11