Firefly

Firefly offers a set of comprehensive software tools dedicated to bridging the gap between Grasshopper, (a free plug-in for Rhino) the Arduino microcontroller and other input/output devices. It allows near real-time data flow between the digital and physical worlds – enabling the possibility to explore virtual and physical prototypes with unprecedented fluidity.

Load Previous Comments
  • CarloMaria Ciampoli

    This is not really the way it should look, right?

    Is Firefly supported on R5 64-bit?

    Thanks Andy

  • Andy Payne

    Hi CarloMaria,

    Unfortunately, Firefly isn't yet supported on 64-bit applications.  Well, to be more accurate... the computer vision and audio tools aren't supported on Rhino 5 64-bit.  This is because the C_sawapan_media.dll which is what Firefly uses to tap into the video capture devices and microphones isn't compiled for 64-bit applications (this was noted as a known bug in the ReadMe.txt file in the download zip file).  It's on the list of things to work on over the next few months (it's actually a relatively big task to update that library)... but for now, if you want to use the Computer Vision and Audio tools, you have to use either Rhino 5.0 32-bit or Rhino 4.

    Sorry for the confusion.

    Cheers,

    Andy 

  • CarloMaria Ciampoli

    Thanks for your reply Andy!

  • Steve Moody

    Hey Andy, my Firefly tab looks similar to CarloMaria's, and I wanted to make sure there isn't something I'm missing.  I've never been able to use the vision or audio tools in rhino 5, but the OSC components were invaluable to me and were working fine in 64bit rhino 5 until I upgraded to grasshopper 0.9 and the timer attached to the listener started going haywire.  Are the OSC components also broken in 64bit now?

    Thanks!

  • Andy Payne

    Hey Steve,

    Sorry to hear your having trouble.  Are you using Rhino 5 32-bit or 64-bit?  Just curious.  All of the components should work in 32-bit and the Arduino, Networking, and Utility tools should work in both versions.  I've tested them in Rhino 5 and they work on my machine.  If your screen looks like CarloMaria's, can you double check that all of the .gha files and .dll's have been unblocked.  To do this, right-click on each of those files (included in the installation folder) and select Properties.  On the pop-up menu, at the bottom of the page, you should see a button that says Unblock (this only appears if they are currently being blocked).  For some reason, downloading files off the internet causes some of the files to get blocked... and Rhino 5.0 is more picky about loading them in that instance.  Let me know if that helps.  Also (and I found this out recently from another user)... it's better if you don't have both 32-bit and 64-bit versions installed on your machine at the same time.  It seems that sometimes this can cause a conflict too.  When the other user uninstalled the 64-bit version, everything loaded fine in the 32-bit application.

    There' haven't been any major changes to the OSC components.  I did add a couple of features mainly to parse up some of the messages sent from other applications... notably from GyrOSC (http://www.grasshopper3d.com/video/gyrosc-kangaroo).  Some of the messages are sent as lists of 4 values (like the quaternions sent in that app) or lists of 9 values (like the matrices sent using that app).  Anyway, other than adding datatype parsers for these, I didn't change anything else about the component... so it should work as before.  Let me know if you're still having trouble.

    Cheers,

    Andy 

  • Steve Moody

    Thanks for the quick reply,

    I am using R5 64bit, the arduino and utility tools appear, but no networking, and none of the .dlls are blocked.  When I boot up Rhino 4, all of the components are there.  I'm going to try to reinstall to see if I can get the networking stuff into R5, as that's really what I need.

    On a somewhat related note, I'm trying to upgrade so I can try the updated osc listener because I ran into problems with this component when I upgraded to grasshopper 0.9.  After the upgrade, the output of the osc listener toggles between the received data and an empty list at the rate of the attached timer.  Before it would simply update the values based on the timer, but now it seems to clear all the values and reload them with each tick of the timer, and this breaks the rest of my script.  Is there a way to avoid this?

    If you have any tips they will be much appreciated, otherwise I think I will just downgrade both grasshopper and firefly till everything is worked out.

    Thanks again!

  • Andy Payne

    Hi Steve,

    I think downgrading to Rhino 5.0 32-bit should solve the issue with the toolbar.

    As for the OSC problem... Do you think you could send me a file that shows the issue you described.  In theory, nothing in the list should be removed (and re-added) since the messages are stored in a dictionary (key, value) and only updated if the incoming message key matches one already stored in the dictionary.  Again, nothing (from a Firefly perspective) has really changed in that regard.  Perhaps something in the Grasshopper core changed, which is causing this issue.  If you have a working file that you could send... that would be helpful so I could try to diagnose the problem.

    Cheers,

    Andy

  • Steve Moody

    I'm unaware of how to link a file in one of these posts so I'll send an email with the gh file and the TouchOSC file I've been using with it to the  info@fireflyexperiments.com address for you to check out.

    Steve

  • David Stasiuk

    I'm trying to send timer-triggered strings through the quad stepper motor controller and am having some difficulty...it will work for several timer steps, and then simply stop driving the motors...so, for example, every second I'd like to pulse my 1st motor by -250 steps using a 1000 max speed and 1000 acceleration. The string list goes as follows:

    -250,0,0,0,1000,1000,1,0

    -500,0,0,0,1000,1000,1,0

    -750,0,0,0,1000,1000,1,0

    -1000,0,0,0,1000,1000,1,0

    etc.

    Using Giulio Piacentino's "theEngine" script to drive a list selection of these string instructions, one by one, results in the motor being correctly pulsed for a variable number of changes in the timer value (which is actually dependent on the timer interval itself...the longer the interval, the fewer pulses will work...in this case, if I set the interval at 1000, 8 pulses work, if I set it at 100, 42 pulses work...so strange).  But really I'm trying to feed quite a long list of changes through...we're using this to drive a wire bending machine that relies on a feeder motor, a z-rotation motor, and a bending motor.

    So the motor runs for these few pulses, then simply cuts out, although the arduino LED that indicates it's reading incoming information continues to pulse along with the timer.  Anyone have any idea what may be going on?  Something about the buffer in the arduino firmata script getting overloaded?  I have no idea!

  • Andy Payne

    Hi David,

    I haven't seen this behavior before... but I haven't used the Engine component much (since David re-wrote the GH Timer some time ago)... although I can see the benefit of using it because of the customized timing intervals.  Out of curiosity... does the number your sending to the motor fail at a given number? Say, something outside the bounds of -32,768 to 32,767.  Or does it just fail after a given number of intervals?  Do you want to share a definition?  Also, it might be helpful to start a discussion post on this topic so we can keep all of the comments in a specific thread.

    -Andy

  • Philipp

    it will be really nice not only to test colors for similarity but also find a most similar color in the list

  • lmnts

    I'm trying to get more speed on a stepper motor through the Quadstepper Driver.  The max speed I can get at the moment for a Vexta Nema 17 (http://www.interinar.com/vexta-px243m-03aa.html) is about .3 rotations per second.  If I test the quad stepper on a smaller stepper like this one ((http://robotics.reefat.com/wp-content/uploads/2008/08/PF35T-48L4.pdf), I'm able to get faster speeds.

    At first I thought this was a hardware/power supply issue, but I tested a sample sketch from this site: http://lusorobotica.com/index.php/topic,106.0.html on the Vexta NEMA 17 and was able to get the increased speeds I was looking for.

    I can't get higher speeds than .3 rotations per second using the Quadstepper Component.  Is there any way there a line in the code which is limiting the max speed?  

    Thanks for any help.

    -Erick

  • philipp hornung

    hi,

    i am new to arduino/firefly..

    and trying to build a kinetic modell, run two-axis's each by a stepper motor.

    thats the hardware i am using:

    2x stepper nema17

    http://datenblaetter.physicalcomputing.at/StepperNEMA17.pdf

    ---

    arduino mega2560 r3

    http://arduino.cc/en/Main/ArduinoBoardMega2560

    ---

    2x stepper drivers polulu

    http://www.pololu.com/catalog/product/1201

    http://www.pololu.com/file/download/a4983_DMOS_microstepping_driver...

    i tried to do the wiring like shown in this picture:

    http://www.physicalcomputing.at/.media/825136296502.png

    and here you can see the wiring in my setup:

    i tried to upload the quadstepper firmata onto my arduino board but without success. (uploading the firefly firmata seems to work on the first look.)

    i allways get the following errors shown in the screenshot.

    what i am doing wrong? is there something incompatible... what could be the problem?

    i hope someone knows the problem/a solution/hint..

    thank you in advance!

    philipp

  • Andy Payne

    Hi Phillip,

    Have you installed the Accel Stepper library?  There is a ReadMe.txt file included in the Stepper folder which explains how to do this.

  • philipp hornung

    hi andy,

    thank you for your quick reply!

    yes, i had installed the accelstepperlib..

    what else could it be.. any idea?

    thank you

  • philipp hornung

    ..thats outlined while trying to run firefly's quadstepper definition:..any clue?

    thank you!

  • Andy Payne

    Hi Phillip,

    No, I do not think it has anything to do with the Code Generator (in your last image).  The code generator is unnecessary unless you want the arduino to run autonomously (and not connected to your computer).  As long as your board is connected to the computer via a USB cable, then we can send serial information back and forth.... so we can just use Firefly natively through Grasshopper.

    I think the main issue is uploading the code onto your board.  Nothing will work properly if the Quad Stepper sketch isn't loaded onto your board.  In looking at the screenshots you've posted, it looks like all of the Firefly sketches (including the Firefly Firmata, Quad Stepper Sketch, and Wii Sketch) are located in your libraries folder.  However, these should be placed in the root Arduino folder (in MyDocuments/Arduino)... not inside the libraries folder.  You still need the libraries folder there, and in that folder should be the Accel Stepper library... but the Firefly sketches should be placed in the root sketchbook folder.  I'm not exactly sure if this is what's causing the issue... but when you open the Quad Stepper sketch, you shouldn't see the other tabs (AccelStepper and FireflyFirmata) like it does in the original screenshot you posted.  I think it's trying to load these sketches as well, and causing a conflict.  Try the suggestion above and let me know if that fixes your problem.

    HTH,

    Andy

  • philipp hornung

    hi andy,

    great.. now it seems to work!

    ..and the upload worked too! thanks mate! :)

    but unfortunately my setup is still not working.. wondering why...

    have to check the polarity of the steppers... hmm..

    but thank you so far andy!

    will post something if i manage to get it workin..

    best

    philipp

  • philipp hornung

    andy,

    btw.. do you got experience with the polulu stepper driver? ;)

  • Andy Payne

    No.  Unfortunately, I haven't tried that particular driver.  But as far as I know, it should work with the Firefly Quad Stepper sketch.  Are you still having difficulty?  BTW, it might be best to start an actual discussion thread (above) instead of on the general message board... that way we can track the entire conversation.

  • philipp hornung

    yes, as far as i read thru the documentations.. it should work as well.

    sorry.. you are rigth.. new thread.

  • Miguel Vidal

    Hello! As there is a keyPressed component, is there other one for mousePressed?

    what windows functions are you using for this tools in case I would need to use them in a script?

    thanks!

  • Andy Payne

    Hi Miguel,

    The IsKeyPressed component makes use of the built in User32.dll Microsoft library (http://en.wikipedia.org/wiki/Microsoft_Windows_library_files)  Once this library is imported into the project, you can tap into key events (and potentially other events... although I'm not sure this is entirely necessary for mouse events... Grasshopper is already doing some stuff for mouse events).  

  • Miguel Vidal

    Hi Andy!

    Thanks for your reply, I´ll try that.

    One more question: in the last version of Firefly, did you erase the functions for sound management?

  • Andy Payne

    What do you mean, erase the functions for sound management?  Are the audio components for Firefly not showing up?

  • Miguel Vidal

    Exactly!

    After installing the latest version of Firefly, the "Audio" Tab is not there.

  • Andy Payne

    Are there other tabs missing (ie. Computer Vision)?  What version of Rhino are you running?

  • Yoshi Fukumori

    hello Andy! I have the same problem, I have Rhino 5 in 32 and 64, after installing the latest version of firefly the audio tab, computer vision tab and conexion tab are missing. 

    I check the component folder and all the files are unblock.

    thanks for your help and as always thanks for sharing

    your knowledge! :)

  • Andy Payne

    Hi Yoshi and Miguel,

    Sorry to hear your having troubles.  It seems like for whatever reason it's not recognizing the Firefly_X.gha (which contains all of those components).  My hunch is that the installer is not overwriting the existing files (even though that is set in the installer settings).  Can you both try to manually delete all the existing Firefly files and dependencies (including the C_sawapan_media.dll) and try to re-install.  I think if the files are not there, then the installer will copy the new files and it should work (at least I hope).  Can you try this and report back.  Thanks.

  • Yoshi Fukumori

    Hello Andy! it works for 64, but for 32 I still have the problem. 

  • Igor

    Hi Andy!

    Is there a way to get sound from stream video (Internet video,Skype...) and from Video Player not from microphone only?

    At reading attempt from MusicXML file the error stands out. What is wrong?

    Example of MusicXML :    LVB_OP18_NO1_M1.xml

  • Andy Payne

    Hi Shahriar,

    Have you made sure you have successfully uploaded the Firefly Firmata on your board before running your GH definition?  Also, is there a reason you changed the baud rate to 9600?  The baud rate needs to be the same as what is set in the Arduino Sketch.  For the Firmata it is 115200... unless you changed this specifically, then you should probably use the default value of 115200 in the Open Port component.  This could be possibly what's causing your error.

  • Matt O'Brien

    Hi Andy,

    Having trouble with the Code Gen in the latest grasshopper 9.0056..

    getting this "controlknob" error with any definition,( no control knob component is being used) :

    Solution exception:Could not load type 'Grasshopper.Kernel.Special.GH_ControlKnob' from assembly 'Grasshopper, Version=1.0.0.20, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803'.

  • Andy Payne

    Hi Matt,

    This control knob issue is a minor issue that popped up with the latest release of Grasshopper.  It seems David changed the naming convention of the knob (it used to be called Dial).  I've fixed this in the next release... but I don't think it should cause you any issues with still using the Code Gen.  Are you still having trouble?

  • Matt O'Brien

    Hi Andy,

    Thanks for the reply, although it doesn't seem to matter what definition I use, even your "firefly_05_CodeGen" example throws the same error and no code is produced, and there is no knob/dial to be found?

  • Andy Payne

    Yes... this will happen because the Code Gen (which was compiled against a different version of GH which used to call the Control Knob a Dial).  So, even though you aren't using a knob... the code gen when it compiles itself into a component... has a definition which is trying to specify what happens when it detects a knob in the definition.  When David updated GH, he changed the name... so the SDK no longer knows what a dial is.  I've changed this in future versions of Firefly so it shouldn't be a problem once I release a new version.  Still... I think it should just be throwing you a warning.  Is it an actual error (where the Code Gen doesn't work at all)?

  • Matt O'Brien

    yeh it seems to be an actually error (red not orange) and no code gets produced..? looking forward to the next release anyhow, will it have leap motion connectivity by any chance? cheers!

  • Andy Payne

    Hmm... I didn't realize it was actually throwing an error (just a warning).  I will try to release a fix very soon.  And yes... I'd like to release the Leap component in the next version (along with some other new components).  I just have to check with the Leap license agreement and make sure I can release the accompanying .dll files that the device uses.  I will look into this.

  • Luke Gehron

    I am having the same problem as Matt with the error: 

    Solution exception:Could not load type 'Grasshopper.Kernel.Special.GH_ControlKnob' from assembly 'Grasshopper, Version=1.0.0.20, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803'.

    Any idea when the fixed version of the component will be out?

  • Andy Payne

    Hi Shahriar,

    Yes, it definitely should be possible.  In fact, the QuadStepper firmata already uses the AccelStepper library which is also a Adafruit library, so I imagine it's just a matter of using the correct methods for the library you intend to import.  Best of luck.

  • Nathan Barnes

    Hey

    Wondering if I can get some assistance. I'm trying to get the stepper and reset pin of the delta stratum printer working. I can run the stepper with the quad stepper sketch and I can run read the reset pin if I load the firmata, but I cant seem to load both at the same time.

    Any ideas how to better go about it?

  • Andy Payne

    Hi Nathan,

    If I understand correctly, what you're saying is you have some motors that you want to control via the Quad Stepper Firmata... and you have some reset buttons (sensors) that you want to read from using the standard Firefly Firmata.  Normally, I would just tell you to add a few lines of code to the Quad Stepper sketch to read data from your buttons and then use the Uno Read component to get that data... but the Quad Stepper sketch already uses some serial commands to get call-backs from the GH sketch.  The easiest solution (for the moment) is to probably just use two different arduinos... one running the Quad Stepper sketch and connected to your motors... and the other running the standard Firmata and connected to your buttons.  You'll likely have to open both ports (to each board), but this is likely the quickest solution...although it isn't very elegant.  I'll try to think of an alternative solution, but it will probably take some re-working of the stepper sketch (which needs to happen anyway).... Just need to find time :)

  • Nathan Barnes

    That is it precisely! I took Jasons workshop at Texfab 5 and I got a little understanding of how to code arduino's, so that is a route. My goal is to move 16 motors all with reset pins for zeroing. I will be tied up with Arduino boards as it is so combining the code would be great.

    Thanks for such an awesome reply Andy

  • Simon Lullin

    Feedback time (sorry for my poor english)

    Firefly is awesome, everything works just great...

    For example the UDP reciever... I stream whatever for a data from my android phone and it works brilliantly. With gHowl just took ages and still not working. Kinect function are perfect. Really, a world with made out of stuff like Friefly would be a world wher I would be happy to live!

    Arduino is working perfectely, in all ways.

    I hope one day we will get full resolution for cameras (kinect, webcam or whatever)

    Keep doing what you are doing, it's brilliant

    Simon

  • Andy Payne

    Thanks Simon!  

  • jorge sainz de aja

    is firefly Compatible with SparkFun RedBoard???????????????????

  • Andy Payne

    Hi Jorge,

    As far as I know, it should be compatible with Firefly... but I haven't run specific tests on it.  However, my understanding of the RedBoard is that it is almost identical to the Uno (and/or Duemilanove) both of which work just fine with Grasshopper.

    HTH,
    Andy

  • jorge sainz de aja

    thanks andy, finally I bought a Arduino starter Kit with UNO, if everithing goes fine, then level up ;)

  • Guido Maciocci

    Hi Andy, 

    I have a particular question related to the Leap Motion controller and its intergration with Rhino Python rather than a question specific to Firefly (sorry, but i don't know where else to post this). 

    I am writing some python scripts based on the leap API to certain things in Rhino using the controller. As proof of concept scripts they are currently working outside of Rhino and I would like to begin integrating them via Rhino Python and Rhinocommon. 

    My problem is that I am unable to get Rhino Python to speak to the controller, in that i keep receiving the following error:

    "The type initializer for 'Leap.LeapPINVOKE' threw an exception"

    Now, as far as I have managed to research, this error is usually related to the referencing of the wrong type of Leap libraries (x86 or x64). 

    I have copied the Leap SDK .dll's into the same folder as the script I am trying to run. I have also included LeapCSharp.NET4.0.DLL, Leap.py and Leap.pyc. 


    The only way i can get the Leap module to load is by adding a clr.AddReferenceToFileAndPath pointing to LeapCSharp.NET4.0.dll assembly and appending the leap\lib forlder to sys.path. 


    The Leap module imports but I get the PINVOKE error regardless of the x86 or x64 libraries I include in the folder. 

    I managed ONCE to import the module and run the leap Sample.py script but I can't remember how I did this. Also, when it ran, it did not print any Leap data to the console and Rhino tended to crash on running the script. 

    Would you or anyone else have any advice to point me in the right direction?

    Thank you so much for your help, 

    Guido

  • Guido Maciocci

    Andy, some progress... 

    I found your question on the Leap dev forums which pretty much outlined the same problem. 

    So now, i moved the relevant .dll's to the same folder as the python script i'm running in Rhino Python. 

    I use clr.addreference to add the LeapCSharp.NET3.5.dll and append the \\leap\\lib folder to sys.path to reference the libraries. 

    Now i can add a controller, and a listener no problem. As soon as I try to poll a frame....rhino crashes!