Friday Night Robotics – CMUcam2

Friday, February 5th, 2010

The CMUcam2 is a really cool camera for robotics made by CMU. The version that we’re using for this Matlab project (that I mentioned before) was actually used in FIRST competitions a long time ago.

CMUcam2

The first problem we faced with this was that it requires 7.2V, in a range of 5.2V – 8.6V. What gives 7.2V?! Crazy! If you take 6 AA rechargeable batteries together, they can add up to be 7.2V exactly. (1.2V * 6 = 7.2V). Battery packs naturally don’t come in sixes, so I ended up making one:

CMUcam2

This was actually my first time making a series battery pack. It’s in series because we want to use Ohm’s law, where the voltage is added together. Thanks to the people in the Fat Man and Circuit Girl IRC chat room, they helped me figure it out. Here’s a drawing that I made incase others too need help with this someday. Basically, connect the positive to negative over and over again! ^_^

Series Batteries

The next step is to get the camera working. This is by far the hardest part. There’s numerous methods of communicating to the CMUcam2, all of which use RS232. Arduinos also use RS232, so at least we’re in known territory.

The CMUcam2 has a serial port, a TX/RX/Gnd line, and a TTL port. On my Mac, I tried the serial port, it didn’t work. I tried the TX/RX/Gnd line into an Arduino, it also didn’t work. I also tried to use the TTL, but it also didn’t work. I’m not really sure why nothing works on my Mac, especially since the camera works with a PC just fine.

This is where I’m at right now. No idea what to do to make the CMUcam2 work on my Mac. Do any of my blog readers have any ideas? :)

WOOT~~~ TWIST ENDING!! READ ON!!!

I was thinking that it would be really lame to end the blog post without some sort of screenshot of Matlab or something. So I gave the CMUcam2 another shot… I made it work!!! IT WORKS!!! IT WORKS ON MY MAC!!!!!! =) :D The code that I was using to test the camera is from Instructables.

Matlab CMUcam2

So, now that it works we have things to do… like figuring out how we can get the RGB data for each pixel, and then saving that to an image. After its in an image, we can do some form of edge detection. Matlab probably has a toolbox for that. :) More fun later!


Google thinks that you might like this:




Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

January Happenings

Monday, February 1st, 2010

What has happened in January? Tons of stuff!

irobot-create

For Matlab this semester, it’s an independent project. I’m working with a friend to implement an adaptive online SLAM algorithm for an iRobot with a CMU cam and ultrasonic sensor. We want it to be able to reach a goal location even if objects are placed in front of it. I’ll be blogging more about this later, though. ;)


Screen shot 2010-02-01 at 8.43.36 AM

The Social Robotics software that I worked on over the summer is now released under the GPLv3 license. I encourage everyone to check out the Social Robotics page if you want to learn more about the project! I am still in the process of creating the documentation and commenting for the code. As soon as it is complete, I will make a blog post. =)

Luckily for me, I took time to make detailed daily and weekly summaries. This will help a lot, plus it’s always neat to look back and see what the difficult parts were.


Did you hear/watch this year’s FIRST game animation? The game is about soccer! Team 229 has many useful links on their webpage that can fill you in.

This year I’m helping out with the website, maybe I will get to help out with some AI coding for the autonomous mode later on. It all depends on what the high school students think up!


I ended up adding a class two hours before the first lecture- Applied Statistics I. I don’t enjoy statistics very much since I have horrible memories of it from Math 536. But, once I gained access to view the class on the gradebook software, I immediately noticed two words:

SecondLife ……………… Project

Is this for real!?!?! It turned out that it is, and it is awesome! A friend and I are working on trying to figure out if there is a correlation between the virtual economy and the real economy. We’re going to focus mainly on North & South America, Europe and Australia.

Here’s a screenshot of my professor in SecondLife!

secondlife-statistics


I’m taking a class on Computer Graphics. It’s really neat– I’m learning OpenGL!

OpenGL is something that I’ve wanted to learn for a while now. It’s actually quite simple when you’re given a template to work with!

