Social RoboticsPosts RSS Comments RSS

Accomplishments & Next Steps

Here is a list of some of the things I accomplished this semester:

  • Optimized social robot(ics) code
  • Displayed conformity levels (to realize the change of the pattern)
  • Learned about neural-nets
  • MLK Processing

The next steps for Spring 2010 and beyond are:

  • Finish MLK program
  • Re-do iPhone app in ActionScript3 (Flash)
  • Implement neural net in social robot(ics) program
  • Presentation/workshop on Neural Nets
  • Finish hacking Furby, add AI to it
  • Next greatest adventure…

No responses yet

Displaying Twitter Updates in Processing

In January, I’m going to be helping out the annual Martin Luther King Day events. A group of students and two faculty advisors met at the very beginning of Fall semester to start discussing ideas for this special day. We wanted to make it different from all the other years, more exciting interesting, and more ideas being communicated. It sounds like a fantastic opportunity to use the popular vibe of Twitter to our advantage! Without revealing too much of the magic that will be happening on the day, the essential idea behind this project is that tweets will be posted from a tweet-station on campus, and then displayed on a projected screen.

Getting twitter updates to be displayed in Processing would be able to help out on many other people’s projects too, so I created a quick and simple example on how to do so! The final product will look like this:

TwitterDisplayScreenshot2 TwitterDisplayScreenshot3 TwitterDisplayScreenshot1

Let’s get stated- Go ahead and open Processing, creating a new sketch, and saving it.

TwitterDisplayScreenshot4

The first essential item that we need is the Twitter4J library. It can be downloaded here.

Place the .jar file into a folder called ‘code’, then place that into the sketch’s folder.

TwitterDisplayScreenshot5

The next step is the code, we’ll start out with the globals first.

String username = " "; // Add your username here
String password = " "; // Add your password here

java.util.List statuses = null; // Setting up the statuses list

Twitter twitter = new Twitter(username, password); // Connecting to Twitter

int numberOfTweets = 10; // Number of status updates to get
String[] theTweets = new String[numberOfTweets+1]; // Storage area for the status updates
int tweetNumber = 0; // The status index that we will display (0 for most recent)

String theAuthour; // Name of the account
PFont font;

Be sure to insert your username and password between the ” and ” !

We will have two functions in this code… one to get the name of the Twitter account (not the username, but the actual ‘name’), and another to get the updates. First, the name of the account:

void getAuthour() {

  // Try-catch to ensure nothing horrible happens
  try {
   statuses = twitter.getUserTimeline();
  } catch(TwitterException e) {
    println(e.getStatusCode());
  }
 
  // Get the most recent status update
  Status status = (Status)statuses.get(0);
  // Get the name of the authour
  theAuthour = status.getUser().getName();
 
}

All it does is it gets the most recent status update, and from there it can get the name of the account. Next, the updates:

void getStatuses() {

  // Try-catch to ensure nothing horrible happens
  try {
   statuses = twitter.getUserTimeline();
  } catch(TwitterException e) {
    println(e.getStatusCode());
  }
 
  // Get the 10 most recent status updates
  for(int i=0; i<numberOfTweets; i++) {
   Status status = (Status)statuses.get(i);
   theTweets[i] = status.getText();
  }
 
}

It goes and fetches the 10 most recent status updates, and stores them in theTweets[] for easy access.

Now that the basics are done… we can go and set up the actual fun stuff of the Processing sketch! :)

void setup() {
 
  size(1525, 200);
  background(0);
  smooth();
 
  font = loadFont("LovedbytheKing-48.vlw");
 
  getAuthour();
  getStatuses();
 
}

When we’re loading the font, be sure to make the font. There’s a description on how to make fonts here.

Now we get to display the info:

void draw() {
 
  background(0);
 
  // Displaying the name of the account
  fill(255);
  textFont(font, 36);
  text(theAuthour + ": ", 100, 70);
 
  // Displaying the status update
  fill(255);
  textFont(font, 36);
  text(theTweets[tweetNumber], 50, 120);
 
}

That’s it! Test it out, hopefully it should run!

There are many modifications that can be made to this code… here’s some ideas:

  • Change the colours
  • Choose different tweets to display
  • Change the tweet after a certain amount of time
  • Split the string to format it
  • … use your imagination! :)

Here is the archived sketch available for download:

download

