I have been working on experimenting with Vuo by converting Processing sketches to compositions and learning more about Vuo by digressing down I-wonder-how-to-do-xxxx paths. One of these experiments is programmatically setting the Counter, but I have had no success.
I am including 3 basic compositions that have me confused.
Counter with Reset
I want to reset the counter when the count reaches a certain value. Expected Output: Display console outputs 1,2,3,0,1,2,3,0… Actual Output: Blank console.
Counter Became True 1
Trying to understand the composition I constructed 2 tests. This one works as expected… Expected Output: Display console outputs “Hello” once after the count reaches 3 Actual Output: Display console outputs “Hello” once after the count reaches 3
Counter Became True 2
… this one does not… Expected Output: Display console outputs “Hello” once after the count reaches 3 Actual Output: Display console continues to output “Hello” after the count exceeds 3
Can someone clarify my ignorance on why these compositions give the results below?
This composition has an infinite event-feedback loop (the event coming out of the count port goes back into the setCount port, ad infinitum). In Vuo 0.8.0 (coming in a few weeks), we’re improving the editor so that it informs you of situations like this and how to deal with them.
One simple way to get this composition working would be to insert a Hold Value node between Count and Are Equal, and to connect Fire Periodically to its refresh port — like in the attached composition. Then, each time Fire Periodically fires, it will compare the previous count, and if it’s too big, it’ll send an event along to setCount to reset it.
(Keep in mind there’s also a Count within Range node which automatically wraps around.)
Counter Became True 2
Remove the cable connecting Fire Periodically to Became True, then this composition will behave as you expect. If you fire an event into a node’s refresh port, it will always come out of all of that node’s (non-trigger) output ports.
In “Counter Became True 2” removing the cable from Fire Periodically causes Display Console to print hello when Became True fires as you indicated. This seems to indicate that the event is only fired (and sent down the cable ) once.
If that is true then why is there an infinite loop created if Became True is instead connected to the setCount port instead of writeLine? I would expect that the event would only propogate down the cable once just like it does when connected to writeLine.
Thanks, clearing this up will be really helpful to understanding Vuo better.
Hi, @Bytezen. You asked why Vuo says that Count -> Are Equal -> Became True -> Count is an infinite feedback loop, even though you can see it’s not.
It’s because Vuo errs on the side of caution when detecting infinite feedback loops. Basically, it would be computationally very slow/difficult for Vuo to figure out what you’ve figured out. When you look at the composition, you notice things like “Became True only outputs an event when Count increments from 2 to 3” and “if Count receives an event into setCount then it outputs 0”, and you put those rules together to realize that the feedback loop is not infinite. Well, Vuo doesn’t have this kind of reasoning ability. It doesn’t understand the inner workings of Became True, Are Equal, and Count. All it knows is that there’s a feedback loop that might be infinite.
So that’s why you always need to put a Hold Value node or some other node with an event wall into your feedback loop. Even if you know the feedback loop is not infinite, you have to make sure that Vuo knows, too.