[ros-users] getting a topic's md5sum without subscribing
Josh Faust
jfaust at willowgarage.com
Sat Mar 27 20:49:02 UTC 2010
On Fri, Mar 26, 2010 at 8:08 PM, Ken Tossell <ktossell at umd.edu> wrote:
> Hey ROS,
>
> I'm working on a node to send messages between other nodes (the proxy
> subscribes to a topic, the publisher sends one copy of a message to it,
> then it forwards the message to several nodes). I need to find the MD5 sum
> of all of the topics so that the proxy can advertise its version of /topic
> as /proxy/topic using the correct signature.
>
As Eric noted, take a look at the relay node in the topic_tools package. It
should be possible to trivially
make it into a multi-relay. It works by:
* Subscribing to the topic with '*' as the md5sum
* Reading the md5sum from the connection header of the incoming message
* Advertising on the output topic with that md5sum
Note that the class it uses to subscribe (ShapeShifter) is not documented or
reviewed so it may have an unstable API.
>
> I had planned to get the MD5 sum using master::getTopics(), but where
> TopicInfo is supposed to have [name, type, md5], getTopics()'s output is
> [name, type, type]. (The underlying RPC doesn't convey the MD5 sum,
> either.)
>
Not sure how that snuck through, I must have forgotten to remove the md5
member when I discovered the information didn't exist on the master.
>
> Is there any way to determine the MD5 sum of a topic without first
> subscribing to it?
>
In general it's best to do what topic_tools does, as there are a lot of
problems involved with querying the master for that information. For
example, you'd have to be polling the master constantly in order for it to
work on topics that are not already being published. There are also race
conditions to deal with, such as the publisher changing its type between
your call to the master and your subscription (unlikely but still).
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100327/3c2fd62b/attachment-0003.html>
More information about the ros-users
mailing list