Saturday, July 31, 2021
Home » Flowstone Workshop » Flowstone Workshop 10 Part 1

Flowstone Workshop 10 Part 1

Flowstone-HeaderHow To Really Program A Humanoid Robot – PART I

FLOWSTONE WORKSHOP 10-1Welcome to the FlowStone Workshop number 10, where we give a beginners guide to computer programming using the FlowStone graphical programming language. In this and the next issue we are going to look at programming robotic Humanoids. For ‘Part 1’ in this issue we will be looking at how these robots are currently programmed and what options are available for us to improve our humanoid, terminator style! (or is it GangNam Style?)


Quite simply, a humanoid is a robot with arms and legs that looks a bit like a human. They can be simple or very complex; some have gyros to help them balance, and some can see, speak, and listen. Some have just a few joints and the most sophisticated can be five feet tall and have hundreds of joints!


For our Humanoid programming exercise we are first going to look at the different ways Humanoids are currently programmed and then see if we can come up with some new solutions to improve the experience and create more learning opportunities. After all, in my opinion, the whole point of programming robotics at this level is as a learning exercise, and it should be great fun.

For this article we have been working with RobotShop who have kindly loaned us various humanoids to play with so we can make some comparisons. The robots we will be looking at are:

HOVIS Eco Humanoid Robot–$990.00 USD*

BIOLOID Premium Robot Kit –$1199.00 USD*

DARwIn-OP Advanced Humanoid–$12,000.00 USD*

*Prices valid as we go to press

As you can see there is quite a price range in this sector, so you need to know that your Humanoid is going to deliver before you decide to buy. Hopefully this article will not only identify the differences but also show you some new and exciting ways you can control your robot!

The Hovis Eco Kit ready to build.


DOF stands for degrees of freedom and is used frequently when describing robots. This is no more than the number of joints that move, each joint is one degree of freedom. So a typical Humanoid robot will have around 20 DOF or 20 servos.


The Central Processing Unit (CPU) is the robot’s brain, this is what controls servo movement and it makes any decisions. Some robots have an embedded microprocessor chip that can make decisions and others have a full blown PC strapped to their back; bigger humanoids often have a laptop nested in their torso somewhere. For example the DARwin OP has a FitPC, built in, that is an Intel Atom based embedded PC which can run Windows XP, Windows Embedded, Linux etc.

The ‘FitPC’ used for robotics.


There are various types of servos available now for robotics. Before, nearly all of the servos came from RC cars and planes and could burn out if they were stalled for too long. The new generation of robotics servos are a huge advancement and can be programmed to shut down if the torque limits are exceeded, thus saving the servo. In my experience this is vital for the more complex robots as we all too frequently make programming mistakes and don’t realize this until you smell burning plastic! All of the humanoids we are looking at use the new generation of intelligent servos.

The Hovis from Dongbu Robot uses the Herkulex Servos with 24Kg/cm @7v holding Torque; the Bioloid from Robotis uses the Dynamixel AX 12A servo’s with a holding Torque of 12Kg/cm@ 7v; and the DARwin OP, also from Robotis, uses the Dynamixel MX-28 servos with a holding Torque of 25.5Kg/cm @12v.


Finally the batteries, since there are so many servos (20 or more) plus a CPU that requires power, you are going to need equally special batteries. Fortunately the advances in battery technology have been huge. Today’s Lithium Polymer (LiPo) batteries can deliver huge currents yet are quite light in weight. Again all of the robots tested use Lithium batteries, but battery life is certainly a consideration.


Herkulex Servo vs. Dynamixel Servo

Before we look at the ways we can program our bots using FlowStone let’s first see what the manufacturers have done to give us access to programming the humanoid CPU? Sequencing, sequencing and more sequencing. Programming humanoid robots is incredibly complex and difficult, so most manufacturers provide some form of sequencing to get you going. These are simply pre-made sequences of movement like walking, turning, crouching, etc. You can see why they have done this as it brings the humanoids to life and allows instant control of your new humanoid robot. However, I believe this is the death of robotics – it’s almost like a pre-set demo mode. Imagine looking at a computer game demo looping in a store. You think, great, that looks really cool, I’ll buy the game, but when you get it home all you have is the in-store demo! Not what you were expecting and to a large extent that is what pre-made robotics sequencing is; you can only do what they give you with not much room for creativity. Instead, robotics should be fun and inspire your imagination and creativity.

