Wednesday, April 23, 2008

How to solve it

My apologies to George Pólya for quoting the title of his jewel of a book, but "How to solve it" made an indelible impression on me when I read it decades ago. I wish I had had him as my math teacher instead of the monster that expelled me from his class for having the nerve to record his "lectures" (which I did not understand) in what must have been one of the earliest portable recorders (the size of a worker's box lunch) that my dad, a very forward thinking man gave me as a present so I could use technology to help me in my studies. This wicked teacher foamed (he became redder than he was and I remember his veins bulging in his neck) that my intent was to make money with his awful expositions, when my only intention was to listen to it again at home and review the parts that were unintelligible to me. Remember it was the time (1960's) of slide rulers and solving logarithms, square roots etc. with pen and paper! and teachers which threw solid wooden rulers at students if they failed to pay attention.

In any case, this is how I went about it:

The two control strings for the head (1 and 4) allow it to not only turn left and right, but as I said before to tilt sideways and bow as well. In a traditional marionette these strings are played like an instrument, varying the tension, twisting and plucking.

When the marionette needs to kneel or jump etc. you are not really concerned with this since the entire body, head and all is balanced by your hand, which uses your own personal embedded experience as a subject of gravity to effect movements which prove extremely hard to program convincingly. Imagine for example that you want the character to tilt his head slightly in an inquisitive way while bowing and kneeling at the same time. If you try to break that into individual movements performed by individual muscles of your hand, fingers and arm you will picture the complexity of the apparent simplicity. Don't forget that I said tilt his head in an inquisitive way!

So, in my dream I must have followed some of the principles Pólya suggests to poor souls in distress, like for example:
  • Look for a pattern
  • Draw a picture
  • Solve a simpler problem
  • Use a model
  • Work backward
  • Use a formula
  • Be ingenious
The 'head' strings reach the horn which would turn the head left and right and you would think that is where the strings should end. Then I visualized (and this is what comes from the dream) that the strings at that point corresponded to my left hand fingers twisting them while my right hand controlled the other movements in unison.

So I let the strings continue on to the other 'hand' which would pull or let go to let the gravity do its thing. The combination of these elements (including the most important, gravity) give you a very rich and expressive palette of head "language". This of course I cannot convey simply by pictures, but I will eventually post a video of the movements.

The 'other hand'

I continued raiding my wife's sewing supplies and used this perfect and beautiful spool, which I epoxied to the servo horn (you can still see behind the spool the gray irregular shape of the rock hard Apoxie that I used. Need to refine that.)

There was another problem, which because of its apparent simplicity tends to be forgotten until it is too late. Remember the analogy with a string instrument. So it is that you must tune the strings of your marionette to the perfect tension which allows precise control while at the same time giving gravity and inertia room to infuse the movement with the illusion of life.

Easier said than done. First of all the strings are very thin and usually waxed or Teflon coated to prevent fraying. That makes tying and untying knots practically impossible. Then consider the awkward and tight places where the strings are connected. Finally, size. Things that are very easy at a human scale become wickedly difficult in Lilliput.

Bowl of Sushi by Hiroshige (Edo Period)

My love of sushi came to the rescue. Chopsticks! the bamboo sticks have the right diameter, are pleasant to touch and sight (and taste) and its transversal structure provides the friction necessary to prevent the 80 lb. Teflon string from sliding. This was my prototype but although it stopped that string diameter from sliding, my preferred string is .006" Fireline, which is a braided bead thread very strong and resistant to abrasion (it is used to weave the smallest glass beads). This string just went through my tensioner like a water snake.

So I refined my prototype incorporating an opposing path that effectively holds it in place. And what is more important and the reason for this exercise, it is easy to adjust as needed, to tune the strings of the instrument.

Tension is good when needed

Monday, April 21, 2008

Sense and sensibility and the Oneironaut

Visualizing the user interface for servo control

The nervous system is the current step (by step). Working on the sensors and on the beacons has given me a clearer understanding that there is nothing I know. Still very very far from The Docta Ignorantia.

Here is our microprocessor stack composed of two Make boards which were our final choice. The boards are highly integrated, very easy to interface and simply well designed. The only drawback was the limitation of 4 servo ports per board. I decided early on that 8 motors were as many as I wanted to use, both for practical and symbolic reasons. Four is the symbol of man generated by the trilogy which comes from the duality contained in the unity (bear with me, it is a stream of thought). 8 represents the power of the king in chess, and the queen in all her potency and (coming down to earth), I could only afford two Make controllers anyway! So, there. I had to do it with only 8 motors, period.

