Grasshopper

algorithmic modeling for Rhino

How to Refresh a Component so it updates a data stream on a timed interval? [Firefly]

Hi everyone,

Long time lurker, first time poster.

Some background:
I am using an Arduino computer chip hooked up to an extension for GH called Firefly. I'm not sure if you're familiar with it, but it simply lets you communicate with the chip in real time with other peripherals. In my case, I'm using the Xbox Kinect to read visual movements, assign a point ID to something like the left and right hand, translate its x-coordinate into a number, and have that number move a robotic arm servo. Sorry if this sounds like your upcoming robotic apocalypse.

My problem is that because my hand is always moving, it is continually reading the data in real time and crashing Arduino because it is continually processing the rotational distance (in degrees between 0-179). For example, if my hand was moving from 1 to 50 degrees, it's computing 1, 2, 3, 4, 5, 6, ..etc instead of 1 and 50 as two separate states.

Is there a way to have a component refresh its value in a certain interval? This would mean it could read my hand at different intervals and print a value at timed increments instead of doing it all in real time. A simple practice exercise would be to create a random component and have the component refresh so that every 1 second or so it would produce a different number. The app is essentially refreshing. I thought the Timer component worked, but I misunderstood what it's used for, and I don't think it does what I intend it to do.

I've attached some pictures to show what I'm attempting.

And a file to recreate the problem with a different instance.

Thanks so much for your help! 

Views: 2257

Attachments:

Replies to This Discussion

Hi Kryan, you could use the DataDam (From Parameters > Util tab)

Thanks for the speedy reply, exactly what I'm looking for in terms of the function!

But, now the timer is not regulating my data dam in the intervals I need. Is it possible I'm using the timer incorrectly?

Attachments:

Now it reads at 5 fps and only passes through the dam at 1 fps

Absolutely perfect! 
Thanks so much- just what I needed

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service