Home 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Final Project About Satstep

Interface and Application Programming


assignment:
  • write an application that interfaces with an input and/or output device that you made, comparing as many tool options as possible.

  • This was another week where I was started out a little unsure about what to do. For my final project I would like to be able to locate the position of my robot relative to the 'anchors', but I wasn't sure where to start.

    I realised we could use a plugin for grasshopper called Firefly (v1.0.0.70). I have been wanting to use this plugin for a while and this was a good opportunity to learn. I started off by following this tutorial. This involved setting up a servo to be controlled via a servo all aka arduino --> grasshopper --> arduino. This showed not just how simple this new tool can be, but also how powerful.

    To get this to work you first need Rhino and Grasshopper installed on your computer and then download and install the Firefly plugin for Grasshopper. Next you need to upload the Firefly Firmata to your Arduino board. In the .zip folder downloaded from the FoodforRhino website open up the Firefly_Firmata Arduino sketch.

    There was an error in the code for arduino that I loaded (writetoDAX error). This can be fixed by going here. Alternitivly, using an older version of Arduino IDE (1.0) avoids this error.

    As I had been using a joystick in my projects I decided to see if I could use this to control a point on the screen in Rhino. We had a lecture on the power of Unity - used for making games - and this inspired me to make a maze game out of the program. I first connected the Arduino to the computer using the components seen in the pictures below. From here, I used the Arduino Read component to get the date coming from analog pin 1 and 2 of the Arduino. This showed me the x and y value coming from the component and I used a timer to set the rate at which i recieved the data (1ms).I used the logic from the Input Devices week to interpret the joystick x and y inputs, which can be seen in the next image. To control the movement of the shape onscreen, I created a list of all the possible vector movements and sorted the list using boolean values from the logic to interpret the x and y values. I used a program called anenome which allows you to loop data so I could apply the new joystick data to the new position of the shape each time it looped. I used a small amount of python coding which allowed for start and game over animation when the shape intersected a curve.

    Please click the image below to view the image in detail

    The python code can be found in the relevant component in the grasshopper file. A good resource for using Python in Rhino is this page where a list of all the commands are and examples on how to use them.

    If anyone is good with coding in grasshopper please see this Grasshopper thread.
    EDIT : I found a bug in the code.

    The arduino is simple to setup. Just connect a joystick as in the image below and then hook the uno up to your computer as you would normally with the USB. This will provide power and also the joystick position information.

    hello_01
    As a group assignment we, compared different interface and application programming tools.
    Download the files for this week here

    Home