Bioloid kneeling – ok on a flat surface

Some of the robot kits come with remote controls that allow you to sequence your robot remotely but it is still limited by the sequences available, a bit like a remote control car. One of the main problems with Humanoids is that unlike a remote controlled car they are not so stable on two feet, so changes in the terrain usu- ally result in it lying on its back. Since the sequences are pre-set there usually isn’t any attempt to balance and recover.

MY 88 note controller keyboard / Robot Controller.

Some platforms like the DARwin OP are totally open (hence ‘OP’ for Open Platform). This means that you can pro- gram your robot to do exactly what you like. The only downside is that you probably need a degree in Math and Robotics to do this! What we need is something in the middle – open enough to be cre- ative and developed enough to make it accessible to students and enthusiasts.


Many of the Humanoids allow some form of programming using Forward Kinematics. Forward Kinematics is the opposite of Inverse Kinematics (IK) (IK was covered in the last issue). I would characterize this, for easy understanding, as fol- lows: IK is moving joints using Math, and Forward Kinematics is moving joints manually, not with Math.

This usually takes the form of your positioning your robot in a limp state and recording its position as a key frame of a sequence, then moving it again to a new position and recording that key frame.

It’s a bit like stop motion used for movie animations. Once completed you will have a totally new sequence of motion that you have created, which is great, but, again, it’s still a sequence with no intelligence or control.


Telemetry is the two-way wireless communication with your robot; more than a remote control that is one way, telemetry allows you to take total control. Using telemetry it should be possible to control your robot and react to its state in real-time, so that it can balance, and more. My plan: rather than use the power of an on- board CPU, why not use two-way wireless communication so that we can use a full power PC to control our Robot!


The Bioloid & Hovis Eco Controllers.

Most robot kits come with some form of remote controller, the Bioloid has a small controller a bit like a games controller and the Hovis has a remote control more like a TV remote. While these serve a purpose for controlling the pre-programmed sequences, if we are going to control our robot with a little more finesse we need more buttons and some sensitivity control. One idea I’ve had is to use a MIDI music keyboard to control my robot. It just so happens I have a weighted 88 note MIDI controller keyboard in the corner of my office, so I’ll look at using this to give me the control I need. FlowStone has lots of MIDI modules built in, so it’s just a case of connecting the keyboard up and directing them to the control functions required. My plan is to use Octaves to control specific functions, for example the same note in different octaves could control the same limb but with a different function. i.e. C1 = Punch, C2 = Wave, C3 = Come On (matrix Style), etc. The velocity sensitivity and after- touch could be used to control the speed of the movement.

FlowStone reading the MIDI events from keyboard.


Having played around with the robots for a while now it appears that there is a big issue with the size of the feet. On anything other than a flat surface these robots easily lose their balance and fall over. So, as a first step I would look at adding some training shoes, i.e., Bigger Feet! I would also look at adding in some more human features, we balance using a combination of our toes (pressure sensors), our inner ear (Gyro), and our eyes (webcam). Adding the hard- ware equivalent of these, like pressure sensors on the bottom of the feet, a 3-axis Gyro and a webcam with some vision processing, would give you some idea if your robot is about to fall over and offer some opportunity for evasive maneuvers. If a Segway can balance, then so should your robot!

FLOWSTONE WORKSHOP 10-11The DARwin OP already has many of these features built in and hence it’s a lot more stable out of the box. There is also a Gyro option for the Bioloid and Hovis, and there is more here than just telling if it’s fallen over or not, so that it can get back up…


So here’s the plan: we have seen that most humanoids are currently controlled using sequences and we want to do more than this and take control. Some robots have gyros and accelerometers to help with balance and we can add our own, maybe some Phidgets boards like the Phidgets 3-axis Gyro and some pres- sure sensors, and more. We can use wireless telemetry (Bluetooth, Wifi, ZigBee, etc.) to control our robot remotely from a PC to make programming much easier. We want to use Inverse Kinematics not forward Kinematics to get some real control.

So in ‘Part 2’ we will be building a HOVIS Eco Humanoid Robot from scratch adding some pimped up sensors and will program it using the FlowStone programming language with wireless telemetry and a MIDI keyboard to bring it alive!