## 3 Motion Mapping
### Construction of Human Skeleton Model and Joint Mapping: GA-LVVJ  
The GA-LVVJ method is proposed for mapping human postures to a robot by building the human skeleton model and extracting joint angles. Without loss of generality, GA-LVVJ includes the following steps:  
* Construction of human skeleton link vectors in accordance with the 3D skeleton points;  
Figure 1: The framework of the proposed whole-body imitation system. * Construction of human virtual joints in accordance with the human skeleton link vectors and robot joints;
* Establishment of local link frames for the human skeleton model with reference to the virtual joints;
* Calculation of the joint angles of the human skeleton model using the local link frames and link vectors;
* Application of the joint angles of the human skeleton model to the robot. In our system, a Kinect II RGB-D camera is used to capture human motions. To extract 3D skeleton points of the human body, which include points corresponding to the end effectors and joints from the body frames acquired by Kinect, we used the API provided by the Kinect for Windows SDK 2.0 [49], which is a basic library for the Kinect sensor. The names and serial numbers of these skeleton points used in this paper are shown in Figure 2. Thereafter, a complete skeleton model of the human body, referred as the human skeleton model in this paper, will be built based on these points, the process of which will be described detailedly in this section. The maximum errors in displacement of the upper body skeleton points obtained from Kinect I, measured in [50], is lower than 38 mm. In [51], Kinect II was proved to have better performances than Kinect I. Generally, a wearable motion capture system is more accurate than a visual motion capture system, but the visual motion capture systems have their merits and are widely used. Furthermore, the Kinect II sensor performs well in our hands-on experiments, so the human skeleton model constructed from the skeleton points acquired by Kinect II is considered to well represent the human demonstrator. We can obtain the link vectors \(\vec{V}_{i;j}\) formed by pairs of skeleton points. The subscript \(i\) denotes the number of the skeleton point at which the vector begins, and \(j\) denotes the number of the skeleton point to which the vector points. It is worth pointing out that the proposed GA-LVVJ method is a general mapping method which can be applied to most types of humanoid robots. Without loss of generality, the NAO robot is used as an example here. Figure 3 depicts the joints and corresponding joint angles of NAO. Figure 2: Names and numbers of skeleton points captured by the Kinect II. In this paper, if two joints or two links are on the same limb chain, the one closer to the torso is defined as the mother joint or mother link, whereas the other one is defined as the child joint or child link. A link frame is attached to each link and indicates the link's position and orientation, the link frames of NAO are shown in Figure 4. The origin of a link frame is located at the intersection between the link itself and its child link or at the center of mass of a link. Figure 4: Joint structures and link frames of the robot and the human skeleton model. Figure 3: Upper- and lower-limb joints and joint angles of the NAO robot. In order to map human postures to the robot through a geometrical analysis of the joint angles, the joint structures and each link frame of the human skeleton model should be established. The link frames of the human skeleton model serve as the references for the calculation of the joint angles for mapping. In order to construct them, virtual joints of the human skeleton model similar to those of the robot are established, as shown in Figure 4, regardless of what the real joint structures of the human body are. The axis of each joint is set collinear with or vertical to the vector of the mother link in the initial posture. Then, the link frames should be set in accordance with the axes of the joints at each intersection between a link and its child link.