Monday, June 11, 2012

Robot

I'm trying to build a cam-bot, on a budget, in the next three weeks.

Anyone who plans or documents a construction project learns very quickly that time and money graph against each other.  If you want it faster, it will cost more money.  If you want it cheaper, it will take longer.  And the edges of the graph are increasingly non-linear; shaving the last few days or the last few dollars becomes astronomically costly in money or time.

Add quality and you have three items that can not all be high at the same time.  If you make it as quickly AND as cheaply as you can, it is not going to good-looking or reliable.

I'm making an effect for the stage.  For a musical.  The robot has to come out under remote control and get to a certain spot on stage within the context and choreography of a scene.  And not stall, or go out of control and roll into the orchestra pit.  And it has to do this every single night.  And it has to survive being backstage before its guest appearance, meaning surviving people moving around it and sometimes accidentally hitting it or stepping on it or dropping things on it.  And it has to do this for five weeks plus technical rehearsals.

In any realistic world, you'd say "Let's take the time to build this right" or "Let's spend money on good parts so it will hold up to the stresses of performance."  But we are trying to achieve this without spending either.



See, the difference here is between what is possible and what is practical.  I could get hold of some gear motors, or even surplus electric motors and a pile of gears from Grainger.  Or find a couple of cordless drills at flea markets and hack the internals out and use them to drive wheels, and work out some interface electronics.  Of course I could, and people can.  But it takes time.  The first couple arrangements won't work.  The hardware you find at the surplus store won't quite fit without a lot of Dremel work and epoxy and other hacking.  And the first trial runs the robot will be jerky and uncontrollable (or too slow to be able to perform the necessary choreography within the time the music allots to it).

And by the time you go back multiple times to various flea markets and yard sales and surplus stores, and wait for mail deliveries from Hong Kong or Kowloon, and get through re-building multiple times...well, you will have probably spent significant money and even more importantly, significant time.

Three weeks sound like a lot of time, but not when you have other jobs to do, and you don't have a well-equipped shop to work in, and it is your first foray into robotics.  The point being; there is just way too much chance that after all the time you spend hacking something together on salvaged and home-grown parts, you will find yourself at deadline without a working robot.

The smart solution from the deadline standpoint is to purchase an existing robot or the essential parts (in this case, mostly the part called the Rolling Chassis; the basic set of wheels, axles, transmission, and steering gear).  But here is where money and quality plot inversely.  The R/C cars you find at the toy store are often under thirty bucks, but they also usually have a wheelbase of under 12", plastic wheels, and can barely manage their own weight -- much less the mock camera and other dressing we want on them.

When you go looking for rubber tires, gas shocks, differentials, and all the other goodies of a road-worthy R/C car, you jump up into the $400 range real quick.  As a basic rule, an R/C car that is big enough not to vanish on stage (the stage is sixty feet across and will have upwards of thirty actors on it) is going to be right at the fringe where they turn from toy store racers to serious gasoline powered grown-up-kid hobbies -- with price tags to scale with other adult hobbies.

I think this is probably the smartest route, however.  Going through eBay one can find a used chassis of the non-toy type for under $200.  It is probably solid and reliable enough to perform the necessary movements on stage without breaking down, and they are standardized enough so working out the electronics end may be as simple as buying a used Futaba transmitter and receiver and maybe an extra servo or two.

But I think our director has not done this research and believes that either toy store cars ARE big enough and reliable enough to do the job, or that there must be one in a garage sale somewhere and all one needs to do is spend a few weekends driving around to every garage sale in the county.

And I simply don't believe that this is a good gamble.  People win the Lotto, too.  Even if there IS a car in fully functional shape at a really great price right up the street this Sunday, planning the entire project on that happening is not the smart way to proceed.  The odds are much higher you'll find something that is underpowered, missing parts, gearbox filled with cat hair, and priced only ten bucks cheaper than what you'd spend at the toy store.  That's the problem with eBay and the internet in general; price reference is too easy these days.  People are going to price based on a much better understanding of the price other people are getting away with.  So add to your long odds, the chance of finding the person who bought the thing recently but has no idea how much it is worth.

I did take a long look at a robotics chassis -- as sold at such places as RobotoShop.  They have some decent prices, and they are designed to carry significant loads (which means the dressing and camera is no issue).  They are also designed to be easy to integrate the electronics on -- RobotShop has a chassis which is not only an Arduino compatible with FTDI chip for easy programming, motor drivers already integrated and PWM software already loaded, but it even has XBee headers to make a wireless control option simplicity itself.

The downside, however, is speed.  Whereas I suspect many of the R/C toy cars are going to be so fast there is a good chance it will smash into an actor or fly off the stage entirely, the robotics chassis are spec'd in terms like tens of centimeters per second.  A quick calculation shows me that many of these robots would take up to a minute to get from their entrance to their spike marks for the scene.  And in an American musical, a minute is a VERY long time.



So I did build a camera.  A mock-up of a 1970's broadcast television camera (but much smaller).  Turret lens, boxy body.  Tilt and pan mechanism for the camera, another servo for the turret lens, and a bright multi-color LED.  It is a bit wonky, because I built it really fast while tired and between rehearsals, and I didn't have the time or energy to re-arrange my room so I could get out the drill press and other more accurate tools (I did briefly use the bench grinder with it balanced on top of a kitchen wastebasket, however!)

The camera looks decent even without the paint job and final detailing, and all the servos work.  But I think I'm going to build a new one.  I think it needs to be even smaller, and even lighter, in order to work with the R/C cars we can afford.

And here's the thing again.  I built my own pan-tilt servo bracket out of white pine, aluminium bar stock, nylon bushings and machine screws.  It took three hours and probably cost ten bucks or more of materials.  I can get a servo bracket from RobotShop or SparkFun for fifteen bucks.  And it will have a greater range of motion and have the elements in the right order (my camera tilts then pans, which means the plane of the pan changes -- which makes it impossible to keep the image level).



So I just won a cheaper R/C chassis on eBay.  I'll grab one of the toy store R/C's while I am waiting on delivery and hack into it and see just how bad it is, too.  I need two robots, anyhow.  And I'll design and build a new camera around a proper Dagu pan-tilt bracket.  The one thing my existing camera did -- besides being a learning experience and looking kinda cool -- is to confirm from the Director that I am on the right track.  But I have yet to get explicit permission to spend money, and I can't afford to go into what is going to be a good $200 in parts entirely out of pocket.

I haven't gotten far enough to think about the actual controller.  Too much depends on the chassis (several chassis options come with radio already).  I recognize the utility of the standard controller form-factors to allow a human to control the robot in real time.  But on the other hand, some of the actions -- operating the LED that shines through the "lens," rotating the turret to the next lens -- require a layer of intelligence.  So for those, at least, it makes sense to go through a single serial link (via XBee) and simply communicate from controller to an on-board micro which will then execute the proper commands.  This is possibly fast enough to do the steering and motor control in real time as well, but it still leaves me trying to put knobs and pots on a box solid enough so an actor can learn how to run the bot.

In the end, having anything more than a fixed (and lightweight!) styrofoam camera may be a stretch goal.  But if I can get a pair of R/C cars dressed, then I'll have an acceptable fall-back position.

No comments:

Post a Comment