Friday, May 8, 2009

Computer Science Showcase

Well, finals are almost over, but mid-week there was a Computer Science Showcase in the Courant building at NYU. Our Robotics class had a corner where the Rovios were playing soccer and the 3πs were following lines. My Rovio, someone else's 3π:

video

Adjusting the Rovio to run on the hardwood floors with the different lights was a challenge -- I had to change the coefficients for distance to ball and goal and the threshold for detecting the ball. The floor made it particularly challenging because the reflection of the lights is about the same color as the tennis ball (to the robot) and so sometimes it thinks the ball is somewhere its not. Add in human interference, as a bunch of us were jammed into a 9'x9' area, and it was chaos. Also, I added a victory dance at the end, thanks to a request in the comments.

video

This is someone's 3π -- I have my code for this, but its not as fast as this one. Wow. The 3π uses 5 infrared sensors on the front end, along with some C++ and a PID controller to follow the line.

Also, the professor just sent out an email; looks like our class was picked up here:
http://www.slashgear.com/wowwee-rovio-taught-to-play-soccer-0642907/
and here:
http://www.robocommunity.com/blog/entry/15953/Rovio-Learns-Soccer-Bends-it-
Like-Beckham/



Rovios face off.

Blurry 3π racer

Labels: , , , , , , ,

Tuesday, May 5, 2009

Rovio works!



The point of the whole project is to get the ball into the goal.

The algorithm goes:
  1. take a picture
  2. convert it from RGB to YUV
  3. mask out the ball and the posts into 2 separate matrices
  4. find the ball
  5. turn to it
  6. rotate around the ball until you find the goal
  7. shoot!
And if it were only 7 lines of code my life would have been much easier for the last little while ;) Here's all the code. And here's the Rovio in action:


video

Woot!


video

The next step is to clean up and compile the code to get it ready to play soccer against the other Rovios!

Labels: , , , , ,

Monday, May 4, 2009

Class Rovios

http://www.cs.nyu.edu/~yann/2009s-V22-0480-001/media.html

The professor put up some pics/videos of the robots in action, err... more in circles.

Labels: ,

Monday, March 30, 2009

(Lisp) is mind-numbing

Well, not entirely Lisp... its actually (lush). But the parentheses... Oy. Thank god for Emacs paren highlighting. Here's the whole thing: robotest.lsh, but here's just a little sample of the beauty of (lush) syntax:

(setq len (* h (/ (- (* k f) y) (+ (* k y) f))))

Just like http://xkcd.com/224/ and http://xkcd.com/297/!

The whole point of this was to take in an image (top), mask out the color (bottom) by first eroding, to eliminate noise, and then dilating, to get back the origninal big blob of color (the eraser):

Then that formula (above) tells the robot how far the object is from it, based on how many pixels down the screen the middle of it is, how high off the ground the robot's lens is, and its focal point (-371). That distance formula took a whole classroom a while to figure out....

This is for a Rovio robot (which is controlled over wifi), and that picture was taken from the robot.

Labels: , , , ,