Then came the IR beacon circuit. That was a lot of fun to build although it took a lot of trial and error to do it with kitchen stuff. DYI instructions stipulate in no uncertain terms that you should use glossy inkjet paper and ONLY print with a laser printer, then iron transfer into the copper plate. Well, after many frustrating trials, botched plates and burnt fingers we (Philip and I) decided to try swhat you are not supposed to do. Went to our local print shop and had the circuit printed on their glossiest color laser paper with their fancy color printers. That worked beautifully. It transfered absolutely perfect the first time around. The entire coating of the paper stuck to the plate, and I am sure more than one has though that was wrong, but after soaking it in warm water the paper peeled off like a decal and left an impecable mask.

So here is Philip, which was the instigator of the whole DYI circuit idea cooking up the circuit with a coctel of muriatic acid mixed with hydrogen peroxide. In a few minutes our circuit was done. As usual he is multitasking with his totally hacked IPhone.

Guess where Philip is from...

Philip in my studio dremelin the circuit holes while Castro look approvingly at our socialist methodology.

He got a kick out of my retro-futuristic glasses. You look awful in them, but they have a variable focus that allows you to magnify minute stuff or read a newspaper across the room.

This section needs proofing and revising...tomorrow, after I give my class and deal with insane bureaucracy.

After dealing with the obvious and easy choices, like the arms (4 motors there) I realized the problem. My monster servo would lower the body, yes. But what about the head?, the shoulder strings? (they allow the marionette to turn the upper part of the body to face in another direction). They had to be lowered at the same time! otherwise I would need many more motors and complex programming to synchronize all these elements.

So the idea of the elevator was born, with all its ancillary problems, weight, friction, balance, stability, randomness, etc. At first I built tracks to guide the (square!) rods up and down. These rods (quads?) support a platform that houses the 3 remaining servos. The problem is that the head has more than one degree of freedom of course. It not only has to turn left and right, it also has to tilt sideways and bow as well. Or pitch, yaw and roll if you will.

All these simple motions are trivial (if difficult to master) in a marionette. Then I had the shoulder controls to turn the body around; how to do all that with 3 servos and control the wanted nuances?

After about two weeks (which is the time I have not posted!) I stumbled upon the solution, where but in a dream!. It is pretty obvious that we work as hard in our oneiric universe as we do in our waking world.

Next morning I skeptically went to examine the contraption with the suspicion that, like many other "great ideas" conceived in la-la land it would turn to be impractical, impossible or just plain turdy. It actually took me a while to connect my ideas with the reality of the mechanics, something was missing which I had apparently forgotten. Then, all of a sudden I saw it! make one of the servos perform double duty.

I cannot even explain how I visualized it. It was so obvious, simple, and yes, elegant. The only bummer is that I feel it did not come from me but from the collective unconscious debris. I just picked up the pieces.

I will post some pictures to explain how it works.

Monday, April 07, 2008

The Exoskeleton

I have been literally immersed in a virtual reality. Working at a small scale forces you to adjust your senses and perception of self. Then you suddenly realize that somehow your fingers are too big, your body too clumsy, your eyesight not good enough to deal with a Lilliputian world. Fortunately our cyborgian self comes to the rescue and we make use of the many attachments and extensions that makes us makers of things, creators of our own destiny. (I might believe that someday...)

All the mechanics are functioning, at least by hand and in individual servo tests. It has been very hard to deal with some problems, most of which have to do with balance and friction, not of the marionette which is very fine, thank you, but of the mechanical elevator that raises and lowers most of the machinery so that the head can turn, the body express and the arms move while at the same time the Creator changes its position , kneel, stand up etc.

This problem is not so evident at first, specially if you are used to manipulate a puppet or marionette. Since your hand has a mind of its own it is hard to consciously realize tha amount of intelligence that it has to deal with all these complicated maneuvers. As you move the "plane" controller, pull the strings etc, you hand raises and lowers automatically and compensates this movement by tilting, rolling or yawing the controller.

Arm control assembly

Potentiometer as high precision encoder

However, when you have a fixed structure that supports the controllers it becomes evident that you need more than one motor to actuate on any given movement, because each movement influences the rest. Of course, as Dwiggins taught us, you should let gravity do most of the work, since she knows all about the laws of physics, but then there is the issue of correspondance, economy, efficiency and why not, elegance of design. Simpler is better. The complexity of simplicity.

