Ostrich-Egg Bot and Processing

One of the main goals I have with using the Ostrich-Egg Bot is to generate art for it via Processing.  I’ve successfully drawn and etched a variety of random svg graphics onto a variety of surfaces.  Next step was to get that art from Processing.

Turned out to be a bit more difficult than I expected:  Processing has no native API call for exporting svg’s (that I can find).  But I finally grasped the fact that it can export pdf files via its pdf library.  And these, when imported into Inkscape, have the exact paths you need to plot.  Here’s a vid of the etcher in action based on a Processing-generated image:

And here’s the source for a simple Processing sketch that makes use of this:  The sketch draws a bunch of overlapping circles, larger on the bottom, smaller on the top, and makes sure there is no seam on the edge:

// eggbot_circles01

import processing.pdf.*;

int eggWidth = 3200;
int eggHeight = 800;
int minSize = 32;
int maxSize = 256;

void setup() {
  size(eggWidth, eggHeight);
  smooth();
  background(255);
  frame.setTitle("Eggbot: Circles01");
  noFill();
  beginRecord(PDF, "processingCircles.pdf");
}

void draw() {
  float[] pos = {
    random(width), random(minSize/2, height-maxSize/2)
  };
  float eSize = map(pos[1], minSize/2, height-maxSize/2, minSize, maxSize);
  ellipse(pos[0], pos[1], eSize, eSize);

  // Tile the circles on the x axis:
  if (pos[0] < eSize/2) {     
    ellipse(pos[0]+width, pos[1], eSize, eSize);   
  }   
  else if (pos[0] > width-eSize/2) {
    ellipse(pos[0]-width, pos[1], eSize, eSize);
  }
}

void keyPressed()
{
  if (key == 's') {
    endRecord();
    exit();
  }
}

When the sketch is going, press ‘s’ to save an image, and quit. It actually raises an exception, but the image saves… not sure what’s going on…

From there it’s a simple matter of importing the pdf into Inkscape. I discovered however that its size was bigger than what was defined in the sketch, so I had to resize it to fit the Ostrich-Egg Bot’s drawing area. Here is a close-up of the etcher in action:

And here’s a shot of the final product:

So, not the most amazing thing, but one step closer…

Ostrich Egg-Bot: Diamond Engraving Tool
Kivy: Cross-platform application development with Python
  • Trackback are closed
  • Comments (2)
    • Curtis
    • February 21st, 2012 6:04pm

    I could not find any contact info on your site so I hope this reaches you. I have had an idea for a while that I really want to try out. Would it be possible to take an ardunio and use it to read the signals from and hdmi cable. My idea would be to use it in say Nazi Zombies on black ops- the arduino would be able to recognize when a zombie was in its sites, and proceed to shoot and kill them. Yes I know this is “CHEATING” the thing is that I’m bored with a lot of the video games and I want to find a way to make them more interesting. As an high school student there is not a whole lot I can do, thanks to copyrights, etc. …So do you think something like this would be possible? If yes, do you have any advice on how to start?

  1. Lol, interesting idea 😉 FYI, if you click the “About AK Eric” link at the top, it has my email.
    Presumably you could intercept and decode an hdmi signal, but now I’m just talking outside my skill zone: You could presumably use something like OpenCV on the imagery to do facial detection, which would in-turn route (via an Arduino) to the controller to trigger the firing mechanism (via an Arduino) when the crosshairs were over it (middle of screen). However, my guess is the horsepower to actually grab the hdmi signal, process the (live, HD) image stream via openCV isn’t something the Arduino could handle, without some kind of dedicated shield. Maybe post on the adafruit or sparkfun forms to see if you can get any info on intercepting the hdmi.

Comment are closed.