Posts Tagged ‘data’

Cloud Robotics Hackathon!

Posted by Erin, the RobotGrrl on Tuesday, March 6th, 2012

I was at the Cloud Robotics Hackathon this weekend in Montreal and it was a BLAST! There were tons of teams participating, learning about robotics, programming with Arduino, and there was a MakerBot, some Naos, and a Darwin-OP there! Holy macaroni!

My favourite part at the end was listening to the experiences that people had programming their robot. There were lots of new people to robotics, so it was great.

I worked with Marek over the weekend! He is a super web dev guru, and was also on the Edubotics team at Startup Weekend Montreal. We came up with a pretty crazy project, under the team name of TEAM LIGHTNINGBOTS, because lightning comes from the cloud!

We ended up winning the Montreal part of the Cloud Robotics hackathon! Here is our project’s video!

As a quick summary, we made a network of cheerleading robots for an educational math game that can post the scores on MyRobots, then display them on a robotic scoreboard. Let’s take a look at this in more detail!

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

Here is the basic setup. There is the math game on the iPad. This app is actually a web app with a very thin native client layer to send data to the robot. It works by sending HTTP callbacks, which the app parses, then sends a packet through the Redpark Serial Cable, which Learning Pet (blue RoboBrrd) receives, parses, then does an action. You can input two digit numbers into the app because there is a specially-tuned delay to do so. You get an unlimited number of tries for answering, and no hints, since this is a basic version of it (proof of concept). The green dots below are showing the number of questions completed and needed to level up. The game repeats once you level up. The game is functional in any modern web browser, so you can check it out HERE! Marek was the one who coded this, and it was developed beforehand at Startup Weekend, so nothing new here.

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

Now for the new part: when Learning Pet (blue RoboBrrd) receives the data from the app, it also broadcasts the message out through its Xbee to the other two robots. We use the XBee Network Protocol for this, developed by Kris Kortright, but we use my uno-compatible fork of it.

Both Impy (orange RoboBrrd) and MANOI receive this data through their XBees, and are able to act out the actions as well. When you get the answer right, they do a little action of encouragement (MANOI swings its arms, RoboBrrds flap their wings, and Impy changes its eyes green too). When you get the answer wrong, they shake their heads- MANOI looks really scary doing this so you don’t want to get the answer wrong. When you level up, they all do a crazy dance celebration.

You can grab their code on Github here!

Now for the next new part: when Impy (orange RoboBrrd) receives the data from the mesh, it communicates with the computer which is running a Processing application. In the application, it creates a tally of the questions answered, and the number correct, the enthusiasm value (which is just how drastic changes in RoboBrrd’s sensors were), and the “brain power”.

The brain power is determined by the function:
(correct/tries)+enthusiasm+(100*levelnumber)

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

This data is then uploaded to MyRobots every 15 seconds and then cleared out for the next upload batch.

One of the tricky parts was figuring out how to optimize the sending and receiving of packets on Impy (orange RoboBrrds) end. It turned out that we had to listen before we send, or something like that, just to make it work a bit more reliably.

You can grab the code for the Processing sketch on Github here.

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

Here’s the next new part: To have the results of the game displayed on a live scoreboard, we used the DFRobot RobotShop rover as a scoreboard. I attached it to the bottom of a soapdish, which gave the treads enough clearance, and some popsicle sticks for support. Marek added the numbers and faceplate to it, and coded it up in Python. The code pulled the live “correct” number score from MyRobots and then called the Arduino to update the motors accordingly. It was pretty sweet!

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

Cloud Robotics Hackathon - TEAM LIGHTNINGBOTS!

All in all, the whole system worked great. It’s truly the ultimate social robot network, because we were able to combine so many robots together!

There was a lot of stuff that we developed that we didn’t use or mention though. For instance, Marek created this web nodejs application that can show the same webpage to all clients, and also send tcp messages to everyone connected. CHECK IT OUT HERE! We were going to use this originally as a sort of orchestra or central command console for the robots. He also made a Twitter analyzing program that looks for happy faces or sad faces in the streaming Twitter firehose. The data is being plotted on his MyRobots page for it, which is really cool.

On the first day I worked on getting Learning Pet (blue RoboBrrd) going with the ADK. For some reason it would work fine, I would get up for a break, and then not work. So that night was the turning point in the hackathon when we went with the idea we have now.

The idea we implemented is pretty cool though, since it both sends data to MyRobots and it uses it. We also are using basically 3 clouds in the 1 project, being:
1. The math game web app
2. The local mesh network
3. MyRobots

All in all, it was a blast! Huge thanks to Marek for his web skills!

