Friday, April 8, 2016

Not Just Any Old Roomba!

The iRobot Create 2 came to visit Bellows Falls Union High School. At first, students scoffed at the Roomba with comments like "My Grandmother has one of those silly things that cleans her house!" With a lot of chuckling we fired up the beast and let it do it's demo self clean program in the classroom. Many students rolled their eyes. You could feel the attitudes saying "That's it!? Mr. Norkun really got us a vacuum cleaner? What are we supposed to do with this thing? "
The next thing we did was strip off the green cover to access some of the guts of the robot.
We spent some time navigating the robots website looking for ideas. There were claims that using scratch with some special plugins would allow for easy programming. We discovered that these scratch plugins weren't compatible with our Linux lab. So, back to the drawing board. We discovered that python was our best bet. I created a few lessons that directed students to use Codeacademy to learn some python basics.

#!/usr/bin/env python
import Tkinter
import tkMessageBox

top = Tkinter.Tk()

def hello():
   tkMessageBox.showinfo("Say Hello", "Hello World")

B1 = Tkinter.Button(top, text = "Say Hello", command = hello)

We downloaded a pre-configured python script to allow for tethered driving. From here we thought things were going to be simple, yet the robot revolt started. Somehow the script caused the robot to come alive. It decided to move really slow in a circle, without being connected to anything.

See for your self!

We ended having to perform open heart surgery on the beast to do a hard reset. Once that was done, and we were back online students continued to play with the code. 
The robot learned how to sing the imperial march, and navigate remotely. It tried to sing the super Mario theme and we will rock you, but it needs more practice. We had a lot of help from this document to understand how the ASCII commands were converted to binary on the fly. There are some handy dandy codes to help write music, and get the robot to respond to what we wanted. 

 We had the idea to mount an old netbook to drive remotely. We imaged the laptop with PeppermintOS and added all the necessary python programs  to talk to the iRobot.

 Some students had the idea of using the web camera on the laptop to create a live video and audio stream so the robot had "eyes." Then we used an android script to allow an android device to become a remote control that the python script would allow input from. we sent the live "eye" feed onto the projector in the classroom and we were off driving around the school, entertaining students and staff with some simple music. As iRobot drove around students realized that the laptop screen revealed all our secret code to any bystanders. We had to figure out a way to hide the screen but keep the "eyes" open. With some Linux bash script know-how we added some code that shut off the screen when the robot would deploy, this way the precious code was safe from peering eyes. 

Here are the  files we used to drive the robot around the school. 

The end result was something like this....(the code does actually play the Imperial March.) 

1 comment:

  1. The video about the robot's take over given in this blog was amazing. The information about the audio stream provided here was excellent.
    For more
    How to learn robotics