Abstract
1. Introduction
The kinematic modeling of humanoid robots is in fact a more difficult problem when compared to the classical industry manipulators, due to the locomotion that these robots are expected to perform while maintaining, at the same time, their postural stability. It is a formidable computational challenge, especially for real-time applications, due to the high number of degrees of freedom, the complex kinematics configurations that may lead to non-analytical solutions and the constantly changing point of support that is not rigidly attached to the floor [1]. In order to control the motion of these humanoid robots, specific trajectories in task space are required; that is, a desired sequence of attitudes for the feet and the body are required for accomplishing the desired stable locomotion task.
In the context of rigid multi-body systems, as is the case of robots, task space is different from joint space where motor commands are issued. Hence, movement planning requires either a preset sequence generated with
It is known that the IK problem cannot be solved by means of systematic processes as it is highly dependent on the robot's kinematic structure, and that it also either yields to infinite, multiple, one or none solutions. Only in simple cases, as in the case when the kinematic chain has no more than 6 degrees-of-freedom (dof) and three joint axes intersect, the IK problem for position and orientation can be decoupled, as stated by the so popular method proposed by Pieper in his PhD thesis [3, 4]. This is the case of many industrial manipulators and some of the most popular humanoid robots, i.e. ASIMO of Honda, HRP-2 of AIST and Kawada Industries or HOAP-2 of Fujitsu [5]. However, even for singularity-free mechanisms, the presence of offsets prevents this fact. Therefore, closed-form solutions are difficult, if not impossible, to find [6]. Or if they exist, they are very specific for a given kinematic chain [7, 8, 9].
For this reason, numerical methods have been commonly used to solve the IK problem, by using the pseudoinverse of the Jacobian (or a modification of it) [2, 10], the Cyclic Coordinate Descent (CCD) method [11, 12] or a procedure based on iterative triangulation [13, 14]. Some authors also use neural approaches [15, 16] or computational approaches based on conformal geometric algebra [17] or symbolic preprocessing [18]. However, these ones cannot be as efficient as the analytical ones, as they may require several iterations (not known
This makes it even more difficult to develop real-time applications, as these ones require fast and efficient algorithms for computing the gait patterns required to achieve dynamical stability. Therefore, finding an analytical solution to the IK problem, or a solution that takes a minimum of iterations, makes it possible to develop controllers able to compensate dynamical effects by changing motion patterns in real-time.
2. SILO2 Humanoid Robot
SILO2 stands for Locomotion System based on two limbs. This humanoid robot belongs to a family of walking prototypes that have been developed in the Department of Automatic Control at the Institute of Industrial Automation in Madrid, Spain [22].
This one in particular is currently on development and it is planned to be upgraded until getting a complete humanoid kinematic structure of 23 dof. However, in the current stage only the locomotor unit has been entirely developed (Figure 1).

SILO2 Humanoid Robot [23]
As can be seen on this picture, this robot possesses 6 dof per leg: 3 at the hip, 1 at the knee, and 2 at the ankle. That is, each leg's mechanism is determined, so that each foot (or the body, depending on the basement link's election) can reach any desired attitude inside its workspace, defined by geometrical and mechanical constraints.
Joints are driven with two different types of actuators, as can be also noticed: Standard DC servomotors placed at the joint axis and non-linear transmission ratio actuators, used to improve the mechanical design by decreasing the energy consumption. The latter ones, patented as SMART (
Actually, three joints on each leg are driven by SMART actuators: One at the hip (abduction / adduction), one at the knee (flexion / extension), and one at the toe (flexion / extension), as can be seen on Figure 2a, 2b, and 2c.

SMART actuators at (a) the hip, (b) the knee, (c) the ankle [23]
3. Humanoid Forward Kinematics
3.1. Kinematic diagram
In order to build the kinematic diagram of this robot it is worth to notice that the presence of SMART actuators does not add complexity to the kinematic model, as could be thought in a first sight. The four-bar linkages are just transmission mechanisms placed between the servomotors and the actual joints, such that the joint variable is indeed a function of the corresponding servomotor's angle.
Keeping this in mind, the kinematic structure of this robot can be represented with the diagram shown in Figure 3. In this diagram, joints are represented by cylinder-shaped icons, whose arrow represents its positive sense of motion. Each joint is labeled according to the following nomenclature:

SILO2's kinematic diagram
Joint variables are labeled as
Links follow a similar nomenclature,
Link dimensions are displayed along with the corresponding constant denoted by
The body frame
At the reference attitude
Where
3.2. Screw motion
Forward kinematics can be described in a more geometric way if a screw motion is associated to every joint [24]. A screw motion represents a rotation by an amount of

Generalized Screw Motion [24]
In this way, if a point
Where
By representing (3) in homogeneous coordinates, we have
The transformation
In this way, a screw motion associated to a rotational joint
3.3. Product of exponentials formula
The transformation
Suppose that we fix every joint except the last one
In the same way, we can fix every joint except
By composition, after taking into account every joint in the corresponding kinematic chain the foot configuration becomes
The expression in (9) is called the
3.4. Forward Kinematics parameters
As can be seen from expressions (9) and (6), in order to calculate the forward kinematics it is necessary to specify each exponential matrix
From the kinematic diagram shown in Figure 3, each axis direction is defined as
And a point on each axis is proposed as
3.5. Orientation coordinates
Consider the representation of the humanoid's foot (and its frame) as shown in Figure 5. The chosen orientation coordinates are three angles, taken as follows: First, consider a rotation of

Foot's frame definition
Such that, from an arbitrary rotation matrix these rotation coordinates can be calculated as
4. Humanoid Inverse Kinematics
By looking at the kinematic diagram shown in Figure 3, it is possible to notice that the implementation of the humanoid's hip is not
For this reason, a hybrid approach is proposed. It consists on first finding an approximate analytical “solution” for the inverse kinematics problem by neglecting the presence of the offset at the hip, as it is small when compared to the actual size of the robot, and then to use this “solution” as the initial condition of a numerical method, so that the number of iterations needed be drastically reduced.
This idea is similar to the one proposed in [6]. However, the last one only deals with the case of a double universal joint placed at the wrist. On the other hand, the following procedure is not restricted to any particular kinematic configuration, as long as the offset is small compared to the size of the robot.
4.1. Approximate analytical “solution”
First, suppose that the three axes at the hip intersect in just one point, represented by the actual intersection of the first two axes. Likewise, suppose that the length of the third link is not
By doing this, a purely analytical “solution” exists, so that it can be found by using the so-called Paden-Kahan methodology [24], which is based on the product of exponentials formula shown in (9) [1, 25].
The equation to be solved is
To do that, let us propose the following four points based on the reference attitude of the robot shown in Figure 3:
A point
A point
A point
A point
Having done this, the joint variables can be calculated as it is explained in the following [24]:
In the same way, given that we have a similar situation at the hip
Equation (32) can be rewritten as
Now then, recalling that a rigid body transformation preserves distances between points, the joint variable
Now then, as
So that, both
Remember that this point is located on the axis of
Now then, given that
In such a way that
Now then, as all the other angles are already known, it is possible to define
In such a way that
It is worth to remark that this procedure may lead to a maximum of eight different joint configurations, due to the multiple solutions of P-K-2 and P-K-3 for equations (35), (39), and (42) (each one has two different solutions). However, it is possible to get rid of four among these ones, as it is natural to pre-select the knee-front configuration, and then to notice that the remaining four are not all valid ones, as not every constraint is considered in every calculation (the procedure required to get rid of information on constraints in order to apply the Paden-Kahan sub-problems).
By choosing the knee-front configuration only two solutions are valid, which can be selected by calculating the four candidate joint configurations and measuring the attitude's error generated by each one. Ideally, the two valid ones must lead to a zero attitude error; but, as this method is based on an approximation, only a minimum error may be achieved. In this way, the joint configuration which lead to lowest error is then selected as the “solution” of the problem.
4.2. Numerical refining
The approximate “solution” obtained by supposing a spherical hip generates significant errors that can not be neglected when dealing with gait generation. However, these ones are small compared to the actual size of the robot. This fact can be depicted in Figure 6, where both the real kinematic structure and the supposed one are shown having the same joint values.

Real kinematic structure (lighter one) vs. supposed one (darker one)
As can be seen, for
A numerical algorithm for this problem basically increments (or decrements) the joint configuration
Where
One way of doing this is using the Moore-Penrose's pseudoinverse of the Jacobian
Where
The pseudoinverse provides the “best fit” solution to a system of linear equations that lacks of unique solution. However, it is prone to be unstable in the neighborhood of singularities, as the singular values of
The Levenberg-Marquardt's method (also known as the damped least squares' method) improves the pseudoinvere's behavior near the singularities, resulting in a stable way for computing
The reason for such improvement is because the singular values
Where
So, given that
In order to apply the Levenberg-Marquardt's method it is first necessary to define the error vector
Recall that the Jacobian relates differential increments in position and orientation of the end-effector to the differential increments of joint variables. Position's differential increments are effectively vectors with differential magnitude pointing in the movement's direction. In the other hand, orientation's ones are also vectors with differential magnitude, but pointing in the direction of the axis of rotation (unitary angular velocity vector).
Numerical algorithms deal with finite increments (errors), instead of differential ones (as an approximation). In this way, position and orientation errors are vectors with a finite magnitude, that point in the direction of the increment in the case of the former ones or in the direction of the axis of rotation in the case of latter ones.
So, whereas position error's calculation is straightfor-ward
In order to obtain the desired orientation error from the chosen orientation coordinates error, it is necessary first to obtain an expression that relates the rate of change of those coordinates
Consider the matrix in (22), the correspondent skew-symmetric matrix of
From which the vector Ω can be extracted, so that
Having done this, the orientation error can be obtained by arbitrarily replacing the orientation coordinates rate of change with the corresponding error to build
4.3. Workspace
Let us consider two types of workspace: the ideal one,
By having an analytical algorithm for the IK problem, it is possible to check
In this case, an approximate workspace can be found by noticing that only the solution for P-K-3 considers a restricted-domain function, represented by the arccosine, arccos(.):
5. Simulation results
In order to visually validate the algorithm proposed in this paper, a kinematic simulator was developed under the name of ARMS (

ARMS Kinematic Simulator
This simulator uses a VRML (
For testing purposes a series of attitudes were specified for each foot, by considering the body as the base link. Some attitudes were proposed as lying inside the real workspace and others, outside, or as lying only inside the ideal workspace but not inside the real one, in order to test the algorithm's behavior. One example of each case is reported, along with some screenshots of the corresponding results.
5.1. Attitude inside the real workspace
Figure 8 shows the attitude reached by the model of the robot (frontal and sagittal views) after specifying that the right foot's sole should be located 75 cm below with respect to the pelvis and 20 cm just in front of it, while maintaining the reference attitude's distance between this foot and the sagittal plane of symmetry (17.3 cm). The right foot's orientation is also specified with a

Resulting configuration after specifying an attitude inside the real workspace
As can be seen with the aid of superimposed labels and the screenshot of the specified attitude and the obtained one (Figure 9) the virtual robot not only reaches the desired goal, but it can be achieved with only 2 iterations.

Control and feedback panels associated With Figure 8
5.2. Attitude inside the ideal workspace, but outside the real one defined by mechanical constraints
Figure 10 shows again an attitude reached by the model of the robot. In this case, the right foot's sole was specified to be located 75 cm below with respect to the pelvis and 20 cm just in front of it as before, but now it is also desired a distance of 30 cm between this foot and the sagittal plane of symmetry. In the other hand, the left foot's location is specified to be a the same height but 20 cm behind the pelvis, at a distance of 5 cm from the sagittal plane of symmetry. Both feet are expected to maintain the reference orientation; that is, 0° for all the orientation coordinates.

Resulting configuration after specifying an attitude inside the ideal workspace, but outside the real one
However, the desired attitude cannot be reached as it can be confirmed by noticing that the right foot's sole is a little below of the desired one (marked with the aid of superimposed labels), and because the orientation of the left foot is not the reference one. This can also be confirmed in Figure 11, where the difference between the desired attitude and the obtained one is noticeable, due to the saturation of joint's values. The process needed 3 iterations in this case.

Control and feedback panels associated with Figure 10
5.3. Attitude outside the ideal workspace
Consider now the case when a desired attitude is outside the ideal workspace, represented by the case when the feet are specified to reach a distance impossible to achieve, even at full extension of the legs. In this case the kinematic simulator performs no action at all, as indicated by the label “

The attitude is not inside the ideal workspace
6. Evaluation
The performance of the proposed hybrid algorithm was evaluated with respect to the number of iterations needed to accomplish a desired precision by means of statistical comparison with a purely numerical solution, as well as with respect to the mean time required for performing the requested computations in both cases, as a way to measure the achieved improvement of performance.
This evaluation was carried out over different sets of data consisting on 1000 random 6-tuples of joint variables
Each 6-tuple, along with the leg's choice, was used to obtain the corresponding foot's attitude by means of applying the forward kinematics algorithm. The resulting attitude was then taken as the input of the IK algorithm. In this way, it was assured that this input would lead to a solution, which was already known for testing and comparison purposes.
When testing the proposed algorithm, the foot's attitude was used as the input of the approximate analytical algorithm in such a way that the approximate “solution” was taken as the initial condition of the Levenberg-Marquardt method.
When testing the purely numerical solution, the initial condition of the Levenberg-Marquardt method was set arbitrarily as
In both cases, an error vector magnitude less than 0.1 or a maximum of 1500 iterations were used as stop conditions. The maximum value for the parameter
This evaluation consisted on two different statistical populations described as follows:
The first one considered randomly generated attitudes inside the ideal workspace, but not necessarily inside the real one. These ones were obtained by constraining the random joint variables' values to −90° and 90°.
The second one considered randomly generated attitudes only inside the real workspace. In this case, the joint variables' values were constrained to the actual joint limits of the robot (Table 1).
Range of motion of each joint of SILO2 [23]
This evaluation tests were implemented in Matlab R2012a, and performed on a Laptop Dell XPS L702X, which has an Intel(R) Core(TM) i7-2670QM CPU @ 2.20 GHz, 8 GB in RAM, and a 64-bit Operating System (Windows 7 Utimate).
6.1. Random attitudes generated inside the ideal workspace, but not necessarily inside the real one
Figure 13a shows the histogram generated by the purely numerical approach, whereas Figure 13b shows the one generated by the proposed hybrid algorithm, obtained by constraining the random joint variables' values to −90° and 90°. In both cases, the histogram's range is set to 1 – 50 or more iterations (samples over 50 iterations are accumulated over 50 in the histogram).

Computation efficiency comparison between (a) a purely numerical approach and (b) the proposed hybrid method, considering randomly-generated attitudes inside the
Table 2 also shows some numerical data associated with the evaluation; that is, the percentage of samples that succeeded to converge (within the specified precision) in 1500, 50, and 10 iterations, as well as the average error in position and orientation between the desired attitude and the obtained one (taking into account only the samples that succeeded to converge) and the mean time required per sample in both cases.
Performance comparison of both algorithms considering randomly-generated attitudes inside the ideal workspace
As can be seen, the proposed algorithm shows an outstanding performance over the purely numerical one used in [19] or [21], as more than 91.4% of the samples are able to converge in 10 or less iterations, in contrast with the latter one which may need 50, 100, 1000 or more iterations to converge. In addition, the proposed algorithm is able to achieve a lower average error (with respect to position or orientation) while being almost 4 times faster.
6.2. Random attitudes generated inside the real workspace only
By taking into account the actual joint limits of the robot, both algorithms were compared once again. Figure 14a shows the histogram generated by the purely numerical approach, whereas Figure 14b shows the one generated by the proposed hybrid algorithm. The histogram's range is set again to 1 – 50 or more iterations. Table 2 shows the corresponding numerical data associated with this evaluation.

Computation efficiency comparison between (a) a purely numerical approach and (b) the proposed hybrid method, considering randomly-generated attitudes inside the
Surprisingly, the proposed algorithm not only shows an outstanding performance over the purely numerical one, but a very good one feasible for implementation on real-time, as 99.5% of the samples converged in less than 10 iterations (in fact, 97.2% did it within 2 iterations). Notice that the average error is also lower than the previous case, and that the hybrid algorithm performs almost 5 times faster.
Performance comparison of both algorithms considering randomly-generated attitudes inside the real workspace
7. Conclusions
This paper proposed a semi-analytical algorithm for computing the IK of humanoid robots whose construction shows a small but non negligible offset at the hip (compared to its actual height) which prevents any purely analytical solution to be developed.
As a case of study, a robot with a non-typical kinematic structure, as it is the SILO2 prototype, is analyzed. However, the algorithm can be applied to any structure that possesses negligible offsets, so that an approximate analytical “solution” can be found after neglecting them, and then be used as the initial condition of a stable numerical method, ensuring in this way that the number of iterations needed will be drastically reduced (compared with the required ones if an arbitrary initial condition is proposed).
Besides that, as the approximate analytical “solution” is in the neighborhood of the desired target in the joint configuration space, it will be more likely that the numerical method reaches the desired solution, as the right minima is very near to the initial condition. So, this method will be as efficient as desired so long as the concerned offsets are small enough. This fact was also evaluated, as this algorithm needed only very few iterations:
Less than 10 in most of the cases, or a maximum of 2 if the desired attitudes belonged to a typical gait; that is, attitudes that do not require big joint ranges to be performed. However, even non-typical motions can be achieved in an affordable computation time.
Concerning to the SILO2 robot, this method effectively solved its IK problem, so that it was possible to calculate precise gaits in real-time, as they were required by the control laws that had been previously developed by the team work at the Institute of Industrial Automation. Furthermore, the kinematic simulator developed during this work represented a useful tool for testing desired attitudes on a virtual model before doing it on the real prototype, avoiding in this way failures that may cause severe damages to the robot if it falls down. The simulator was very useful to test attitudes in this way, as many of them cannot be realized due to mechanical constraints, even when they were feasible during a certain gait. By recognizing these attitudes, the gait could be modified until getting a realizable and useful one, or they may also be used to provide guidelines for modifying the SMART actuators, by redesigning the size of the crank and the connecting road in every four-link mechanism, in order to improve the design of the humanoid.
