[ros-users] Filtering messages at the source

Markus T. markus-t314 at gmx.de
Wed Sep 15 02:02:10 UTC 2010


Hi,

I already asked here some time ago but forgot to mention the subject in
the email, so I will first quote the old mail (inclusive answer) before
asking further:


> Author: Ken Conley
> Date: 2010-07-31 00:52 +200
> To: ros-users
> Subject: Re: [ros-users] (no subject)
> 
> Partial answers below
> 
> On Fri, Jul 30, 2010 at 3:45 PM, Markus --- <markus-t314 at gmx.de> wrote:
>> Hi,
>>
>> I am currently developing a gui (in c++ using Qt) for ros (using the
>> latest svn version from
>> https://code.ros.org/svn/ros/stacks/ros/trunk/)
>> and have some questions:
>>
>>
>> 1. I want to configure filters for subscribers. But these filters
>> should be applied before the messages are sent, so that not every
>> subscriber receives a message. I only found the existing
>> message_filters, but in this case the messages are sent over the
>> network and then are filtered before passing to the subscriber.
>> Ideally the subscribers can also change their filter settings at run
>> time.
>>
>> For example my application has one node "A" which publishes images and
>> another one "B" subscribing these (both nodes run on the same
>> machine). Now I'd like my gui node "C" (which runs on a remote
>> machine) to receive the images, but to reduce network traffic I'd like
>> the gui to only receive e.g. every 10th image, whereas the local node
>> "B" still needs every message.
>>
>> I looked into the source code and thought of maybe editing
>> Publication.cpp's function:
>>        bool Publication::enqueueMessage(const SerializedMessage& m)
>> where the message is sent to all subscribers.
>>
>> The problem is the publication-class doesn't have the necessary
>> information to achieve this. So my question, is it somehow possible to
>> achieve the described behaviour without modifying the ros-code too
>> much, or in any other way?
> 
> 
> You may want to take a look at topic_tools. Bascially, you would run a
> throttle node on the other side of your link that would limit the
> bandwidth that is transmitted. You could probably modify the throttle
> code to make your own node that was more run-time configurable by your
> GUI.
> 
> 
> Hope this helps,
> Ken



This approach is OK for a small number of nodes, but by adding more and
more nodes it becomes inefficient. I focused on dropping messages and
looked into the source code of topic_tools/drop.cpp. This tool adds
another node between my two original nodes. The additional node still
receives every message from the source and forwards only a subset of it.
Now I have a large number of publisher- and subscriber-nodes with
individual filters, for example:

publisher ->   filter        ->  subscriber
P_1       -> [F_A1,...,F_X1] -> [A_1,...,X_1]
...       -> [...]           -> [...]
P_n       -> [F_An,...,F_Xn] -> [A_n,...,X_n]

In the worst case an additional number of n*X filter-nodes must be
created, which will result in much more message (de)serialization than
needed.


With that being said, my question remains:
Is it possible to filter the messages before they are actually sent?
And if so, where do I have to modify ros?


Thanks in advance
Markus
-- 
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl



More information about the ros-users mailing list