Grasshopper

generative modeling for Rhino

Counting rotations of spool with Firefly + Grasshoppper

Heya,

I've set up a rotary encoder and attached it to a spool of wire with the aim of working out the length of wire that has been output from the spool. Currently I have the rotary encoder outputting the angle in degrees that it is at. What I want to do, it set up some sort of counter object to count the number of complete rotations that the sppol has gone through (ideally increasing the counter when the encoder goes from 360 -> 0 degrees, and decreasing it when it goes from 360 -> 0 degrees). What's the best way of doing this in Grasshopper?

I've tried a number of ideas, such as state detection, but that only seems to count in one direction.

Any thoughts?

Thanks very much.

Views: 68

Reply to This

Replies to This Discussion

I've come up against some similar issues when dealing with robots with axes with greater range of motion than 360°

To keep track you need to be able to store a value, and compare current to previous state. This isn't possible using only regular grasshopper components, but can be done with a simple script.

See the attached script for a solution. It will zero the counter when reset is true, and count turns when it is switched to false.

Attachments:

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2013   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service