I’m definitely looking forward to volunteering at this hackathon next year. Thanks to the organizers for making such an awesome event. SEE YOU IN THE CLOUD!

Posted in: Fun, Programming, Projects, RoboBrrd (thx Adafruit!), Robot, WyoLum Progress.

Reading Data from MyRobots / ThingSpeak

Posted by Erin, the RobotGrrl on Friday, March 2nd, 2012

Last post I showed some code and a guide on how to connect your robot to MyRobots/ThingSpeak! Now let’s look at how we can read the data from MyRobots. This part will be pretty cool, because you can read other robots data, and have your robot react to it!

I haven’t written up a MAKE Project guide for this yet, but wanted to show it anyway. Here you can get the SimpleThingSpeak_Parse code on Github!

We will be using the JSON Processing library to get and parse the data.

There are three main parts to this code:
1. Reading the entire feed
2. Specific feed field
3. Last entry in the robot feed

Here’s what the basic field structure looks like. The channel data is the info about your robot, and the feeds is an array, with each element being the specific datapoint.

channel
- created_at (str)
- description (str)
- field1…8 (str)
- id (int)
- last_entry_id (int)
- name (str)
- updated_at (str)

feeds
- (your entry int here)
– created_at (str)
– entry_id (int)
– field1…8 (str)

So for the accessing entire feed, you can use these functions:

  1. Object getChannelValue(String valueName)
  2. Object getFeedValue(String valueName, int feedEntry)
  3. int getFeedLength()

Here’s a very basic example of how to use these functions:

  1. // example, get random stuffs, print it out
  2.   String robotName = (String)getChannelValue("name");
  3.   String creationDate = (String)getChannelValue("created_at");
  4.   int lastEntry = ((Integer)getChannelValue("last_entry_id")).intValue();
  5.   int feedsNum = getFeedLength();
  6.   String lastField1 = (String)getFeedValue("field1", (feedsNum-1));
  7.  
  8.   println("\nHey! Did you know that " + robotName + ", aka coolest robot in the world was created on MyRobots on " + creationDate + "?");
  9.   println("It’s last field1 value that it sent (entry #" + lastEntry + " by the way) was: " + lastField1 + ". Cool!\n");

For the field feed, you can use this function:

  1. Object getSpecificFeedValue(String fieldName, String valueName, int feedEntry)

For the last entry, you can use this function:

  1. Object getLastEntryValue(String valueName)

And that is it! You can use the data from the functions and connect it up to your robot. :) Try it out, get the code from Github!

Posted in: Fun, Programming, Projects.

Connecting your Robot to MyRobots / ThingSpeak

Posted by Erin, the RobotGrrl on Wednesday, February 29th, 2012

Send your robot into the cloud with a simple Processing sketch to upload its data to MyRobots or ThingSpeak!

robobrrd-cloud

Here is a guide to get you started with sending your robot’s data to MyRobots or ThingSpeak! You can look at it on MAKE: Projects!


Connecting your Robot to MyRobots / ThingSpeak

Don’t forget to star/+1/tweet/comment the guide! ;)

If you just want to jump to the code, here is the bare-bones Processing sketch: SimpleThingSpeak!

You can also get ThingSpeak_Firmata (Processing) example, and the LearningPet_AnalogFirmata_MyRobots example on Github! :)

Be sure to give RoboBrrd some +1′s and friendship requests on MyRobots here!

This guide is a part of the adventure to answer the question “How many MAKE: Projects will it take to get to Maker Faire?”. If you really enjoyed this guide, you can donate towards my Maker Faire travel expenses :D

Posted in: Fun, MAKE: Projects, RoboBrrd (thx Adafruit!).

S7GraphView Zoom & Pan Code

Posted by Erin, the RobotGrrl on Wednesday, October 20th, 2010

Here is the code for the S7GraphView Zoom & Pan modification that I mentioned a while ago for the s7graphview iOS framework.

DemoS7GraphView-ZoomPan.zip

If anyone out there improves it more, please leave a comment! :D

Posted in: iPhone, Projects.

CMUcam2 in Matlab! & Project updates!

Posted by Erin, the RobotGrrl on Wednesday, February 24th, 2010

On Sunday, a breakthrough was made with regards to getting the CMUcam2 to send a frame back to Matlab! Amazing! It works!

Check out the screenshots:

Matlab & CMUcam2

(something bright was being shone onto the camera)

Matlab & CMUcam2

(lens cap on (yes they make lens caps that small))

It’s quite noticeable that the resolution is very small. In fact, it’s only about 10 pixels in size!

