Stroke Motion Learning for a Humanoid Robotic Ping-Pong Player Using a Novel Motion Capture System

Problem statement: Human ping-pong players determine the stroke trajectory according to their experience before the ball enters their court. However, to enable a humanoid robot to select the appropriate stroke motion based on skills learned from 3D motion, important patterns must be generated to simplify the complex 3D motion. Approach: This study developed an effective strategy for teaching ping-pong skills to a humanoid robot. An optical/inertial motion-capture system that retrieves the stroke motion was constructed, along with the retrieved stroke motion trajectories analyzed to obtain the desired stroke patterns of the robot. Results: A motion capture system was implemented mainly to orient the robot on the stroke motion trajectory. This system was applied directly to a ping-pong game between a human player and a pitching machine to enable the robot to learn backhand strokes through human demonstration. The ball was continuously struck to the opponent so that it hit the anticipated region on the opposite side of the court while the pitching machine served the ball. The data were then classified using the proposed stopping detector and then processed by Principal Components Analysis (PCA) to generate the stroke patterns after collecting 50 datasets for stroke trajectories. Conclusion: The right arm of the humanoid robot was successfully instructed to perform the actual ping-pong stroke using the generated trajectory.


INTRODUCTION
In the recent decade, robot technology has extended from manufacturing to daily life activities. For instance, robots that assist humans in everyday environments such as offices, homes and hospitals are highly desired. To meet these demands, wheeled humanoid service robots have been developed in recent years. However, demand for multi-functional humanoid robots is also increasing. This study attempts to equip a humanoid robot with the ability to determine the appropriate stroke motion trajectory in a robotic pingpong game.
An important work in robotic ping-pong application studies is Acosta et al. (2003), who devised a ping-pong playing robot with 5 Degrees Of Freedom (DOF). The robot drives two paddles using RC servos to strike the ball; the ball is located by a camera in conjunction with an algorithm based on the detection of the ball and the shadow it projects on the table. However, the system is limited in low response and the inability to apply it directly to a standard ping-pong table. Matsushima et al. (2005) later constructed a planar robot with 4 DOF and mounted it on a ping-pong table. The robot could learn from practice and could continuously increase its skill by applying locally weighted regression. However, the robot shape differs from that of a human and the system could not be taught directly by human skills. Humans decide which posture is the most effective for striking before the ball arrives. Given the difficulty in developing a feasible algorithm for achieving such behavior, exactly how humans play ping-pong must be understood before teaching a robot. Bentivegna and Atkeson (2003) proposed a method allowing a robot to learn task primitives from observations and applied it to a DB robot in air hockey and marble maze environments. The method orients the robot to generate the corresponding planar motion according to the planar environment. However, enabling a humanoid robot to select the appropriate stroke motion based on skills learned from 3D motion requires generating important patterns to simplify the complex 3D motion.
Motion capture systems employ several available tracking technologies, including mechanical, electromagnetic, acoustic, optical and inertial/magnetic tracking (Aggarwal and Cai, 1999;Wang et al., 2003). For ping-pong paddle tracking, researchers have applied optical tracking in virtual-reality games (Kim et al., 2007;Rusdorf et al., 2007) and have acquired smooth motion trajectories using commercial motion capture devices, e.g., Vicon. However, such devices are prohibitively expensive and have some limitations during implementation.
Based on the above discussion, this study develops a device to directly teach ping-pong skills to a humanoid robot since the anthropomorphic nature of the robot enables direct orientation using human skills. This study presents a novel optical/inertial motioncapture system that integrates inertial tracking with inexpensive optical tracking to retrieve motion data and to elucidate human ping-pong motions. The data are then filtered/modified using a fusion mechanism proposed by Roetenberg et al. (2007). To analyze the data, a stopping detector based on Gaussian probability density functions (pdfs) is developed to segment the motion data and to acquire important trajectory features through Principal Components Analysis (PCA). Finally, the stroke motion is performed directly using the obtained motion pattern in conjunction with the flight condition of the ball observed by the robot.

