Skip to main content

Crawly creepy



There's a reason why human beings don't ever stand up and walk, any time soon after they are born.  In fact, for a long while, we prefer to do everything but elegantly saunter across the floor using our feet; dribbling, vomiting, screaming at maximum volume - often simultaneously, and for no apparent reason - being some of the pastimes that we initially feel will get us further in life (unless, of course, measured literally in distance travelled).

And ultimately it's probably because walking is actually quite hard.  It involves us prevailing against a ferocious adversary of nature: gravity.  And the discovery of a phenomenon called balance.  Clearly, all this is much too much for a little you who has only just learnt that it's not ok to chew on your iPhone.  Or iPad. Or just about anything else that generally shouldn't reside in the pits of human stomachs.

It shouldn't surprise you: this is in fact, equally applicable to robots (the bit about walking that is, robots are generally free to chew on anything they want, including people).

But now that our beloved Rosie has graduated from being a plastic box on wheels, into a 3D-printed mechanical contraption peppered with random servos that should be put to good use, we do need to get her to do something vaguely interesting.

To this end, let's accelerate her transition from robot newborn to baby by (somehow!) getting Rosie to creepily crawl. Uncles and aunties - get your camcorders ready.  We're one recording away from (another) YouTube robot epic fail video.

You don't want to be the tool without the tooling:

  • A Raspberry Pi 3, running Raspbian OS
  • Yes, you will need your very own 3D-printed mechanical thing of wonder, armed to the hilt with servos, and a servo controller of some description.  Incidentally, we soon discover that our servos don't actually give us enough torque. Boo.

Chequered history:

Building Rosie 2.0 - naturally - assumes that there is a Rosie 1.0.  For that reason, casting your eyes over the organised chaos that was Rosie and Rosie Patrol is highly recommended.  Having said that, most of the material here is based on what was *accomplished* (to use the term loosely) using Mr. Ted-E U.  That's if by *accomplished*, we actually mean made a stuffed teddy bear rave to 160 bpm dance music.  Some accomplishment, that is.

Bit by byte:

  • Get Rosie 2.0 all ready.  And armoured up.  Have robot paramedics on standby.  This will not be pretty.
  • Modify Python code to mimic the sequential movement of each of the servos in all limbs to (vaguely) reproduce the art crawling... and try again when you notice that it doesn't work.  And again. And again. Before giving up.

You ain't seen nothing yet:

The optimist in us thinks perhaps this isn't going to be as hard as it first seems.

After all, we made what has become Rosie 2.0's body perform all sorts of weird dance moves during a previous outing.


Can crawling just be another one of those moves, only now, lying unceremoniously face down on the floor?  Surely, crawling too can simply be described in a series of servo positions that need to be actioned over time?

That's the theory, anyhow. And it all looks good on paper (of the electronic variety).

And in fact, the reality isn't too far off. Except with the robot now running riot on its feet (and arms, and just about every other body part required to keep it upright), the laws of physics - especially Torque - tries their hardest to spoil our little experiment.  Let's see how.

Detail:

There's been a lot going on lately, so let's do a little recap:
*We do not.

Our setup performed adequately, when we were simply demonstrating the movements of her joints while the overall frame remained attached to a stand.  We witnessed, crisp, speedy robot limb movement that filled us with misleading great confidence; and that we could possibly leave the world of motion behind and start to focus on the code to make the thing more intelligent, and useful. The new Skynet, if you like.

How wrong we were.


You see - robots don't tend to be unceremoniously bolted onto a plank of wood permanently.  People expect them to move around, by themselves.  And moving robot limbs independently using cheap-ish "hobby" servos - it turns out - isn't very hard.  But when it comes to supporting and moving entire robot anatomies, our old nemesis - torque - makes a dramatic return with a vengeance - in a "you didn't forget about me, did you?" sort of way.

And in the very same way you can pretty much define your budding robotics hobby by the period before and after the arrival of your 3D printer, when the thought of torque (or the lack of) starts to keep you up at night, you know your hobby has morphed into something else.

Let's remind ourselves what it is: Torque (τ) is a measure of rotational force, calculated using distance (r) to where the force is being applied, and the force (F) itself. Until now, r have been the individual lengths of Rosie's limbs that need moving, with F the measly weights of those components. But now that Rosie has been assembled together, top to bottom, and will be free standing, one particular joint (servo) may now need to actuate the movement of a vast proportion of her body.  Often against external force, like the friction of that horrible hotel room carpet.  You can see how we are now faced with an almighty challenge.

By the way, the equation for torque (τ) remains:

τ (Torque) = r (Distance) × F (Force)

Throughout, we've been making substantial increases to the distance (r) and force (F) variables of our robots.

