Grasshopper

algorithmic modeling for Rhino

hey everyone,

I want to control a rhino-view-camera by the movement of a wii-nunchuck. I get the values from the wii over an arduino (all buttons, accelerators and joystick) and want to use them now for camera movement. 
the first problem is that I can only move an object relative to the values I get (means that when there are values from -1 to 1 this would be the whole range of movement). what I want to do is to add all values steady so that I can have an absolute movement of my object.
second problem is that there are no camera objects in grasshopper yet. is there a possibility to do it with .net?

thank you

Views: 959

Replies to This Discussion

taz,
thank you for your reply. I thought about it before, but each time the arduino passes a value, it is a single integer. as soon as it is updated there is another single integer. Is there a possibility to create an array with a growing number of positions equal to the number of updates? and next question: is there a method to count the amount of updates each 50 ms?
so, this is a part of my modified andrew payne wii-to-grasshopper definition.

on the left side there is the timer set to 50 ms. the vb-component is the interface to the arduino and the wii. on the right side there is the output string, each axis and button value seperated by a "," . now I want to add every 50 ms the first falue to all other first values that have been thrown out since the timer was started. I thought I could need a kind of counter, that adds 1 to a variable each time the solution is updated. with this variable I think I can set new branches to a tree with the latest value from the wii. so I get an tree I can feed a mass addition with.
any suggestions? or is there a smarter way - because I think that a tree created with this method would grow too big really soon...
I may be stating the obvious... but why not simplify some things first. I'm not sure you need all of the data coming over the Serial Port. Why not just try to bring the Joystick Y value in as a single number (that way you avoid having to split all those numbers out... which is actually easier to do without all the commas if you format your data correctly from the Arduino... but that's another matter). But why not just bring over the Joystick Y values and see if the Mass Addition component will work. I kind of have a feeling that this method will not work (although I'd be happy to be wrong :) I have a feeling your going to have to jump into VB or C# to get this to work. I think what you're going to want to do is bring the value over the serial port and dump that value into a temporary variable. This temp value has to be added to all the preceding values and then reassigned to a new variable... Then, you'll need to add that temp. variable to any preceding values and assign that to a new total variable. Each time the serial port updates it gets added to all of the values that preceded it and reassigns that to this total variable. I don't quite have time to crank out a script for this, but it should be a fairly small snippet of code to get it to work. At least, that's how I would see this working conceptually. If you can get the simplified method to work, then you can try to bring all of the values over the Serial port, then separate them all, then perform the same strategy for the addition. I hope this helps.
Cheers,
Andy
hello andy,
thanx for your post. in fact, I just got the seperation of the complete string working, at the end of the definition I get a single integer for each axis or button.
but what you assume is right, I need a temporary variable. thing is, that I did only rhinoscript, processing and grasshopper programming, nothing in .net yet. but I am happy about your opinion that it will not be so complicated making a new .net temp variable component.
I guess I will read the basics of the .net grasshopper primer and see what I can do with it...

but anyway is it possible to have a kind of global variable in a .net component? doesn`t it loose all informations when the script is finished?

thanks for your help
I tried the mass addition with a single value from one axis. the addition throws out only the latest value, not adding all former ones.
think I would also be more happy if you were wrong :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service