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.
moin Ben,
On 11/13/2005 11:18:49 PM, "B. Bogart" ben@ekran.org appears to have written:
What I really want is not to limit the number of messages (neccesarily) but limit the rate at which they get sent to comport.
What seems to be a good solution to these problems would be a message queue.
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.
... I'm not sure to solve this problem (I'm not certain I understand exactly what the current problem is, actually), but I have written a [deque] external for message-queueing, although it's probably much easier to just use [list] for that these days...
In case you're interested,
http://www.ling.uni-potsdam.de/~moocow/projects/pd
marmosets, Bryan
B. Bogart wrote:
Hello all,
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!
since it seems you are using zexy anyhow, i'd suggest [fifop], which is a FIFO (with priorities; but you can safely ignore them is you don't need them). for pure self-advertisment, there is also a [lifop], but you probably won't need that.
also there is [listfifo] in maxlib, (which apparently works on lists and has no priorities)
i am sure that these objects could be build somehow with the new [list] (but i haven't had the time yet to do so, frank ?)
otherwise I guess I have to make some kind of spigot-hell lockstep message processor... but of course using spigots means losing messages.
this sounds like [speedlim] from iemlib2.
mfg.a.sdr IOhannes
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
since it seems you are using zexy anyhow, i'd suggest [fifop], which is a FIFO (with priorities; but you can safely ignore them is you don't need them). for pure self-advertisment, there is also a [lifop], but you probably won't need that.
also there is [listfifo] in maxlib, (which apparently works on lists and has no priorities)
i am sure that these objects could be build somehow with the new [list] (but i haven't had the time yet to do so, frank ?)
I don't think it would be trivial, because storing lists of lists in [list] is not directly possible, [list] just stores lists of atoms. A buffer for atoms is in [list]-abs with [list-lastx] formerly known as [last-x].
But if you have an idea how to realize a list-fifo with [list], I'd be happy to take it.
For a general approach, also PDContainer comes to mind.
Frank Barknecht _ ______footils.org_ __goto10.org__
Hi Johannes,
Indeed fifop looks nice, I'm tinkering with it now.
Problem is with lots of messages flying and trying to debug It would be great if we could query the number of messages in the stack.
for example I just messed up my patch and the poor thing was filling up like crazy, and I had no way of knowing... without watching the memory increase
Thanks!
b.
IOhannes m zmoelnig wrote:
B. Bogart wrote:
Hello all,
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!
since it seems you are using zexy anyhow, i'd suggest [fifop], which is a FIFO (with priorities; but you can safely ignore them is you don't need them). for pure self-advertisment, there is also a [lifop], but you probably won't need that.
also there is [listfifo] in maxlib, (which apparently works on lists and has no priorities)
i am sure that these objects could be build somehow with the new [list] (but i haven't had the time yet to do so, frank ?)
otherwise I guess I have to make some kind of spigot-hell lockstep message processor... but of course using spigots means losing messages.
this sounds like [speedlim] from iemlib2.
mfg.a.sdr IOhannes