corvi (corivax) wrote,

  • Mood:

teaching robots to sing

Like a lot of classically trained musicians, I sing secretly at wine glasses in restaurants and at other people's fancy dinners. If the glass is lead-crystal, there's a certain note, the resonant frequency, you can find, can hold it beating against the inside of your ribcage. Theoretically, one could shatter the glass with this note, held long and loud enough. But while my pitch is good, I am not a particularly skilled vocalist, and I lack the volume, or anything very close to it.

You should arrange to see shatterglass someday, in person or on video. It's neat. The whole glass writhes. The rim beats like a heart, pulls itself into an oval, then back the other way. The little puddle of light in the shadow of the glass dances like the ripples on the bottom of a pool, unfolds itself spidery over the table. The glass, this solid fragile thing, comes alive, shimmers on the edge of movement and stillness, all potential unspoke.

(If you're better than I am, eventually it just shakes apart, but I can't ever get that far.)

The robot works like this: it has cameras. The cameras look around at how fast things are moving by the robot, and it guesses what speed it's moving at. Then it fires its thrusters in the opposite direction to slow itself down. So if the robot is going really fast, it wants to fire its thrusters a long time, say half a second, and if it's going slowly, it wants to fire them much less, say a hundred milliseconds.

So there's an amount here, a coefficient that says 'if the robot is moving at this speed, fire the thrusters this amount. If the robot is moving at half the speed, fire the thrusters half as long'. This amount that calculates observation from response is called 'gain'. In an ideal universe, the robot would see how fast it was going, and use its gain to figure out exactly how long to fire the thrusters for, and bring itself to a perfect stop.

This isn't an ideal universe. The robot sometimes can't figure out how fast it's going, say, if a goofy researcher is doing zero-gravity somersaults right in front of one of the cameras. (I would never do such a thing! La la la. Must have been some other white-haired roboticist.) The solenoids that control the thrusters aren't perfectly accurate. Sometimes (gasp!) the vision code makes mistakes - vision, like AI, is about probabilities and best guesses, and often wrong, and I gave the robot fairly naive algorithms.

So we were trying to figure out what the robot's gain should be, which is a very complicated process. It's easy to do for a set of equations, and very hard to do for a real, imperfect robot.

The Configure The Robot Dance goes something like this: I shove the robot with a broom. The robot looks around, sees that it is moving, and fires its thrusters in the opposite direction. But it overcompensates and is now moving in the opposite direction. So it looks around and fire its thrusters in the original direction. And overcompensates again. Whee! At about this time, I tell one of my teammates to turn off the robot, in a sentence specially constructed to contain every profanity I know. Then we insult the robot's parentage, until we realize that the parents are either us, or the very sexy CNC mill. :)

(It's just a zoom to the left, and then a whoosh to the right, focus your cameras, and blame everything in si-i-ight!)

Then we tinker with gain, thruster instrumentation, the configuration routines for the camera, thruster pressure, center of gravity, and the like for a while. Someone sends for a pizza. Someone else contemplates the remblance of a particular screwdriver to a throwing knife. Then repeat the Configure The Robot Dance again.

So, let's look at this too-far-forwards, fire-thrusters, too-far-backwards bit. If you draw a graph, it looks like this:

Someone shoves the robot with a broom, and it's moving to the left quickly. Then it fires its thrusters, slows down, speed goes towards zero, reaches zero, keeps going down - moving to the right now, the robot fires its thrusters again, speed goes up towards zero, keeps going up, too high. Too far to the left, fire, too far to the right, fire, too far to the left, fire...

Doesn't that look like a sound wave?

All the AI, all the solenoid delays and vision granularities, gain and pressure and weight, focus the sound like the curve of a wineglass. The robot actually thinks and moves by singing.

And as soon as I realized that, all we had to do to get it to work, to find its position and hover there, was teach it the right notes. Resonant frequency. The note that shimmers on the edge of stillness and motion, the note that makes it come alive.

I can do that. I've been doing that to wine glasses in fancy restaurants for as long as I can remember. I know what that's like, the wierd underchords you get when you're not at quite the right note, the way everything begins to shimmer when you're close.

And now the robot works, a thing of metal and machining and music.

This makes me very happy. So happy, in fact, that you all had to sit through a livejournal post about it. :)
Tags: public, that damn robot

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.