Grasshopper

algorithmic modeling for Rhino

Question RE: Continuous Redraw Involving -- grasshopper+arduino+firefly+VBscript+continuous redraw engine

Hello,

I am still pretty new to grasshopper and very new to scripting.  I have a wall skin ghx that is supposed to respond to body temperature sensors to open up pockets in the wall for a semi-private nook to duck into in a public space if, for instance, one had to make a call.

The definition works generally.  I have data from 3 temp sensors corresponding to 3 possible nooks in the wall written to a serial port by arduino.  I'm using andy payne's fire fly to read the data in grasshopper and output a position for various control points of splines lofted to make up a wall surface.  

The splines currently change states at set threshold values.  I scripted the threshold values as if/then/else statements in vbscript.

The model works conceptually in that control points change position to open up pockets in response to temperature change.  HOWEVER, the motion is a jump in position and not a smooth transition.

To address this, I'm looking at two options and ask for any help or advice with either OR perhaps suggesting a better way to approach the problem overall.

OPTIONS EXPLORED CURRENTLY:
- 1 - 
use Giulio Piacentino's continuous redraw engine -- (have hooked it up but is not working -- not sure what is wrong --- my suspicion is that the use of a timer to read the data coming in over the serial port is resetting the engine before it has a change to execute its sequence --- not sure if this is right diagnosis yet and if so, if there is a work around

- 2 -
add loop to existing vbscript such that once threshold value is achieved, the position of each respective control point steps through values i+1 <= max and the next x number of readings from the serial port are ignored (enough time for the position of each control point to step all the way through its sequence, about 2-3 seconds)

My file and ghx are attached

Any advice is greatly appreciated.

Views: 639

Attachments:

Replies to This Discussion

Hi Joe,

have you tried the in-built Timer to expire a certain top-level component? You'll find it in Params->Special.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
I would think that adding the loop to the VB code would be the best way to go. I haven't had a chance to take look at your definition, but I don't think that using both the Timer component and Giulio's engine component will work. It was my understanding that Giulio's Engine component was almost identical to the Timer component anyway... it was sort of the precursor to the Timer component... so adding both would be a little redundant... although I could be wrong. I think the loop is the best method.
Thank you for the prompt response.

Can I run multiple timers independently? If I have three sensors + firefly that would be four timers running, each working independently.

Also, right now I've set up a step counter in the vbscript. I put the timer just to the right of the vbscript outputs and to the left of the list items so that the counter values step going into the list item. This is what I just tried but I didn't get it to work --- it still jumped. I set the timer to transition for 2500 ms and that is to cover 36 steps so it should have been a gradual transition.

Any advice is greatly appreciated.

Also,
Joe,
Why do you need multiple Timer components? Why not write all three sensor values to the Serial Port (make sure they're all printed to the same line... use Serial.print for the first two values and then use Serial.println for the last and all three values should be printed to the same line). Then you can just use a single variable expression to extract the values your interested in (using the functions Left, Right, or SubString). Let me know if this make sense. You can find a more detailed breakdown of this here.
Andy,

Your description makes sense. I think the timing of my response was unfortunate. I hit 'add reply' apparently right as your comment posted.

I have the three sensor values writing to the serial port as one six digit string that gets parsed in grasshopper as per your tutorial. Once in grasshopper, the three sensorPin values feed into a vbscript that uses if/then/else statements to morph the splines that define my surface based upon threshold temperatures and maximum travel distances for the control points. I have set up a step counter in the vb component which seems to be working but I need to slow the steps. So it seems I need to introduce a delay for each step value.

Alternatively, as David Rutten suggested, perhaps there is a way to use timer components. Though I have not gotten that working yet.

I think I'll focus on the script for the moment but may retry the timer suggestion as well to see if I can get it working both ways.

If I can do this with additional timers I am open to it. Otherwise, I'll work on scripting it.
just saw andy's reply -- i'll focus on the loop -- thanks

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service