Screen shot 2010-02-01 at 8.35.03 AM

Above is the first homework assignment! We were given a lot of time with it, which allowed me to play around with the code. I have to make the colours more plain before I hand it in, though. :(

I have no idea what I want to make with OpenGL at the moment. Maybe a moving robot? I definitely want to make some sort of game, though. (That way I can sell it on the iPhone App Store!)


That’s all for now. I’ll be blogging more about the Matlab project, since I think it’s going to be a hit!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Friday Night Robotics – MLK Day Preparations

Saturday, January 16th, 2010

Warning: This FNR does not contain any robots at all, but it’s still REALLY amazing!

A while ago I put my name on a list that wanted to help out with MLK day, 2010. I originally thought I would be doing a website, not really thinking about the intractability portion. When the Fall 2009 semester began, the group of us met, and ideas were tossed around. MLK Day in 2010 had to be different.

We came up with the idea of having a Twitter aspect of the performance. People would be able to tweet from laptops and then see it displayed on the screen! We are going to be using 5 laptops throughout the dinner, each with a different theme:

  • Inspiration
  • Dedication
  • Culture
  • Leadership
  • Performance

When a person goes to send a tweet, this is what the webpage looks like:

MLK-inspiration-page

It’s very user-friendly in the way that… once a person reads the theme and the question, they’ll understand to type in the box and press the button. I designed it to be simple, hopefully people will think it is simple too.

Being projected onto the display will be the Processing application that I’ve spent the better part of 4 months coding! :O It displays three twitter accounts at a time, and they are refreshed every 10 seconds and cycled upwards. The background changes very slowly over time as well, it’s almost not noticeable. Here is a screenshot:

MLK-processing-display

The best part about this is… it will be open source… in about 1 month. I just need to take some time to document it before I release it to the wild. Since it wasn’t a project for grades, I didn’t comment it (I find comments get in the way), so I will have to do that. Hopefully people will pick it up and improve it, since there’s some parts in the code that it’s obvious that I had no idea what I was doing. :P

So that is the MLK Twitter portion of the dinner. I’m really amazed how well this is all going to work together, it will be a very special moment for sure. I had the privilege of seeing the performance being rehearsed, it is extraordinary! If it is going to be recorded, I will be sure to post a video.

I hope everyone has a wonderful MLK day! =)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Arduino to Matlab – Read in sensor data!

Friday, January 15th, 2010

Matlab is by far the best software I have ever seen when it comes to plotting data and showing it in a visual format. I figured it would be awesome if I could get Arduino and Matlab to work together!

Here’s the code that I came up with that works reasonably fast. It doesn’t wait for the buffer to be filled to then store it to a variable. Here, it is asynchronous communication. ^_^

This is a basic screenshot of what you will get, minus the green stars.

matlabscreenshot