Detail of the servo with its sturdy mounting plate

Assembled arm control with lead counterweight

Lead counterweight and potentiometer encoder

Give me a big enough lever...

The real servos finally arrived! here is the Hi-Tech HS-805BB Mega Giant Scale Servo being tested. I simply attached one of the many great horns and plates that it comes with to my fish-line spool, using its own screw and voilà! 19.8 / 24.7 kg*cm (4.8V/6V) of torque! It is temporarily held in place with straps as you can see because as you can imagine the square holes of the Vex plates don't line up with anything but their own stuff (I promised I would stop bitching about it!)

For the rest of the controls I am using the
HS-645MG UltraTorque Metal Gear Servos that have 7.7 / 9.6 kg*cm (4.8V/6V) of torque, very much on the safe side.

On the left of the picture you see Vex's red optical encoder which I planned to use to determine the position of the continuous rotation motors that lift the arms, but again, not even the extremely versatile Make controller could recognize the simple signal. I am sure it can be done but why waste time. I ordered a set of high-res 10 turn potentiometers that are not only more precise but can "hold" the last position even when the power is turned off.

Divide and conquer?

That seems to be the design philosophy of the VEX guys. I promise (well, a weak promise) that I won't waste more time bitching about their horrible "close source" design decisions. But someone has to say something. Of course I used their stuff to prototype my project since I had bought 5 or 6 kits with the hope of actually using them for the final project. Now, to be fair, their nuts and screws are first rate and I have no complaints, as well as their cute chain transports if you use their square shafts of course, but the rest...

It was obvious pretty soon that the electronic/hardware side would not work due to their very flimsy nature and weak linkage (or lack of it). Take their servo for example. Not only is it far from standard, so that you cannot mix with any other brand, but it lacks fundamental elements like a horn or attachment plate of some sort so that you can drive something more than their absurd square shafts. Guess what, you cannot even screw anything to it, you can only use their "clutch" (the small cylinder with a short square stub) to attach another square shaft to drive any square holed device! BTW the clutch and therefore anything attached to it, will simply fall off if you turn it upside down. Am I missing a screw here?

You cannot see it in this next picture, but those arms or extensions that I need to drive the limbs of the marionette with have as much strength and stability as an apple stuck on the tip of a drinking straw and balanced on the edge of a glass, can you picture that? perhaps David Copperfield could use such a trick. The main reason being that as I explained, the servos connect to anything else through the wimpy clutch mechanism that cannot stand any side pressure, only direct transmission to a wheel at the most.

To be fair, after a great deal of literally hacking away with a saw, drilling and cutting and bending, I was able to put together a somewhat functional scaffolding for the stage. If I had the money I would simply make everything from scratch out of aluminum and some steel pieces. And, yes, chuck those servos away. I opened one to convert it, I was so shocked by the poor craftsmanship inside, probably built on a Chinese sweatshop (badly soldered by hand), that I just closed it and proceeded to order a set of excellent Hi-Tech servos.

Snap to grid

Serious construction begins. This has to be, want it or not, the last stretch of the building process for the Creator stage.

But before I begin this section I want to share a tip that I take for granted, but friends that see it are always amused by it. You know that when you work on a project involving dozens or hundreds of small pieces, screws, washers and what not, things like to go amiss. Lost socks pale in comparison, specially when you lose a servo screw that you won't find in any hardware store (unless you live in the Bay Area, how I miss that!). And ordering a screw or two online just does not cut it.

So, I use a big magnet block (which I don't remember where I got) and simply and literally throw all those little pieces at it, even from quite a distance and it just snaps them as they try to go by. Sometimes I am working on an odd position, (upside down ?) and as I disassemble something, which happens more and more often as I try to refine my design, I start collecting all these little pieces in my hand and mouth that are eager to disappear in the cracks of the floor or my stomach. Well, just toss'em up like a chef flipping pancakes towards the magnetic field and , snap! they are not going anywhere.

Now, mind you that this is not a very powerful magnet, like those neodymium or ceramic magnets that you find in hard drives otherwise getting a washer back would probably be impossible, but it is strong enough to hold quite a bit of stuff. Sometimes you cannot even see the magnet anymore, just a weird nut screwy sculpture. I'll add a pic like that so you can see it.