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
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 built Rosie 2.0's body using 12 HiTEC servos, and got it to dance inside a cuddly teddy bear (obviously... why not?) using Python. Lots of 3D printing was involved to construct the frame, and we controlled the servos using an Adafruit 16-channel PWM / Servo HAT.
- We also updated her head, and attached two more HiTEC servos for the neck. Honestly... we're starting to sound like we have shares in the company*.
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
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.
Parameter | Help, what can I do? Quick! |
---|---|
Ď„ - Torque |
|
r - Distance |
|
F - Force |
|
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.
Remember our Adafruit 16-channel PWM / Servo HAT, and its library? It's time to use them once again.
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?
Comments
Post a Comment