FAST MODELING AND IDENTIFICATION OF ROBOT DYNAMICS USING THE LASSO
Cong Wang Dept. of Mechanical Engineering University of California Berkeley, California 94720 Email:
[email protected]
Xiaowen Yu Dept. of Mechanical Engineering University of California Berkeley, California 94720 Email:
[email protected]
ABSTRACT This paper presents an approach for fast modeling and identification of robot dynamics. By using a data-driven machine learning approach, the process is simplified considerably from the conventional analytical method. Regressor selection using the Lasso (l1 -norm penalized least squares regression) is used. The method is explained with a simple example of a two-link direct-drive robot. Further demonstration is given by applying the method to a three-link belt-driven robot. Promising result has been demonstrated.
INTRODUCTION The dynamic model of a robot is indispensable for many important control strategies such as torque feedforward control, sliding control, and disturbance observer. A dynamic model is a ˙ q, ¨ Z), where τ is the vector of function in the form of τ = g (q, q, torques applied by the motors, q is the vector of rotation angles of the motors, and Z consists of the mechanical parameters. The conventional method to model and identify robot dynamics involves the following steps [1, 2]: 1) Apply analytical mechanics, derive the dynamic model in the form of Lagrange’s equation of motion:
Masayoshi Tomizuka Dept. of Mechanical Engineering University of California Berkeley, California 94720 Email:
[email protected]
˙ q) ¨ is a matrix determined solely by robot mowhere Y = Y (q, q, tion. It is called a regressor or regression matrix. Except for certain types of robots that have closed-chain mechanisms [3], the linear decoupling in the form of Eq. (2) can always be done. Instead of including every individual mechanical parameter of the robot, such as the length, mass, and rotational inertia of each link, the components in Z can be functions of those parameters. Thus, Z might have a dimension much lower than the total number of individual mechanical parameters. 3) Drive the actual robot through a trajectory that gives a variety of motion patterns. Record the signals of q and τ from sensors. Compute Y (tk ) at selected time tk ’s. Stack data to form the data matrices τ(t1 ) Y (t1 ) τ(t2 ) Y (t2 ) Y = Y (t3 ) , T = τ(t3 ) .. .. . .
4) Solve a least squares regression problem to determine Z: min kYZ − Tk2 Z
M q¨ + Cq˙ + f = τ
(1)
˙ Z) represents where M = M(q, Z) is the mass matrix, C = C(q, q, the centrifugal and Coriolis effect, and f is the friction. Gravity is not considered as the method is applied to planar robots that operate horizontally. 2) Analytically transform Eq. (1) to YZ = τ
(2)
(3)
(4)
A major difficulty of going through this procedure comes from the analytical derivation in step 1) and 2). Quite often, the complexity of the equations is challenging for by-hand derivation. Usually symbolic computation using commercial software is necessary. Inputting the problem to the software, however, still requires much effort and attention not to introduce any typo. In addition, even with symbolic computation, the operating person is required to have a comprehensive knowledge on multi-body dynamics.
The model can be transformed into the form of Eq. (2), with the regression matrix Y as
Figure 1: A TWO-LINK DIRECT-DRIVE ROBOT (motors: NSK M-PS3090KN002 and M-PS3015KN002, control system: NI LabVIEW Real-Time Target)
One approach that may simplify the modeling and identification procedure considerably is to skip the analytical derivation and obtain an expression of Y using a machine learning method. With some basic information of the robot kinematics, one is able to build the candidate terms that form the components in Y . Further using a regressor selection technique, the actual components of Y can be identified from the candidates. The next section explains the proposed method with a simple example of a two-link direct-drive robot. Then the method is applied to a three-link belt-driven robot for further demonstration. Discussion and conclusion are given at the end. A SIMPLE EXAMPLE Consider a two-link planar robot (Fig. 1). Two direct-drive motors actuate the two joints independently, i.e., motor rotation q equals the joint rotation θ. Applying analytical mechanics, a dynamic model in the form of Eq. (1) can be obtained, with α + 2β cosq2 δ + β cosq2 M= δ + β cosq2 δ −2q˙2 −q˙2 C = β sin q2 q˙1 0
(5) (6)
where α, β, δ are the (condensed) parameters to be identified [4]. They are functions of the mechanical parameters specified in Fig.1. Friction is not included in the model. It is considered as unmodeled disturbance in the experiment data, and challenges the robustness of the approach1. 1 An additional part for friction can be included in the model and transformed into the form of Eq.(2) for least squares regression. The regression result of the friction coefficients, however, is highly vulnerable to sensor noise. This is especially true for the data with velocity crossing zero.
q¨1 (2q¨1 + q¨2) cos q2 − q˙2 (2q˙1 + q˙2) sin q2 q¨2 0 q¨1 cosq2 + q˙21 sin q2 q¨1 + q¨2
(7)
and the parameter vector as Z = (α, β, δ)T . An alternative method to obtain the expression of Y without going through analytical derivation is by using a machine learning approach. Considering the direct-drive configuration of the robot, the components in Y should be linear combinations of some candidate terms. Each of these terms is in the form of AB, where A is q¨i or q˙i q˙ j , and B is 1, sin qi , or cos qi , with i, j = 1, 2. In total, there are twenty-five2 candidates. The actual components of Y are selected from those candidates using a regressor selection method - the l1 -norm penalized least squares regression (a.k.a, the Lasso [5, 6]). The problem is formulated as
˜ Z˜i − Ti 2 + λ Z˜i (i = 1, 2) min Y 2 1
Z˜ i ∈R25
(8)
where Y˜ (t1 ) τi (t1 ) τi (t2 ) Y˜ (t2 ) ˜ = Y Y˜ (t3 ) ,Ti = τi (t3 ) .. .. . .
(9)
˜ λ > 0 is an adjustable penalty weight. In Y, Y˜ = q¨1 , q¨2 , q˙1 q˙2 , · · ·
1×25
(10)
includes all the candidate terms. Note the models for two motors are identified separately. Instead of a single 3 × 1 vector Z, two 25 × 1 vectors Z˜ 1 and Z˜ 2 will be obtained. Both of them have many (near) zero components, corresponding to the unselected candidate terms. The sparsity is encouraged by the l1 norm penalty. In order to select the correct terms and obtain good regression accuracy, the penalty weight λ should be tuned properly. The simplest tuning method is cross-validation, whereas advanced intelligent methods provide additional benefits. [7] gives a good review on related techniques. Apply Eq.(8) to experiment data. Plot the absolute values of the components in the optimal Z˜i ’s on bar charts (Fig.2). The effect of selection is obvious. The six selected terms for the model of motor 1 are q¨1 , q¨2 , q¨1 cos q2 , q¨2 cos q2 , q˙22 sin q2 , and 2 In fact, considering that the motion of the robot is centrosymmetric with respect to joint 1, q1 should not appear in the model, and can actually be excluded from B. This can reduce the total number of candidates to fifteen.
Figure 2: REGRESSOR SELECTION FOR THE TWO-LINK DIRECT-DRIVE ROBOT
Figure 4: REGRESSOR SELECTION FOR THE THREE-LINK BELT-DRIVEN ROBOT
motors sit coaxially beneath joint 1. Motor 1 drives link 1 directly. Motor 2 drives a belt mechanism via pulley 1 (not connected with link 1). When the two motors rotate synchronously, the robot arm rotates without radial motion. When motor 1 rotates while motor 2 being held, the robot arm extends or retracts radially. Due to the belt mechanism, link 3 stays along the radial direction at all time. The relationship between the joint angles θi and motor rotation qi is θ1 = q1 θ2 = 2q2 − 2q1 θ3 = q1 − q2 Figure 3: A THREE-LINK BELT-DRIVEN ROBOT (mechanical information is confidential, control system: MathWorks Simulink xPC Target)
q˙1 q˙2 sin q2 , which are consistent with the first row of Y in Eq. (7). The dynamic model for motor 1 is Yˆ1 Zˆ 1 = τ1
(11)
where the length of Yˆ1 and Zˆ 1 is 6. Yˆ1 and Zˆ1 shrink from Y˜ and the optimal Z˜ 1 respectively after eliminating the unselected components. Specifically, Zˆ 1 = (α, δ, 2β, β, − β, − 2β)T . Situation is similar for motor 2, where the length of Yˆ2 and Zˆ2 is 4. Note the learning algorithm is not aware that only three parameters (α, β, and δ) in Zˆ i ’s are independent. This issue is discussed later.
APPLICATION TO A BELT-DRIVEN ROBOT Figure 3 shows a three-link belt-driven robot. It is widely used in semiconductor industry for wafer handling [8, 9]. Two
(12)
The candidate terms for the regression matrix are again in the form of AB, where A is q¨i or q˙i q˙ j with i, j = 1, 2, and B is 1, sin (•) or cos (•) with • being θ2 , θ3 , or θ2 + θ3 expressed as in Eq.(12). Because the motion of the robot is centrosymmetric with respect to joint 1, θ1 is not considered for B. Apply the Lasso to the experiment data, eleven components are selected from thirty-five candidates for each motor (Fig.4). The result agrees with an analytical derivation in [10].
DISCUSSION AND CONCLUSION An approach for fast modeling and identification of robot dynamics is presented. By using a regressor selection technique of machine learning, dynamic models in the form of Eq.(11) can be obtained without going through the derivation of analytical mechanics. The obtained model is useful for many control strategies. Certain issues, however, deserve attention. First, in order to obtain a good result of regressor selection, it is desirable to use ˜ is well conditioned. a proper trajectory so that the data matrix Y This is especially important when the data is contaminated by unmodeled disturbance such as friction. [11] presents an optimization method to generate a trajectory that maximize the minimum singular value of the date matrix. Another attention-worthy
issue is that the learning algorithm is not aware that not all components in Zˆ are independent. The resulting model might have higher order than the most compact form obtained through analytical derivation. This issue, however, does not affect utilizing the model in various control strategies for torque computation. In particular, the computation load of evaluating the model is actually not increased. A third issue is that as the degrees of freedom of the robot increase, building the candidate terms in the regression matrix becomes more difficult. This is especially true when gravity is involved. Finally, without applying analytical mechanics, the model cannot be transformed from the YZ form to the Lagrangian form. The latter is necessary for certain applications (e.g., robot simulation using direct dynamics). This is a major limit of the proposed method.
REFERENCES [1] Mayeda, H., Osuka, K., and Kanagawa, A., 1984. “A new identification method for serial manipulator arms”. In Proceedings of the IFAC 9th World Congress, pp. 74–79. [2] Siciliano, B., Sciavicco, L., Villani, L., and Oriolo, G., 2009. Robotics: Modelling, Planning and Control. Springer-Verlag, Berlin. [3] Yu, X., Wang, C., Zhao, Y., and Tomizuka, M., 2013. “Dynamics modeling and identification of a dual-blade wafer handling robot”. In Proceedings of the 2013 ASME Dynamic Systems and Control Conference. [4] Kroger, T., and Wahl, F., 1990. “Stability and robustness analysis of a class of adaptive controllers for robotic manipulators”. The International Journal of Robotics Research, 9(3), June, pp. 74–92. [5] Tibshirani, R., 1996. “Regression shrinkage and selection via the lasso”. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 58, pp. 267–288. [6] Tibshirani, R., 2011. “Regression shrinkage and selection via the lasso: a retrospective”. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 73, pp. 273–282. [7] Wang, H., Li, B., and Leng, C., 2009. “Shrinkage tuning parameter selection with a diverging number of parameters”. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 71(3), pp. 671–683. [8] Abbe, R., and Baker, D., 1990. Rotary to linear motion robot arm. US Patent 4897015, January. [9] Todorov, A., 2008. Robot with belt-drive system. US Patent 2008/0121064 A1, May. [10] Till, B., 2010. “Dynamical model of a three-link remotelydriven vacuum robot”. In Proceedings of the 2010 Applied Materials ET Conference. [11] Armstrong, B., 1987. “On finding ’exciting’ trajectories for identification experiments involving systems with nonlinear dynamics”. In Proceedings of 1987 IEEE International Conference on Robotics and Automation., Vol. 4, pp. 1131–1139.