Processing House Visualizer

During this holidays week we had the idea of creating a lamp, but a different lamp. We want it to have the shape of a little house, so we thought in going to a FabLab to cut some shapes in order to create a house. Because I used a 2D vectorial program I needed to visualize the shapes to be sure that the snaps would feat together, so I invented the challenge of building a custom visualizer, with the possibility to load SVG’s, adjust and rotate them in xyz.

Nothing better than Processing for the task.

Processing House Visualizer

The SVG’s are loaded and displayed on a 3D space, with the help of the sliders it is possible to position each one of the shapes and record a preset in CSV format.

This was a two day work and because I didn’t wan’t to spend the rest of the holidays coding, I left some features that I will add at another time (or maybe not). This is what I would like to add:

  • add a left overlay layer
  • possibility to change colors
  • possibility to extrude SVGs
  • add a chimney
  • make it playable on the browser

The code is available on GitHub

Meanwhile the shapes seemed to be good to go. It was our first time in FabLab Lisboa and it was a great experience. Using the laser cutter was something new to me and I am thinking in more future stuff to build.

The final result was just great, you can see more in A Rosa Cor de Rosa ‘s blog.

Differential wheeled robot simulator

This Processing application is ment to simulate a differential wheeled robot, very used nowadays. This app will be usefull in our Robotics Workshops!

Differential Drive Simulator in Processing

I missed the github class so here it is the good’old zip
Here’s the link to the repo, you’re welcome to contribute ;)

There are still a couple of enhancements on the list:

  • real metrics and scale
  • connect to motor encoders
  • record a path on the virtual world and let the real robot follow it
  • become real simulator of the arduino code used in our robotics workshops

The video is reproduced a lot faster than the program really performs  :p

Some control keys are available:
Differential Drive Simulator in Processing
Differential Drive Simulator in Processing

The overall program is quite simple to use, just pass the mouse over the joystick area to control the bot.
Differential Drive Simulator in Processing

The program basically maps joystick values X and Y to a differential drive system where two motors are used to drive a robot.

There is also a representation of a robot and its path according to the motors differential rotation.

Credits:

The joystick program was based on a program entitled ‘JoystickSimulation’ by: Vince Thompson
http://diyroboticslab.wordpress.com/2009/06/17/joystick-simulation-with-processing/

The robot program was based on a program entitled ‘Kephera Simulator’ by Adam Matic of Croatia
http://gritsgroup.org/robotsimulator.htm

ICU2 – I See You Too

ICU2 is the evolution of the 1st iteration, this new version was totally upgraded, all the pans and tilts systems are from ServoCity, and the software had been re-written from scratch, the face tracker component is on a openFrameworks program wich makes it more performative, and on the Processing side we had a preset based animation program, everytime it looses a face it will load a preset with a diferent animation, this makes it more organic and less repetitive, I will talk more about the software on another post.

This installation is ment to work without the screen, it focuses the attention of the viewer on the ICU, but both of the exhibitions had the screen there as you can see. The knowledge pavilion required the screen to be there because it shows all the control side of the mechanism, and they want to show it to the visitors, and on the FCT Open Day, this exhibition was ment to be visited by new engineering students so we decided to let the screen to be there as well.

ICU2, almost there

ICU2 is going to Pavilhão do Conhecimento in February and we are finishing the hardware and software. Some servos needed to be swapped and I needed to print a suport for a standard servo, this video shows a bit of the printing process and the printed thing assembled.

There will me more updates very soon.

ICU2

I SEE YOU TOO, is the 2nd version of the original ICU

This version gained an upgrade in both hardware and software.

The hardware is mostly based on servocity.com pan and tilt systems.

This is a work in progress, until now what is implemented is Face Detect with the openCV library for Processing.
Next stage is to implement a more robust face and emotions detection and this will run on top of an inverse kinematics algorithm. What we want the most is ICU2 to be a living organism, with a complex behavior tree system.

ICU . 1.01

ICU has been sleeping for a while but was awaken suddenly because I was invited to an exhibition at Flausina, a new born association in Lisbon.

ICU v1.01

Complexity is always a welcome thing around here and the bot was presented with two more servo motors and all the software has been re-written. And because I needed to simulate its movements I coded an application in Processing in a way that I could test all the non-dangerous angles. Inverse kinematics is way to advanced for my taste and I think I can call this a “forward kinematics simulator”. This simulator gives also the possibility to generate individual sine waves for each motor, minimum and maximum range of motion, an interpolator for smoothness and frequency for speed.

ICU v1.01

Unfortunately I don’t have any decent video of photos of the Flausina exhibition, I leave you with a video of the bot in the office with the processing application.

TODO list:

– capability to save presets
– timeline with keyframes, play and stop buttons
– upgrade this servos to more powerful and digital servos
– upgrade all the structure to enhance weight distribution
– create a mask in silicon/rubber and give this bot a crazy new look
– everytime a face is detected it will say something on Twitter and upload the picture in an online gallery

Source code can be downloaded here.

All for now.. Roger, over and out.

ICU v1.01

Photo at Flausina.

RGB Mixer – Processing to Arduino

It has been a long time since I wanted to control the arduino with processing and I tried a lot of libraries, and a lot of processes and I always felt that none of those were suited for what I needed. I needed something simple to implement and easy to understand, and because I am not a programmer, I asked for help and @pauloricca replied to me with a quick, fast and really good solution.