Incidentally, the official SI (international system of unit) for torque is actually N-m (or newton-metre). Apparently the prevalent use of kg-cm in servo specifications causes some consternation amongst those that like to keep it real.

Back to the point.  Rosie is not going anywhere equipped with the HiTEC HS-311 and HS-422 "hobby" servos capable of a stall torque at 4.8V of 3.0 kg-cm and 3.3kg-cm without some drastic action.  Let's entertain the possibility of doing something quickly (and desperately) to keep this show on the road.

But before we do, here's a silly graphic to demonstrate how - in principle - the larger or heavier the robot, greater the torque requirement of the servos in the joints. 


Here are some potential ways to physically tinker with various parts of this equation.

ParameterHelp, what can I do? Quick!
τ - Torque
  • Probably the most obvious way of "getting more" torque is to get your hands on servos with a far higher stall torque value.  But beware; they are going to cost more, likely to be larger in size, and consume more power.  You may start to venture away from using "hobby" servos designed for remote controlled cars and planes, and become besotted by dedicated robotics servos flaunting a lot more torque and features.  But you may quickly reconsider, when you see the total of your online checkout basket grow to exceed your bank balance.
  • Some servos accept higher voltages for more torque.  For example, we are currently using a 5V / 10A power supply to power the servos.  Supplying 6V to the servos gives us a slight improvement in torque according to HiTEC documentation.  Not a game changer, however.
r - Distance
  • Perhaps the robot parts can be shortened, and the overall height reduced?  This might be a disappointing outcome, if you were planning on creating a humanoid robot capable of defeating the season's NBA champions at basketball.
F - Force
  • More realistic, perhaps, is reducing the weight of your robot.  Is it possible to reduce the amount of PLA used for the printing of your individual parts?  Can you use lighter material?  Introduce more gaps and holes in the design, without compromising the overall strength, and you might be onto a winner.

There are probably other practical things that can be done.  And clearly, you might need to do more than one of these to make your robot mobile.

Over time, we are going to attempt to do two of these things; improve the design so that less material is used when it is 3D-printed, and also to procure some "meatier" servos that are better suited for the task.

But - clearly - these things will take time (and money).  And in the meantime, we have a robot that is looking rather sad at the prospect of being neglected for some more weeks.

And that's why after that rather long-winded (and depressing) explanation as to why we're setting ourselves up to fail big time, we've returned to the mission of making Rosie do something that should be less taxing mechanically, and more importantly, allows us to demonstrate coordinated movement of the servos... crawling.

Let's return to IPython, and remind ourselves how to manually move the servos into position.

ipython3

Remember our Adafruit 16-channel PWM / Servo HAT, and its library?  It's time to use them once again.

import Adafruit_PCA9685
servo_controller_1 = Adafruit_PCA9685.PCA9685(0x40)
servo_controller_1.set_pwm_freq(50)

At this point, we can start to dish out our experimental servo positions to test out various postures. For example, presumably Rosie wants to roughly see where she's heading. This is what we set for her two neck servos which happen to be connected to the HAT at channels 14 and 15:

servo_controller_1.set_pwm(14, 0, 340)
servo_controller_1.set_pwm(15, 0, 430)

Same applies to all other servos that we need to control.  Trial and error is the name of the game here. Lots of it.  But let's pretend that we now know what servo positions we need; and return our attentions to the Python modules we developed before for Mr. Ted-E U and pretend that we can define the "crawl" in the form of a single move.

For example, if we create a move called "crawl" and define 16 sequential servo positions for all our servos, can we (sort) of make Rosie crawl?

AVAILABLE_MOVES = {
        "crawl":{
            "description": "Gradually crawl forwards",
            "gradual": True,
            "left_arm_servo_1": [270, 270, 270, 270, 220, 220, 220, 220, 270, 270, 270, 270, 220, 220, 220, 220],
            "left_arm_servo_2": [180, 180, 180, 180, 180, 220, 260, 300, 180, 180, 180, 180, 180, 220, 260, 300],
            "left_arm_servo_3": [180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180],
            "left_leg_servo_1": [220, 220, 220, 220, 270, 270, 220, 220, 220, 220, 220, 220, 270, 270, 220, 220],
            "left_leg_servo_2": [180, 200, 220, 240, 180, 180, 180, 180, 180, 200, 220, 240, 180, 180, 180, 180],
            "left_leg_servo_3": [320, 280, 240, 200, 320, 320, 320, 320, 320, 280, 240, 200, 300, 320, 320, 320],
            "right_arm_servo_1": [390, 390, 390, 390, 340, 340, 340, 340, 390, 390, 390, 390, 340, 340, 340, 340],
            "right_arm_servo_2": [180, 220, 260, 300, 180, 180, 180, 180, 180, 220, 260, 300, 180, 180, 180, 180],
            "right_arm_servo_3": [180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180],
            "right_leg_servo_1": [340, 340, 390, 390, 390, 390, 390, 390, 340, 340, 390, 390, 390, 390, 390, 390],
            "right_leg_servo_2": [180, 180, 180, 180, 180, 200, 220, 240, 180, 180, 180, 180, 180, 200, 220, 240],
            "right_leg_servo_3": [320, 320, 320, 320, 320, 280, 240, 200, 320, 320, 320, 320, 320, 280, 240, 200],
            "neck_base": [350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350],
            "neck_top": [430, 420, 410, 420, 430, 420, 410, 420, 430, 420, 410, 420, 430, 420, 410, 420]
        }
    } 

