?

Log in

No account? Create an account
corvi
corivax
.:::. ..::.: .:.::..:.::. .::::

October 2008
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

corvi [userpic]
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. :)

Current Mood: happyit works!
Comments

Did it work right out of the box?

You may or may not already be aware that I love your writing.

So what's the damping like? If you stop driving it with the broom, how many periods does it go through before it stops oscillating (detectably)?

Having to deal with physics and imperfect mechanical or electro-mechanical components in my long-ago experience with a (pneumatic!) robot is what turned me off robotics. Not that there was much of that going on in my time & place anyway.

We're actually testing five different feedback routines with different characteristics - that's our actual research, with hypothesis and control and all those scientific trappings. :)

Some are optimized for damping, some for noise resistance, some to eliminate steady-state errors (which would likely continue indefinitely without friction to drag them out), etc - nobody's actually entirely sure which focus is best for this manuvering in zero-gravity. We aim to find out.

So, yeah, damping effectiveness actually varies a lot.

Hey woah. I didn't know you were ever into robotics.

This was just one little project as part of an undergrad AI class, long ago in a state far away. I'm susceptible to the romance of it, though. I mean, aren't people meant for higher things than driving or picking bell peppers?

I think robotics will be the next killer app for the electronics industry if not the software industry. Most of the industry leaders are too focused on the short term to believe that yet, but they will.

whoa! *glee*

Couldn't you get it to undercompensate rather than overcompensate? Wouldn't that be less annoying?

It wouldn't be any less annoying, because this is a robot that operates in zero-gravity - there's not enough friction to damp steady-state errors.

However, when properly tuned (the process described here in remarkably unscientific terms) it neither overcompensates nor undercompensates. That's what tuning is for - adjusting the algorithm and the physical constraints until they line up.

It does still make mistakes, bump into walls, and the like, of course - it just doesn't systematically overcompensate or undercompensate.

Wouldn't you get Zeno's robot that way? Undercompensating in a frictionless environment, it would start moving to the left, fire thrusters left, continue moving left, fire thrusters left, continue moving left, fire thrusters left -- and never *quite* stop moving left, until it bangs a wall or the edge of the universe or runs out of fuel. At least overcompensation has the robot oscillating around an approximately set point.

(ObIAmNotAPhysicist)

(ObYouObviouslyShouldBeAPhysicist)
(ObOrAtLeastARoboticist). :)

Yep!

Since the robot is firing thrusters to control its speed, undercompensating would leave it constantly adjusting its speed (and wasting propellant), but it would keep moving in the same direction - that is, it would zoom off, more and more slowly, until it runs into a wall. Drifting left a bit, then right a bit but staying in approximately the same place overall is a big improvement.

Also, the idea of "Xeno's Robot" amuses me deeply. Thank you.

Holy crapola -- this is what you do? Most unexpected, but then again, I never had any expectations of anyone -- it's neat that you ran across my LJ and now to see what you're up to is also particularly fascinating. Reminds me of when I ran into Derek last year ^_^

I didn't expect it either! I actually went and got my first degree in art - computer animation. But I kept getting deeper and deeper into the computer, trying to make it do what I wanted, and I discovered something wierd. Science is when you start with the entire universe, and take it apart looking for the pieces that combine to make everything - the laws of physics, or the chemical elements. Art is when you start with the simple pieces - a color, a line, a shadow, and build them back into the world.

Most people have a preference - while I enjoy both, for me, Art is more interesting - all these simple ideas combine in such unexpected and wonderful ways, entire universes of what-if. But what I learned, mucking around in the guts of computer animation programs, is that computer programming is an Art, too. You start with all these simple variables and constructions, and you can build the height and breadth of the universe with them.

So I picked up a second degree in computer science, which I hadn't previously known anything about, and these days I write code. I do mostly vision (teaching computers to understand what they see, like the robot) and visualization (figuring out how to display impossible things so humans can understand them - my big project with that right now is figuring out how to display a tree so that a human looking at the display can see the fractal skeleton of the tree - I work for a bunch of rainforest researchers interested in the structure of the forest). It's great fun, hard in all the right ways, so why not? :)

I know you're in grad school for English or writing or something - what exactly are you doing?

I'm currently at CWU for a masters in Teaching English to Speakers of Other Languages to help prepare myself for teaching in Japan with the JET program and other similar programs. I like where I'm going ^_^

hee! i'd never considered the difference between art and science to be bottom-up vs top-down design. :)

Well, it's hardly a universal view - lots of people have told me that Science is wonderful and rational and art is all fluffy and useless, or that art is wonderful and creative and science is all rigid and oppressive and squashes ingenuity.

I find them intensely similar, but maybe this just means I am not a good scientist, or artist. :)

instead of sound, of course, it's actually bopping back and forth. :) most charming...

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.

[...]

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.


My, _god_, I love your brain.

Simultaneous geek and music-gasm!

1) neat! i gotta get some tech toys i can talk about.

2) i use a similar analogy to describe how nmr works, tho, sadly, there's no way to use nmr to make molecules explode. :)

3) i'm surprised static calibration works even that well. poor little robot's mass falls as it fires its thrusters, so the overcompensation gets worse as it goes. er, right? or does its dry mass so dominate the change that you can ignore it?

i wonder how hard it would be to write an auto-calibration routine for that damn robot™. istm (ignorantly) that if you had accelerometers, you could have it start at rest, fire its jets for a bit, and then try to return to rest. since you know all the inputs1, this would (in theory) yield the constants you're looking for.

1: dry mass, mass/time of propellant used in the jets, and so forth. even if you didn't have them to start w/ the calibration routine should be able to get a bunch of them via "n equations in n variables". just a small matter of coding, right? :) ;)

1) Yes, yes you do. :)

2) I will remain grateful there's no way to make That Damn Robot explode, either.

3) Honestly, I haven't looked into this as much as I should, though xmurf, our hardware designer, has put some thought into it.

I don't think it's a big issue - there's about three pounds of air, total, and the robot weighs fifty. By the time the tanks are near-empty, we're done anyway, as results get very strange once the tanks can't fully pressurize the thrusters. I'd be more worried about the CG shift. xmurf put the tanks as centrally as possible when constructing it to minimize this.

There's lots of noise in the system, I'm afraid - the small amount of noise this generates will be overwhelmed by vision mistakes, bumping into things, and the like. :)

wait-- does this mean you can tame the magic beastie by throwing a harness of blinky lights over its head? because whenever the lights move it will think it's moving and adjust to follow?

sorry-- solid lights, not blinky.

Er, yes it does. Hee!

I suppose if you had blinkylights on a marquee, you could flash them to make it look like the light was scrolling in a given direction to get the robot to move in the other.

it works on us, so why not? :)

that's poetry. and then there's the timbre of different instruments' resonances. there's something entirely different about that shimmer on a flute and on a cello -- but they are both delicious.

i'm so glad i read this :)

and, BTW, did i ever tell you that this icon was made for you? i mean... i love robots in that abstract way, but i was thinking of you when i made it :)