MATERIALS AND METHODS
Humanoid robotic ping-pong player: Figure 1 shows the developed humanoid robot and its stand-alone realtime control system (Tsay James and Lai, 2008). The robot consists of a head, arms, hands and a mobile base. The robot is equipped with a 7 DOF robotic binocular head, two 7 DOF arms and two 7 DOF hands in order to imitate the visual and ambidextrous behavior of a human. The hardware architecture of the real-time control system employs four image processing boards to process images acquired by four color cameras, eight motor boards and eight driver boards for controlling 40 servomotors and four processor boards for applying control strategies such as calculating robot dynamics. All data are transmitted quickly through the DP-SRAM. Based on the distributed allocation of computations for all algorithms, the sampling time for the servo controller is 0.005 sec while the sampling rate for image processing is 60 Hz for each video stream. Human ping-pong players must determine the stroke trajectory and forehand/backhand stroke according to their experience before the ball enters their court. The ball speed in a human ping-pong game is generally 4-5 m sec −1 and a smash can obtain ball speeds of 15-20 m sec −1 . Despite its anthropomorphic nature, the developed humanoid robot is not as dexterous or as fast as a human and cannot perform smashes. Therefore, the ball speed in this study is limited to 4-5 m sec −1 and the robot generates a paddle speed of 0.5 m sec −1 to return the ball, as analyzed using motion capture system developed in this study. Given that the robot cannot quickly switch between forehand and backhand strokes, only the backhand stroke motion and teaching are considered.
Stroke motion capture of human and robot behavior teaching: Motion capture system: This study constructs an optical/inertial motion-capture system for acquiring the central position/orientation of the paddle during play in order to acquire the stroke motion trajectory of the paddle and to correctly orient the robot to perform the stroke motion in real time. An inertial measurement unit provides sensor data for 3-axis linear accelerations and 3-axis angular velocities. The optical tracking system minimizes the effects of ambient light by using infrared illuminators as active markers. Figure 2 shows the system architecture and coordinate relationships, in which the relationship between the robot and the motion capture system is elucidated based on the calibration pattern. In the proposed application, the motion capture system enables the robot to determine the appropriate stroke motion trajectory, allowing it to align the trajectory with the stereo-vision coordinate frame of the robot through the calibration pattern.
Infrared illuminators installed in the center of the paddle surface must affect the touch between the ball and the paddle surface. Therefore, in this study, three infrared illuminators are installed in a circumferential arrangement with the center of the paddle surface to obtain its actual motion trajectory without influencing play. Figure 2 shows that points o 1 , o 2 and o 3 are the installed positions of the active illuminated markers. The inertial measurement unit is then installed on the back of the paddle surface. Therefore, the correct position/orientation of the paddle center is obtained using a fusion filter (Roetenberg et al., 2007). The proposed architecture consists of the inertial measurement unit with a high sampling rate and the optical tracking system with a low sampling rate, as Fig. 3 shows. For inertial measurements, angular velocity ω S acquired from rate gyroscopes is integrated over time to obtain the change in orientation with respect to an initially known orientation (Bortz, 1971): where, P,I S Θ is the rotation matrix with respect to the base coordinate frame (P). Linear accelerometers are also used to measure acceleration a s and gravitational acceleration g s with respect to the sensor coordinate frame (S), which can be transformed to acceleration a P,I and gravitational acceleration g P,I with respect to the inertial base coordinate frame (I) by rotation matrix P S Θ : The integral of the acceleration a P,I gives the velocity V P,Iand the double integral gives the position P P,Iwith respect to the base coordinate frame (P) after removing the gravity component: where V 0 and P 0 are known values. For optical tracking, the feature points ( j j [u , v ]; j 1, ,6 = L ) of the three active illuminated markers in the image plane of the two infrared cameras are located and the 3D position ( O O O   1  2  3 p , p , p ) of three active illuminated markers is then reconstructed by stereo triangulation. Next, the position/orientation ( P,O P,O P ,Θ − − ) of the paddle center is calculated using geometric relationships. Finally, the measurement information is calibrated using the Kalman filter (Grewal and Andrews, 1993) to obtain an accurate position/orientation ( P ,Θ + + ) of the paddle center.
Otherwise, the calibrated linear/angular velocity ( V ,Θ + + & ) of the paddle center is also applied in the stopping detector.
Teaching the humanoid robot to play ping-pong: Given the difficulty in using mathematical equations to describe the desired stroke motion trajectory of the robot in space, the stroke motion trajectory must be obtained by using the motion capture system so that human motion can provide a reference for robot motion. However, only some stroke trajectories can be generated since it is impossible for humans to generate stroke trajectories for all possible stroke points. Consequently, the collected stroke trajectories for some stroke points cannot be directly applied to the robot because these stroke points may differ from those in an actual ping-pong game. Therefore, this study proposes a novel method of producing stroke patterns to orient the robot on the stroke motion.
First, a ball served by a pitching machine is struck continuously using a backhand stroke. The selected stroke points are in a region that the robot can strike. Given that all continuous stroke trajectories are recorded on the computer during play, the data are segmented and classified. Obtaining the breaking points in continuous data is extremely difficult due to the low but continuous velocity. Therefore, a stopping detector is used as a simple adaptive two-class classifier for segmenting the motion data into piece records. For the two-class classifier, a three dimensional feature vector is used, whose first component is the velocity magnitude at time t, second component is the velocity magnitude at time t-1 and third component is the magnitude difference between the velocity at time t and t-1: where, n denotes sample size. By assuming ω is a multivariate Gaussian density, a discriminant function can be expressed as: Once the Gaussian discriminant functions are obtained (two in the present case, one for the static situation and one for the dynamic situation), the decision process simply assigns data x to class ω i if: The correct breaking points are obtained using the stopping detector with Gaussian pdfs. Each piece record is quantified to have the same quantity. All quantified data are then presented in the following form: Where: k = The number of piece records n = The point number of each piece record Finally, a PCA is performed on these data to obtain the important feature points of a stroke motion trajectory. In a ping-pong player application for a humanoid robot, these feature points are chosen as the knot points of the motion trajectory for spline curve fitting. To perform the stroke motion, the desired stroke trajectory is implemented using the spline curve fitting based on the stroke pose of the robot arm and motion interval, which are obtained from the flight condition of the ball.