Happy tweeting! Feel free to comment if there are any questions…

One of the problems that may occur is running out of API calls. For normal Twitter users, there is a limit of 120 API calls per hour. To read more about this, be sure to visit this page.

Useful links:

No responses yet

November Summary

November is the last step in this semester-long project course. In trying to seek how to get the pattern in the program back, I had to learn about what neural nets actually are, simulated annealing, and weighted-majority algorithms. With help from my CS advisor (Tino), he explained and exemplified each of the three concepts.

I started to sketch what one of my neural nets for the program might look like on paper. It turns out that there would be upwards of 10 hidden layers. The next step was to figure out what exactly I would want the threshold, or sigmoid function, to be. I am currently still wondering about how to go by this…

By mid-November, the focus shifted to another project, the MLK interactive Twitter display project. In order to make Martin Luther King Day 2010 at Clarkson different from all the other years, a group of volunteers thought it would be cool to have a performance, as well as an interactive Twitter display to communicate ideas in a modern and precise fashion. With the limit of 140 characters per tweet, it would be bound to produce some thought provoking ideas.

Basically, there will be 5 MLK day twitter accounts that will each represent a theme. Tweets posted from these accounts will be displayed and visualized through an interactive Processing application. This will be happening during the day as well as the performance.

During the performance (and dinner), there will be laptops available for tweeting. The Processing application will be displayed on a projected screen for everyone to see, and tweets would be refreshed every 30 seconds or so.

The part that I conquered this semester was easily the most difficult one, connecting to Twitter and displaying the Tweets! This was done with use of the Twitter4J library. I’ll probably open-source the code once I’m near completion,so that other universities and institutions can participate next year!

During the same time period, Pat Wilbur brought a Furby up to the labs, which we are planning to hack together. I spent some time researching the insides of a Furby, as well as trying to get the motor to work. The way a Furby operates is by the witty concatenation of gears. There is only one motor, so gear combinations drive the eyes, ears, and mouth. However, the motor seems to not work with the standard +5V. It doesn’t even move!

The semester closes out with thoughts of how to make a Furby work! With that note, November is complete!

No responses yet

Discovering a Missing Pattern

There was no real defined method to my madness of changing, testing and debugging my social robotics program, but I did take screenshots along the way. The original purpose was to create visualizations of different variables within the socialization process. The first of which was going to be the conformity levels, or the degree of how much the child robot wishes to mimic the parent robot.

The problem that was discovered is that from iterations 0-1000, there is a pattern where the parent conformity level moves from quadrant 4 to other quadrants. However, when the program was expanded to go from 0-infinity iterations, the pattern was essentially lost. This is important since the parent conformity level determines how much the child robot decides to mimic the parent robot.

Below is a visual walk through time of this process, with annotations and descriptions!



MP151_01

This is a screenshot of the updated control GUI of the social robotics program. There are no longer many sliders and buttons, which makes the program run faster and longer!

  1. Iterations can now go from 0-infinity instead of 0-1000
  2. Buttons include stepping 1 iteration, automatically iterating, time delay (for automatic iterations), and log data


MP151_02

This is a screenshot of when the visualization program first worked! Woohoo!
Bubble size is the total conformity level, X position of the bubble is parent conformity level, Y position of the bubble is action conformity level

  1. Not many iterations
  2. The transperency of the bubbles will have to be lowered in order to see more changes over time


MP151_03

This is a screenshot of when the visualization program was modified a tad to see the data over many iterations

  1. Bubbles are transperent and red, so that many layers can be seen
  2. Iterating for a numerous amount allows us to see where most of the data lands
  3. Labels are the number of averages taken, where averages are taken every 5 iterations… this allows us to see where most of the averages are


MP151_04

Showing us more iterations

  1. Many more iterations
  2. Distribution of bubbles seems to be always in the same area
  3. Distribution of the averages also seems to be in the same area


MP151_05

Modified the transparency of the visualization program

  1. Distribution still is in the same place, all the time! (This is not good)
  2. Many iterations…


MP151_06

I wanted to add more colour to the visualization, just checking to see what it would look like

  1. 499137 iterations
  2. Bubbles are coloured, still located in the same quandrant
  3. Average labels still in the same place


MP151_07

