shape_shifter md5 issue...

asked 2014-08-16 13:12:21 -0500

codenotes gravatar image

I need to subscribe to messages where I do not know the type. I can't use python (which I could.) I know that shapeshifter is the way to do this, and I can listen to a topic ok. But when I try to send a message to my shape-shifter listener from rostopic, say I try and send a std_msgs/String I get:

publishing and latching message for 3.0 seconds ←[33m[WARN] [WallTime: 1408204869.497000] Could not process inbound connection: topic types do not match: [] vs. [st ng]{'topic': '/chatter', 'tcp_nodelay': '0', 'md5sum': '1bf77f25acecdedba0e224b162199717', 'type': '', 'callerid': ' '}

I think I know why, there is a "morph" function on ShapeShifter that lets it assume the right MD5 and other attribues. But I can't find any demonstrations on how or where to use this. Or if I should. The only way I have seen to create a listener using shapefshifter is somehting like this:

ros::Subscriber sub = n.subscribe<topic_tools::shapeshifter>("chatter", 100, messageCallbackShapeShifter);

Where the call back is:

void messageCallbackShapeShifter(const topic_tools::ShapeShifter::ConstPtr& msg)

There is never an opportunity to set the shapeshifters aparmaters, like the md5 os the message it is going to impersonate.

Appreciate any guidance. Have spent a lot of google time and source-code-crawls to figure this out, but not able to get it. Appreciate any help

edit retag flag offensive close merge delete

Comments

I don't know much about shapeshifter, but this looks like a fairly simple example: https://github.com/ros/ros_comm/blob/...

ahendrix gravatar image ahendrix  ( 2014-08-16 14:35:23 -0500 )edit

Just borrowed some code from the example you pointed to...and yeah, that does seem to work...at least I get the message notification and no md5 error....I really spent a lot of time googling and searching, I am so surpsied that blob example you recommended didn't come up! But thank you...

codenotes gravatar image codenotes  ( 2014-08-16 17:12:32 -0500 )edit

So, subscribing is easier than publishing...to publish, not clear how to publish a ShapeShifter such that it appears to be a "real" message at the listener. This is what morph is, I think. I need to set parameters, serialize the data of a real message into it and send...but not clear how.

codenotes gravatar image codenotes  ( 2014-08-16 17:58:10 -0500 )edit