RESULTS AND DISCUSSION
Experimental verification: Figure 4 illustrates the constructed ping-pong paddle motion-capture system and the ping-pong environment, where a pitching machine was placed opposite the ping-pong player to serve the ball to the player. The motion capture system included two infrared cameras mounted on the ceiling for active marker capture; three infrared illuminators were installed around the paddle surface to serve as an active marker device. A gyro/accelerometer device attached to the back of the paddle surface provided inertial tracking. To verify the effectiveness of the constructed motion capture system, a human player holding the ping-pong paddle performed a backhand shadow stroke. Figure 5 summarizes the measurement results of the optical/inertial motion-capture system for a one-stroke motion trajectory. Despite the significant noise interference in the measurement results for the optical tracking and inertial tracking, a smooth low-noise motion trajectory was obtained using a Kalman filter.
In the learning stage, the motion capture system was applied directly to a ping-pong game between a human player and a pitching machine such that the robot could be trained to strike with backhand strokes through human demonstration. The ball was struck continuously so that it hit the anticipated region of the court on the opposing side while the pitching machine served the ball (Fig. 6). The data were then classified using the proposed stopping detector after collecting data for 50 stroke trajectories. The trivariate Gaussian distributions of the stopping detector could not be plotted since they required a fourth dimension. Figure 7 shows three univariate Gaussian distributions computed as parts of the trivariate Gaussian distribution for the static situation class and dynamic situation class. In Fig. 8, four groups of consecutive raw data show the variation in motion trajectory of the center of the paddle surface for four consecutive strokes. The four peaks in Fig. 8 reveal that each stroke motion persisted for 1-2 sec. The left of Fig. 9 depicts the paddle trajectories in 3D space, which were obtained from raw capture data for the four consecutive strokes.
Each group of raw data captured from one stroke motion was first compacted according to the stroke trajectory curvature. All reduced training data were then processed through PCA to achieve the feature points of a stroke motion. Finally, these feature points were selected as the knot points of each paddle trajectory for spline curve fitting according to the initial and final poses of the paddle in order to generate the stroke pattern for each stroke motion. The right of Fig. 9 shows the stroke patterns obtained for the four consecutive strokes.
In the application stage, the feature points obtained for the stroke motion were applied to the developed humanoid robot for the ping-pong stroke motion. A regular ping-pong paddle was mounted directly on the wrist of the robotic right arm. The right arm of the developed humanoid robot was then instructed to perform the actual ping-pong stroke using the generated trajectory based on the initial and stroke poses of the paddle and motion interval. The developed robot arm has a 7 DOF redundant structure. In this study, a Lagrangian network (Wang et al., 1999) was utilized to solve the inverse kinematics problem of this redundant arm with a modified weighting matrix, in which elements were adjusted based on the performance criteria for preventing joint limits and collision avoidance with robotic body. Figure 10 shows stills from a stroke motion video when a ball was served by a pitching machine.
This study on ping-pong stroke learning in humanoid robots provided the preliminary data needed to develop humanoid robots that can play ping-pong with a human opponent. The proposed motion capture system obtained a smooth low-noise motion trajectory from raw captured data using a Kalman filter, despite the significant noise interference in the measurement results for the optical tracking and inertial tracking. However, raw captured data from one stroke motion could be compacted according to the stroke trajectory curvature in order to reduce the computation time needed for the following PCA.

CONCLUSION
This study presented a motion capture system for teaching ping-pong skills to a humanoid robotic player. The anthropomorphic nature of the humanoid robot enabled direct orientation using human skills. Finally, a stroke pattern method was proposed to orient the robot on how to perform the actual ping-pong stroke in real time. As for future research, efforts are underway to develop an appropriate intelligent learning strategy for enhancing robotic skills by self learning. The ultimate objective is developing a humanoid robotic ping-pong player that can interact realistically with human players.

ACKNOWLEDGMENT
The researchers would like to thank the National Science Council of the Republic of China, for financially supporting this research under Contract No. NSC 94-2212-E-006-022.