In this example I have connected an RGB LED to the Arduino and on Processing we will have a simple mixer to fade in and out color channels. DON’T DO THIS, LED’s always need to have one resistor in series before. In this case I just wanted to show the serial communication part, and I skipped the resistor part, lazy me! Never do this, otherwise you will kill your leds very fast.

RGB Mixer - Processing to Arduino

On the Arduino side, I defined 3 digital output pins 9, 10, 11, these are PWM capable pins. Than I defined pin 8 as an OUTPUT, and digitallyWrite it to LOW, to be the GROUND pin. On the loop() function we used a switch() function that detects when the sync characters ’R’, ‘G’ and ‘B’ are received. These characters will tell us what value is coming next. The function GetFromSerial() is called everytime we need to read a value from the serial port.

void setup()
{
  // declare the serial comm at 9600 baud rate
  Serial.begin(9600);

  // output pins
  pinMode(9, OUTPUT); // red
  pinMode(10, OUTPUT); // green
  pinMode(11, OUTPUT); // blue

  // another output pin o be used as GROUND 
  pinMode(8, OUTPUT); // ground
  digitalWrite(8, LOW);
}

void loop()
{
  // call the returned value from GetFromSerial() function
  switch(GetFromSerial())
  {
  case 'R':
    analogWrite(9, GetFromSerial());
    break;
  case 'G':
    analogWrite(11, GetFromSerial());
    break;
  case 'B':
    analogWrite(10, GetFromSerial());
    break;

  }
}

// read the serial port
int GetFromSerial()
{
  while (Serial.available()<=0) {
  }
  return Serial.read();
}

On the Processing side, I am using a slider class adapted from anthonymatox.com, and I created 3 instances of this class (I assume you understand the concept of class). The important thing to understand here is the import of the Serial library, and the creation of a Serial object called “port”. On the setup() function I print out the available serial ports and than I defined which one is the Arduino port, on my case is the number 0, note that I am using mac, if you are using PC it should be COM1, COM2 or another COM#. Finally I am passing the values of the slider after I pass the sync character ‘R’, ‘G’, ‘B’.

RGB Mixer - Processing to Arduino

import processing.serial.*;
Serial port;

sliderV sV1, sV2, sV3;

color cor;

void setup() {
  size(500, 500);

  println("Available serial ports:");
  println(Serial.list());

  // check on the output monitor wich port is available on your machine
  port = new Serial(this, Serial.list()[0], 9600);

  // create 3 instances of the sliderV class
  sV1 = new sliderV(100, 100, 90, 255, #FF0000);
  sV2 = new sliderV(200, 100, 90, 255, #03FF00);
  sV3 = new sliderV(300, 100, 90, 255, #009BFF);
}

void draw() {
  background(0);

  sV1.render();
  sV2.render();
  sV3.render();

  // send sync character
  // send the desired value
  port.write('R');
  port.write(sV1.p);
  port.write('G');
  port.write(sV2.p);
  port.write('B');
  port.write(sV3.p);
}

/* 
Slider Class - www.guilhermemartins.net
based on www.anthonymattox.com slider class
*/
class sliderV {
  int x, y, w, h, p;
  color cor;
  boolean slide;

  sliderV (int _x, int _y, int _w, int _h, color _cor) {
    x = _x;
    y = _y;
    w = _w;
    h = _h;
    p = 90;
    cor = _cor;
    slide = true;
  }

  void render() {
    fill(cor);
    rect(x-1, y-4, w, h+10);
    noStroke();
    fill(0);
    rect(x, h-p+y-5, w-2, 13);
    fill(255);
    text(p, x+2, h-p+y+6);

    if (slide==true && mousePressed==true && mouseX<x+w && mouseX>x){
     if ((mouseY<=y+h+150) && (mouseY>=y-150)) {
        p = h-(mouseY-y);
        if (p<0) {
          p=0;
        }
        else if (p>h) {
          p=h;
        }
      }
    }
  }
}

RGB Mixer - Processing to Arduino

RGB Mixer - Processing to Arduino

RGB Mixer - Processing to Arduino

SWARS – See What a Robot Sees

This project is a collection of experiences related to seeing and percieving the world from the point of view of robotic creatures. Robots will send sensor data to the computer and will generate visual and audio landscapes in real time.

The development started during the Audiencia Zero residency in O Espaço do Tempo in Montemor-o-Novo, and will continue until the final exhibition wich will be in July.

This is a colaborative project where many friends are bringing together their skills, until now we have collaborated with:
– Pedro Ângelo with Serial Communication;
Rui Madeira with computer vision technics and advanced maths;
Sérgio Ferreira is a media and interaction guru, always providing precious help and advice;
– Daniel Gomes is working on a MAXMSP interactive sound;
Nuno Morgadinho is developing an online application to remotely control robots.
– André Almeida is a computational guru and a great technology and interaction advisor.

More to come ;)

Sub-projects list:

ICU – I See You

This is the first iteration of this project, and just a quick test for something greater.. hope to have time for it in the future.

Components list:
Motoruino (Arduino compatible board) up and running;
– Wireless camera and video converter sponsored by O Espaço do Tempo;
– Basic pan/tilt system built with PVC;
– GUI written in Processing enabling robot remote control, gives vision feedback and servos orientation.

SOURCE CODE FOR ARDUINO AND PROCESSING