Hello all,
I've been banging my head over solving certain particular kinds of
problems in PD and am hoping someone else has found better solutions.
The first example is my camera-control patch. All it does is send serial
messages over comport to the camera. The problem I'm having is sending
the messages too fast and the serial port getting confused. What I
really want is not to limit the number of messages (neccesarily) but
limit the rate at which they get sent to comport.
Here is a more concrete example:
There are two commands I'm using in tandem, "zoom" and "pantilt". Each
is a seperate command for the camera. I want to be able to move the
camera using both these commands simultaneously. (well actually
interlaced). I get a ACK from the camera when one command is complete,
but since I'm sending a zoom and pantilt very close together I can't
know which ACK goes with which command.
What seems to be a good solution to these problems would be a message
queue. In the camera example for each command the camera gets, the queue
stops sending new commands until we get the ACK, then sends the next
command. If you send too many commands too fast, they they just get
buffered. The queue tells you how full the buffer so you could send
commands less slowly.
The problem I'm trying to solve currently is comparing certain items of
a list, and if they match the pattern (float's within a certain range)
then output the list, otherwise throw it away. The difficulty has been
dealing with the timing and unpacking/packing with so many messages
flying through, easy enough to do a comparison of some elements, but how
to keep the list in the [lister] in sync with the items being compared
with a constant flow of messages is challanging, at least for me.
If anyone has any ideas or abstractions along theses lines please let me
know!
otherwise I guess I have to make some kind of spigot-hell lockstep
message processor... but of course using spigots means losing messages.
Thanks all.
b.