Fire the Python code up, and you'll probably find your poor robot desperately struggling to do something on the floor.  You could vaguely call it crawling... if you're prepared to wait half a century for your robot to make it across the room.


It certainly requires improvement in lots of different ways.  I mean, who designs claws for crawling robots that serve no purpose, other than to get stuck in carpet?

But what we are actually now seeing is the devastating effects of our servos having insufficient torque.  Rosie is unable to recover, for example, when her arm is totally collapsed underneath her body.  Not even that, she's struggling to raise her arms (and more relevantly, the claws) to her side to stop them getting in the way of her forward push... the main reason why she's not propelling forwards very fast.  Sometimes, even lifting her arms or legs against the friction of the horrendous (unnamed) hotel carpet is too much.  All in all, her chances of standing up upright, and walking, is close to 0 in this current configuration.

But we haven't given up hope.  As we stated earlier, there really is a lot of work to do in the coming weeks.  We're going to have to get our hands on some meatier servos.  We're also likely to need to revisit the 3D design to make our components lighter, and start to 3D print those replacement parts.  We might even need to investigate a way of using a 6V power supply to get better performance from the HiTEC servos, without upsetting current draw.

But - at least - Rosie is starting to look like a robot capable of doing something.  Even if that something for now is to crawl across the floor (badly) like a wounded robot extra from the Terminator 8.  All newborn robots have to start their journey somewhere though right?

Go and see the doc:

We're continuing to use the Adafruit 16-channel PWM / Servo HAT, for which the documentation is here:

Comments

Popular posts from this blog

Tea minus 30

We're fast approaching Christmas time.  And if robots were to make one simple observation about the human species during the Christmas festivities, it's that they watch a lot of TV.  A LOT.  Often, accompanied by an inappropriate amount of greenhouse gas-producing food.  Stuff you don't normally eat during the remainder of the year - for good reason.

And most so-called shows on TV are boring to robots like Rosie.  After all, why watch a minor subspecies of the human race - celebrities - stumble awkwardly around the dance floor, dressed like a faulty, sparking circuit board?  Such branch of entertainment doesn't require robots to engage any of their proud circuitry.  Their processors remain idle.  Memory under-utilised.

But if robots are to be part of people's homes (and blend in), they need to look at least a little interested in some of this irrational nonsense.  Nobody likes a party pooper.  A killjoy.  And this is where a certain subgenre of TV entertainment co…

Beam me up, Rosie!

How do you get from A to B?

You can't, as As and Bs are just letters in the alphabet. But if A is your house, and B is a meerkat village at your favourite safari park, you'd probably use a device equipped with GPS.  Not to be confused with UPS, who will deliver you your chosen meerkat through the post. And why on Earth would Rosie Patrol need one? Precisely, it's because she is on Earth that she needs one. Because our planet is rather big. Big enough to get lost in. And we don't want to lose our friendly plastic boxes on wheels. And maybe, eventually when she's clever enough, she'll go and defeat baddies on her own. And return home afterwards for a well deserved Earl Grey tea.

Besides, why wouldn't we want to add another three letter acronym to Rosie Patrol's repertoire?
All superheroes need:One Raspberry Pi 3, running Raspbian OSComputer from which you are connecting to the Raspberry Pi Probably the most important bit: a GPS receiver thingmy. …

Raspberry bye, hello

Let us make this very clear from the onset of this exotic excursion.

This is not a case of Raspberry Bye. Our relationship with our favourite single-board computer hasn't at all soured. In fact, we've become wholly inseparable. There's been many months of undeniable fun that's been had with the venerable computer strangely named after an edible fruit. To the extent that our relationship requires a healthy break. And quite frankly, our Pis require a well earned summer holiday to do whatever it is that robots and computers do during their time off. Crash. Burn. Refuel (with questionable toxins). Not at all unlike their human counterparts. And ultimately, it would be nice if they could return to a brand new, adorable pet waiting for them at home, a likeable little companion that they can just get along with.

Well, we visited a pet shop, but couldn't find anything as small and smart as this adorable pup we stumbled up on while searching the Internet for a new, miniat…