Here is the code. Let me know if you use, it would be neat to see what everyone would come up with!
*Note: The code highlighting for Matlab was buggy, so the below is using C code highlighting. Once you paste it into Matlab, it will be fine.

  1. % Basic Arduino and Matlab
  2. % Communication with an external hardware device
  3. % ———————————————-
  4. %
  5. % Erin Kennedy
  6. % Jan. 18, 2010
  7. %
  8.  
  9.  
  10. clear all; clc; close all;
  11.  
  12.  
  13. % Try-catch is to prevent Matlab from crashing when the program is finished
  14. try
  15.  
  16.    
  17. % Initialize serial port
  18. s = serial(‘/dev/tty.usbserial-A4001lVG’);
  19. %set(s, ‘ Terminator’, ‘LF’); % Default terminator is \n
  20. set(s,‘BaudRate’, 9600);
  21. set(s,‘DataBits’, 8);
  22. set(s,‘StopBits’, 1);
  23. fopen(s);
  24. s.ReadAsyncMode = ‘continuous’;
  25.  
  26.  
  27. % Various variables
  28. numberOfDatas = 50;
  29. data = zeros(1, numberOfDatas);
  30. i = 1;
  31.  
  32.  
  33. % Main graph figure
  34. figure(1);
  35. hold on;
  36. title(‘Incomming Data from External Device’);
  37. xlabel(‘Data Number’);
  38. ylabel(‘Analog Voltage (0-1023)’);
  39.  
  40.  
  41. % Start asynchronous reading
  42. readasync(s);
  43.  
  44.  
  45. while(i<=numberOfDatas)  
  46.    
  47.    
  48.     % Get the data from the serial object
  49.     data(i) = fscanf(s, ‘%d’);
  50.    
  51.     % Plot the data
  52.     figure(1);
  53.     plot(i, data(i), ‘m*’);
  54.    
  55.     % Ensure there are always 10 tick marks on the graph
  56.     if(i>10)
  57.        xlim([i-10 i]);
  58.        set(gca,‘xtick’,[i-10 i-9 i-8 i-7 i-6 i-5 i-4 i-3 i-2 i-1 i])
  59.     end
  60.    
  61.     % Draw and flush
  62.     drawnow;
  63.    
  64.     %Increment the counter
  65.     i=i+1;
  66.    
  67.    
  68. end
  69.  
  70.  
  71. % Give the external device some time…
  72. pause(3);
  73.  
  74. return;
  75.  
  76. catch
  77.  
  78. % Some of these crash the program it depends. The serial port is left
  79. % open, which is not good.                                              
  80. stopasync(s);
  81. fclose(s); % bad
  82. %delete(s);
  83. %clear s;
  84.  
  85. fprintf(1, ‘Sorry, you"re going to have to close out of Matlab to close the serial port\n);
  86.  
  87. return
  88.  
  89. end

The code for the Arduino is this:

  1. //
  2. // BubbleBoy -> Matlab
  3. // ——————-
  4. //
  5. // Read LDR data, print them to Serial (where Matlab will receive them)
  6. //
  7.  
  8. int LDRpin = 0;
  9.  
  10. void setup() {
  11.  
  12.   Serial.begin(9600);
  13.   pinMode(LDRpin, INPUT);
  14.  
  15. }
  16.  
  17. void loop() {
  18.  
  19.  int photocellReading = analogRead(LDRpin);
  20.  
  21.  Serial.println(photocellReading, DEC);
  22.  delay(200);
  23.  
  24. }

Enjoy, happy matlabbing!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

MANOI in 2010 and beyond +

Thursday, January 7th, 2010

2009 was a pretty good year in terms of getting MANOI to do stuff! I figured out how to make MANOI write, walk, and dance around and be on TV. I have a pretty good template for programming MANOI too, and it seems quite rugged. 2009 also gave me the chance to learn the limitations of this robot, that being the knee servos.

I was always under the impression that “great” humanoid robots can walk, run, and kick very well, basically being the best robots in RoboCup. MANOI will never be a RoboCup robot, since the knees are too weak and the stronger knees cost $300 a piece. I realized this a few months ago, admitting it is sort of harder ;)

But, MANOI can be an interactive robot and do funny things… so in 2010, I’m going to focus more on the appearance and movements of MANOI. I want it so that the person interacting with MANOI can become attached to it, feeling that it exhibits an actual persona, instead of a programmed robot. I really feel that this was evident in MANOI’s Holiday Xtravaganza, but it still needs some improvements.

The first few steps would be to decorate MANOI’s head with two ears and two eyebrows. I’m considering antennae instead of eyebrows, because I don’t really want MANOI to come off as an uncanny human, but rather a friendly alien. I already have the two servos needed for the ears, so I’ll probably do those first. :D

Getting various sensor data will also be key in making MANOI more sociable. Currently there are three sensors on MANOI- the IR sensor, the gyro, and a LDR which is used for shaking hands. I’m thinking that those sensors alone are going to useful enough, for the time being.

It might be cool to have MANOI communicate back to a Mac so that the computer could produce audible results (like my Robbie the Robot science fair project).

There’s lots of possibilities out there, so this is pretty much a blog post of my scrambled thoughts. :P 2010 will be interesting, for sure!





Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon