Posts Tagged ‘Twitter’

Stwutter Available!

Posted by Erin, the RobotGrrl on Wednesday, April 20th, 2011


Stwutter is now on the Mac App Store! BUY IT NOOOW!

Stwutter, the Mac App that does Twitter + voice is now available on the Mac App Store!

Here’s a short teaser video too:

Stwutter Teaser from RobotGrrl on Vimeo.

You can also view it on YouTube.

There’s more information available on the Stwutter website, robotgrrl.com/stwutter.

If you don’t have a Mac to download Stwutter, tell your friends that do have a Mac! Spread the word! :)

Posted in: Mac, Projects.

Stwutter Introduction

Posted by Erin, the RobotGrrl on Monday, April 18th, 2011

Here’s a video of a Mac Application that I have been working on. It is Twitter + speech. The tweets speak to you, and you can speak back at the tweets. I’ll post an update when Stwutter is available for everyone! In the meantime, enjoy the video:


Stwutter Introduction from RobotGrrl on Vimeo.

Or you can view it on YouTube.

Posted in: Mac, Projects.

Simple Processing Twitter

Posted by Erin, the RobotGrrl on Monday, February 21st, 2011

I created a really simple Processing and Twitter sketch to help a friend a few nights ago ^_^ It is based off of this previous code from the blog post “Processing + Arduino + Twitter + OAuth”. Here’s what changed:

- It now uses the Access Token that you can get from the Twitter App’s panel
- No more inserting PIN info into a file
- No Arduino clutter in the sketch
- Simple methods for posting, retrieving, and searching tweets.

You can probably do a lot more things with this too, thanks to Twitter4j.

Click to download SimpleProcessingTwitter.pde
Or view it on Github

If you use this code in one of your projects, let me know! It is cool to see what people make. :)



Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License. GO OPEN SOURCE!

Posted in: Art, Programming, Projects.

FNR – Robot Mesh Network: MANOI & IRC

Posted by Erin, the RobotGrrl on Friday, October 1st, 2010

Using Twitter as a means of communication between the outside world and my robots isn’t a very reliable solution. Sometimes the website is down, and they don’t return search results in a timely manner. There were a few other options that I through around, like using gchat or IRC. IRC seems pretty fun, plus I have already done some playing around with it through the factbot idea.

To be honest, MANOI hasn’t been powered up since May. There were a few tune ups that were needed. This included a few hours of debugging in order to determine that the TX and RX wires got swapped that were going to the SSC-32. The SSC-32 was also having some power problems, so I added in a new switch:

IMG_9970

The XBee is going to fit in behind the SSC-32, above the gyro and accelerometer sensor. You can see a part of it here:

IMG_9971

Once this was all set, I started to communicate to MANOI through IRC.

Here’s a video of an explanation and demonstration:

Mesh Robots – MANOI & IRC from RobotGrrl on Vimeo.

The IRC bot runs from a Python script. The initial code that I used was from Cmd-c && Cmd-v (cool blog name!). They use the pyserial and irclib libraries. There are specific commands that will trigger certain events. The commands are actually the function definitions, it is all done through the magic of this line of code:

  1. getModuleCallables()[cmd[0]](self.arduino)

The first command that I started out with was to read the force sensitive resistor on MANOI’s hand (kudos to Krafter for donating the FSR)! This is what the function looks like in Python:

  1. def readFSR(arduino):
  2.         print "MANOI Read FSR"
  3.         arduino.send(‘*’)
  4.         arduino.send(‘FSR’)
  5.         arduino.send(‘*’)
  6.         return arduino.read(4)

This is how it gets parsed into MANOI’s Arduino brain:

  1. if(newByte == ‘*’) {
  2.                
  3.                 byte byteIn = 0;
  4.                
  5.                 // Getting the command details
  6.                 while (byteIn != ‘*’) {
  7.                         byteIn = nextByte();
  8.                         msg[it] = byteIn;
  9.                         it++;
  10.                 }
  11.                
  12.                 // Checking to see if we received the message
  13.                 // and seeing how long it is
  14.                 if(it>0) {
  15.                         receivedMessage = true;
  16.                         messageLength = it-1;
  17.                         //analogWrite(greenR2, 255);
  18.                 }
  19.                                
  20.                 if(receivedMessage == true && messageLength == 3) {
  21.                        
  22.                         validCmd = true;
  23.                         ii = 0;
  24.                        
  25.                         // Check each letter to see if it’s right
  26.                         while(validCmd && ii<messageLength) {
  27.                                 if(msg[ii] != fsrCmd[ii]) {
  28.                                         validCmd = false;
  29.                                 }
  30.                                 ii++;
  31.                         }
  32.                        
  33.                         // If it is right, do the command
  34.                         if(validCmd) {
  35.                                 readFSR(false, true);
  36.                         }
  37.                        
  38.                 }
  39. }