I started off small so that we could have something that works, then go from there. :D It’s only sending the green channel too, which helps improve the latency.

The way it works now is that it asks for a few hundred bytes of data. From there, we search through the array to find a 1, or the start of the frame, until a 3, or the end of the frame. This is stored into a new variable so that we can search through it (again!) and plot the data.

Plotting the data needs some improvement. Not too sure how to handle this yet– should I make a Processing app that will be able to save the image as a .png? Or can Matlab write images too? Hmm!

Post a comment if you want me to post the code, I just don’t want to post something that’s incomplete and will essentially confuse everyone. :)

Other projects statii:

PR2 Proposal

Out of the 120 Letters of Intent that WillowGarage received for the PR2 Beta program, one of them is one from Clarkson University!

There are ten robots that are going to be given away. Coincidentally, the research teams that win will be notified on March 26th — that’s the date of the Boston FIRST regional (which Team 229 is attending and is going to ROCK THE ROBOT HOUSE)! :D

We’re giving it our best shot, and it’s looking really cool! If you see me around, ask me about it! :D

This whole process has been super exciting. Our proposal is being wrapped up, though it’s only due March 1st (that’s in six days, we still have plenty of time). My two sections are pretty much complete except for some stuff. I’ll be blogging about it on March 1st at 8:00PM, so keep an eye out!


Sociable Robotics

The Socializing a Social Robot with an Artificial Society SURE abstract from the summer has been added to the Honors Summer Research 2009 page! Finally! ^_^

Also, I refined my paper with logic that can easily be followed now, and included Zoomify graphs of the results. This makes it easy for readers to scan and interpret the graphs themselves. Plus, Zoomify graphs are always fun.

As for the code… I still have to get on to documenting it. It’s a lot of work, so I’m just getting through it step by step. Lesson learned: although comments are distracting when you’re working on the code, it’s horrible to go back and then spend time to comment it. Always comment. No exceptions!


SecondLife Statistics Project

We finally parsed through the data and found something really striking. When the economic downturn in real life appeared, the usage hours on SecondLife rose, and kept on rising for a few months! The virtual economy was booming. It’s almost like as if people were tired of the real life, and wanted the easy success of the virtual world.

Though, there was eventually a decrease in the usage hours on SecondLife. This leads us to wonder if…
1) Is there a lag between RL and SL?
2) Did people notice that there weren’t as many opportunities on SL as when they first joined?

It’s really cool to think about this sort of stuff. It makes you wonder what Oreo sales have been like throughout this modern recession. I would love to study Oreo sales, I think they would be really representative of the economic situations. Either that, or Oreo sales always remain constant. :P


Team 229

This build season I helped out with the website a lot. We were coming from nothing, and now we have a beautiful source of information, all collected together!

It was quite a load of work, however help from the teammates and mentors helped very much. Go check it out!


Physics Team Design

In Physics II there are two lab sections that allow you to participate in a team based design course. The challenge is to model the velocity of a hobby train with given voltages. We do this using photogates… and a piece of National Instruments hardware that measures data at a rate of 400,000. I’m not sure what the units are, but it’s pretty amazing! The challenge sessions are where we apply this model, trying to predict the train’s movements based on the data that we have collected.

The way the data is collected is through LabView. Unfourtunately, the program that is used was deleted… so the professor/TA needed some help to fix it. After working on it for a few hours, we figured it out and got it to work! :)


iPhone Stuff

I’ve been playing around with core-plot and working on an app lately- it’s 80% done, and will be out on the App store within the next few weeks!

We’re still trying to sort out if we’re going to Open Source it, and how that would work (since we want people to buy the App too…!). Perhaps we could just *suggest* a donation whenever people try to download the code? Anyone have any experience with Open Source App business model plans?


Random

Coming back from winter break to school was tricky this time around… since I was outside the entire day playing hockey during the break!!! Although Clarkson has open skate, their ice mixture is really weird, and there’s no pickup hockey games :( Better than nothing, though.

I bought two shirts from shirt.woot, and they are awesome. One of them is ‘I Fought the Laws’, and has three pictures of crazy robots. The other is a robot that is plugged in to a wall outlet, leading to its heart. ^_^




That’s all for now! Keep it real, humans and robots. =)

Posted in: Art, Other, Programming, Projects, Robot, School.

Arduino to Matlab – Read in sensor data!

Posted by Erin, the RobotGrrl on 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!

EDIT JULY 4, 2011: Apparently if you add

delete(instrfindall);

as the very first line, it handles the serial object deletion issue! WOOT!

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!

Posted in: Programming, Projects, School.