I modified the algorithm that changes the X position (parent conformity level) of the bubble in attempt to limit where the bubbles venture. In essence, it did that, but not exactly what we were looking for…

  1. We can at least see an average that made it out of quandrant 4, but the rest seem to be around the same area.
  2. Many iterations – 1384197
  3. X position of the bubbles is more clumped together


MP151_08

The visualization program was modified to remove the random colours (sort of distracting after a while), but also draw lines from the bubbles

  1. Lines are drawn from bubble to bubble
  2. Not many iterations into the program…
  3. …but the x positions seem to be wandering! (this is good)


MP151_09

Removed the line layers and averages just to see the general location…

  1. X values are all in quandrant 4 (this is not good)
  2. Not many iterations, we’ll leave it to iterate for a bit


MP151_10

Instead of labels being the averages, red dots are. This way we can clearly see the distribution…

  1. X values of the bubbles do not appear to be widely dispersed
  2. Many iterations – 394039
  3. Red dots show that X values are all in the 4th quandrant


MP151_11

An age component was added– whereby the older the robot gets, the more converged the x-values will be (in theory)

  1. X values seem to converge (too much)
  2. Evaluated many iterations – 182028


MP151_12

As a final hope, I did a time trial of when the robot would go through its different age categories

  1. The X values are scattered for a little while at the beginning — but not scattered enough
  2. Time trial would last 2 hours, 5 minutes.
  3. Just a few iterations in! (496)


MP151_13

  1. X values are all around the same quandrant, that’s not what we were aiming for!
  2. 2 hours 5 minutes of time is up — robot went through all its age categories
  3. 84752 iterations


After this time trial was when I started to wonder if there would be any other methods to overcome this. After looking into it, neural nets will be the best answer! The only problem is that there are several inputs that make up the parent conformity level, and the way that I would neural net everything would entail that there will be about 10 hidden layers (yikes!!).

No responses yet

October Summary

October was an awesome month for progress on the project!

Though, at first it was really difficult. I tried three different ways of setting up a way to display circles.

The first way would be to use the control program, and display the circles in a new window. That didn’t work, because it was too laggy.

The second way would be to use the control program, but use the main window to draw the circles, and another window to display the control buttons. That also didn’t work because it was too laggy.

So I concluded that using a separate program, and have a file written and read continuously to transfer the data, would be the best route.

I used XML for this, and it works pretty good. From what I’ve played with, the control program needs to iterate every 100ms in order for the drawing program to not skip/miss some of the data.

Getting the XML code and the drawing code took a few weeks. I started off with the parent, action, and total conformity levels.

After it started to work the way I wanted it to, I let it iterate for a while to see what would happen. Originally, over 1000 iterations, one would be able to see a pattern where the conformity levels sort of ‘jump’ around, but in a pattern.

Since the program can now iterate forever, the pattern was pretty much lost! (That’s not good!!!)

I started to embark on a quest to get the pattern back… which leads me to the end of October!

That’s all for now!

No responses yet

September Summary

In September everything was a whirlwind! I knew what I wanted to do… but somehow couldn’t put it into code.

The program from the summer was not optimized, it crashed after 1000 iterations. 1000 iterations just is not enough for what I want to do, since I want the robots to evolve and be socialized.

I worked on optimizing it, and by the time the end of September rolled around, it worked! I let the program iterate for a little more than 1 week, and it was over 8.93 million iterations. Basically, it will no longer crash.

Also, during September, I worked on making an iPhone app game, sort of like Simon but using the accelerometer.

I was also momentarily entertained for a few days with the task of creating a physics-style graph representation to try to solve a problem with Jacob… One of the problems with trying to show a graph using a physics engine is figuring out how all the particles are charged.
Since the first ‘level’ of nodes would effect the second ‘level’, then it gets all compounded and sort of hard to calculate. I still think about a way to overcome this problem, though.

That’s it for September!

No responses yet

Wello Horld!

Greetings everyone!

For COSI for credit this semester I’m continuing working on a program that I created during the summer that is aimed at creating a social robot by using an artificial society.

My main goal is to set up a way to visualize the variables over time (live), using Processing.

Specifically, the variables that I want to visualize are…
- Parent & Action Conformity Levels
- Favourable Actions
- Sent & Received Actions
- Self View
- Actual View (of parents)

The best way that I have thought of thus far to visualize the data would be to use circles, and use colour, position, and size to represent something.

The home for this project is COSI-02! I’ll be posting more about the project status as I go along.

No responses yet