BTW, this is how we are reading in the Serial data. It’s a pretty fail-safe way of doing it, especially as it is wrapped in the infinite loop. It makes sure that you don’t miss any data!

  1. byte nextByte() {
  2.        
  3.     while(1) {
  4.                 if(Serial.available() > 0) {
  5.                         byte b =  Serial.read();
  6.                         return b;
  7.                 }              
  8.     }
  9.  
  10. }

It’s pretty cool to see it working! For triggering dance moves, it is a basic command called danceCmd. The user then feeds in some argument that lets the Arduino know which one you want. For these examples, I used the argument BAJNGL. It stands for “Both Arm Jingle”, but saying it phonetically is pretty funny too *bajingle*!

Python:

  1. def danceCmd(arduino, args):
  2.         print "Dance Command"
  3.         arduino.send(‘%’)
  4.         arduino.send(args[0]) #bajngl
  5.         arduino.send(‘%’)
  6.         #r = arduino.read((7*19) + 3)
  7.         #print r
  8.         arduino.flush()
  9.         arduino.flushInput()
  10.         return arduino.read(4)

Arduino:

  1. // Pre programmed moves command
  2.         } else if(newByte == ‘%’) {
  3.                
  4.                 byte byteIn = 0;
  5.                
  6.                 // Getting the command details
  7.                 while (byteIn != ‘%’) {
  8.                         byteIn = nextByte();
  9.                         msg[it] = byteIn;
  10.                         it++;
  11.                 }
  12.                
  13.                 // Checking to see if we received the message
  14.                 // and seeing how long it is
  15.                 if(it>0) {
  16.                         receivedMessage = true;
  17.                         messageLength = it-1;
  18.                 }
  19.                
  20.                 if(receivedMessage == true && messageLength == 6) {
  21.                        
  22.                         validCmd = true;
  23.                         ii = 0;
  24.                        
  25.                         // Check each letter to see if it’s right
  26.                         while(validCmd && ii<messageLength) {
  27.                                 if(msg[ii] != bothArmJngl[ii]) {
  28.                                         validCmd = false;
  29.                                 }
  30.                                 ii++;
  31.                         }
  32.                        
  33.                         // If it is right, do the command
  34.                         if(validCmd) {
  35.                                 Serial << "okay";
  36.                                 bothArmJingle(1);
  37.                                 Serial.flush();
  38.                                 Serial2.flush();
  39.                         }
  40.                                                
  41.                 }
  42.                
  43.         }

But here is where the problem starts! Even though the commands that are sent to move the servos on the SSC-32 are attached to Serial2, they still go into the Serial output buffer. This means that when the Python script wants to read four bytes to see if the Arduino responded to the command, it gets the first four bytes of the motion command that are being sent to the SSC-32. It’s confusing because… why would Serial2 be going into just Serial? It’s really weird.

When I try to clear the buffer through Python, it messes up the way the function is handled. In Arduino, you can’t flush the output buffer, only the input buffer. However, I think that you used to be able to flush the output buffer, as I found an excerpt of a book that said that flush had two boolean values fed into it, for input and output. I think it will turn out to be a simple timing process thing for flushing the buffers from Python.

Once I figure that out, I can add on the XBee to MANOI and test it through wireless communication! I also have a ChronoDot that I can add on to MANOI as well, so that it knows what time it is. I kind of destroyed the circuitry for the RoboGlyphs when I tried to use a TLC594 with RGB LEDs. The TLC594 controls the PWM of the LEDs by connecting them to ground. It’s basically reverse of what you normally do. Common cathode RGB LEDs can’t work with this, only common anode. :P Once I save up enough moneys to buy an Arduino UNO Mega, then MANOI will receive that, and the RoboGlyphs will receive MANOI’s older Arduino MEGA. The RoboGlyph’s Sanguino can be used for BubbleBoy. That leaves two normal Arduino boards and one Boarduino left to be used for TECHNOROBOT and for the Transmitter and Receiver. The Yoda Rampage Robot already has an on-board Arduino on it. :)

Here’s the link to the Arduino code:

Click to download MANOI_awareness v01 pde

Here’s the link to the Python code:

Click to download Arduino IRC v01 py

Thanks to comm.cslabs’s IRC channel for being to withstand the numerous tests on MANOI and IRC bot. Glad I haven’t crashed it yet!

Here’s a photo of some pretty leaves at sunset being hidden by some technology (a telephone and power pole).

IMG_9975


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. GO OPEN SOURCE! :)

Posted in: MANOI, Programming, Projects, Robot.

FNR – Robot Mesh Network: Intro & Node 1

Posted by Erin, the RobotGrrl on Sunday, September 19th, 2010

I’m trying to create a network for my robots to communicate through and interact with the outside world to have some new behaviours emerge. Each robot will be able to read and transmit messages. The robots will be given basic instructions for things to listen to and eventually some behavioural AI to link previous commands together. The idea is to have robots talking to each other, informing one another of different sensor readings, thereby creating a shared knowledge of the environment that the robots are in.

