Long:
I'm sending messages on a channel at 100 Hz from a C process to other
C processes, as well as a python GUI. It is perfectly acceptable for
the python GUI to drop packets; only ~20 Hz is probably necessary for
a smooth display. However, at speeds above ~40Hz, the GUI begins to
lag more and more (presumably as a buffer begins to fill up), and
eventually display lcm warnings about dropping packets. Furthermore,
this occurs whether the message handling function takes some action
(i.e., assigns part of the message to a variable), or simply calls
"pass", and does nothing.
I was hoping there was a way to force the buffer size to be very small
on an lcm object (or a single lcm subscription), as it would seem that
just the underlying lcm code required to parse this message before
calling the handler is too slow. I would be happy to drop packets,
but can't find a way to do this in the examples or documentation. Is
there something simple I'm missing? I'd rather not set this for all
of the processes that are running lcm, so changing interface
properties could alleviate the problem I'm experienced, but would not
be preferred.
Any suggestions would be helpful. The only thoughts I've had so far are to
1) Reduce the buffer size (the preferred solution)
2) Try to write the message handling in C, called from python (this
involves more hacking into lcm guts than I'd prefer)
3) Write a "go between" program (in C) that reduces the frequency of
messages on this channel, and republishes them on a separate channel
for the Python GUI process to subscribe to (this seems like a hack
that introduces its own system dependencies in terms of necessary
rate)
Thanks!
--Matt
You might be interested in the "buffers" branch, which does what
you're asking for. I'm planning on merging this into trunk in a few
weeks.
It's currently in svn in "branches/buffers"
You'd use it like:
import lcm
def message_handler(channel, data):
# do something with the message
pass
comms = lcm.LCM()
subscription = comms.subscribe("MYCHANNEL", message_handler)
subscription.set_queue_capacity(10)
=====
The last line is what's new, and sets a per-subscription limit on the
number of messages queued up. I haven't had a chance to test it
thoroughly, but it should hopefully do what you're looking for. If
you do try it, please let me know how it goes.
Albert
> --
> You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
> To post to this group, send email to lcm-...@googlegroups.com.
> To unsubscribe from this group, send email to lcm-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/lcm-users?hl=en.
>
>
--matt