ROS Messages from Baseclass struct's

asked 2019-02-22 03:49:47 -0500

MarcelKr gravatar image

Hey, I'm using ROS in a larger project. Therefore platform independend Baseclasses are used. The Baseclass has public functions that need special Input structs. Up to now I was rebuilding these structs as a special custom message, but to parse it to my baseclass function I need to remap every single value of two structs, that have the same structure.

My Question is: Is there any posibility to create ROS Messages without this need to convert the ROS_msg_struct to the (equal) input_struct value-by-value?

Please note: It is very important that the baseclass stay's platform independet.

Thank you in advance!

edit retag flag offensive close merge delete


There is no way I'm aware of to do this. ROS messages are built for multiple languages using a custom system. If you have a very large amount of structs to convert it's possible you could write a script to automatically generate the .msg files and the two conversion functions to save time.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-02-22 05:38:45 -0500 )edit

I'm not entirely sure I understand what you're trying to do, but perhaps roscpp/Overview/MessagesTraits and roscpp/Overview/MessagesSerializationAndAdaptingTypes help.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-22 10:25:48 -0500 )edit