In a military robots example, a UAV could be observing the environment below and an autonomous rover analyzing some LIDAR sensor data of its ahead of it. With some mapping algorithms applied and communication between the two robots, a rescue mission could be planned and executed very quickly. It’s all about networking the robots and making them talk together in “words” they understand.

Last Friday I worked on getting Twitter integrated with Processing. This weekend I added on to that existing work by trimming down the tweet string, and having it transmitted to an Arduino which broadcasted the message through the XBee to the other devices.

There are currently three devices on the network right now:
Node 0: Transmitter from the computer
Node 1: RoboGlyphs
and a Watchdog, which doesn’t transfer data, only reads what is being sent out.

Here is a video of a broad and basic explanation of everything so far:

Robot Mesh Network – Introduction & Node 1 from RobotGrrl on Vimeo.

The transmitter node serves as the main point of communication of the internet to the devices, and vice versa. It’s using an Arduino with an XBee attached to it. Right now its main purpose is to send out the tweet that it receives from the Processing sketch.

IMG_9945 - Version 2

The transmitter node looks like this:

IMG_9911

Which is attached to the computer running a Processing sketch:

IMG_9912

The Processing sketch is connected to Twitter, and searches for tweets that are to @RobotGrrlsBots. The connection is through OAuth, since IP rate limiting for feeds resets less often, as far as I have observed. It sends the most recent tweet to the transmitter node.

The RoboGlyph node receives the tweet, and does what the command says. The command has to be formatted in the way of this:

@RobotGrrlsBots RBGLYPH | RGB | RGB | RGB | *

If it is received OK, which is usually is, then it will display it! The process that the RoboGlyphs follow is that it fades in the colours, then it waits for a command. Once it receives a command, the colours will fade out.

This is what the RoboGlyphs node looks like:

IMG_9946 - Version 2

IMG_9928

And this is it working!

IMG_9917

Pretty cool. The RoboGlyphs could use a tune up though by using one of the TLC594 16 bit PWM out chips. Right now the green LEDs don’t use PWM, so it makes the animation look choppy.

The Watchdog watches all of the data that is being transmitted and shows it on the screen. This is what it looks like:

IMG_9943 - Version 2

IMG_9913

It’s useful to try to debug some things. While making everything I was having trouble with the New Soft Serial library and Arduino 0019.

Next time I will be working on getting data transported back from the RoboGlyphs and sending a tweet. From there, it will be about adapting that code to all of the other robots too. This is just the start!


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. GO OPEN SOURCE! :)

Posted in: Programming, Projects, Robot.

Processing + Arduino + Twitter + OAuth

Posted by Erin, the RobotGrrl on Wednesday, September 15th, 2010


WARNING: There’s a newer version of this code here: “Simple Processing Twitter”!

People who devise these spectacular security protocols and stuff really make it complicated to communicate to cool social networking sites. Yesterday I got carried away and ended up making a Processing sketch that could successfully connect to Twitter through its OAuth method. This is primarily for a project where Tweets are read, sent into Processing, which are then sent to the Arduino, which then broadcasts the message through its Xbee, and then the other robots pick up on the message. If the message is addressed to them, then they will parse it and do what it says. The first step though was to try and get the OAuth to work. Below is the link to the Processing code and some steps that I took that may help others. :)

Click to download ToArduinoAndTwitter v02 pde

1. Set up a Twitter application

Here is a screenshot of the settings that I used:

Twitter App

2. Open up the code and fill in the OAuth consumer information (line 131)

  1. twitter.setOAuthConsumer("***", "***"); // consumer key, consumer secret

3. Uncomment the initTwitter() method call (and comment out the other twitter method calls) in void setup()

4. Open the sketch’s folder (keyboard shortcut: command-K). Open up url.text and go to that website. Copy the pin.

5. Enter the pin in pin.txt and press enter. For some reason there has to be a new line at the end, otherwise it won’t work :P

6. The code should now give you the access token and secret that you need. This should also be in tokens.txt now.

7. Take the tokens and put them into the code (line 238)

  1. String token = "***";// load from a persistent store
  2. String tokenSecret = "***"; // load from a persistent store

8. Comment out initTwitter() method call, uncomment connectTwitter(). You can also uncomment getSearchTweets too!

Hopefully those steps worked for you. It’s not totally automatic, with the whole copying and pasting of the tokens, but it seems to be the quickest and easiest way to get this done with Processing. Luckily you don’t have to do those steps all the time! Since it’s open source, maybe someone can improve on it! :) If you find any bugs or have improvements, be sure to leave a comment or notify me! Happy tweeting!

Processing and Twitter

This is the screenie when it worked! Woohoo!


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. GO OPEN SOURCE! :)

Posted in: Programming, Projects.

Friday Night Robotics – MLK Day Preparations

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

Posted in: Animation, Art, Other, Programming, Projects.