# Extended and Unscented Kalman Filtering Applied to a Flexible-Joint Robot with Jerk Estimation

Authors: Mohammad Ali Badamchizadeh; Iraj Hassanzadeh; Mehdi Abedinpour Fallah
Journal: Discrete Dynamics in Nature and Society
 (2011)

---

## Abstract

Robust nonlinear control of flexible-joint robots requires that the link position, velocity, acceleration, and jerk be available. In this paper, we derive the dynamic model of a nonlinear flexible-joint robot based on the governing Euler-Lagrange equations and propose extended and unscented Kalman filters to estimate the link acceleration and jerk from position and velocity measurements. Both observers are designed for the same model and run with the same covariance matrices under the same initial conditions. A five-bar linkage robot with revolute flexible joints is considered as a case study. Simulation results verify the effectiveness of the proposed filters.


---

## Body

## 1. Introduction

In recent years, many researchers have investigated the control problem of robots with flexible joints. However, compared to the large volume of the literature available on control of rigid robots, relatively little has been published on the control of flexible-joint robots. On the other hand, for a robot manipulator to carry out demanding tasks with high performance, such as the space robots performing services in space, joint flexibility due to gear elasticity, shaft windup and use of harmonic drives, has to be taken into account in both modeling and control of robot manipulators. As the experimental investigations by Sweet and Good [1] show, the effects of joint flexibility can limit the robustness and performance of a given robot controller and can even lead to instability if neglected in the controller design. Moreover, the joint flexibility can serve as the first approximation of robot link flexibility [2] and hence the study of joint flexibility can provide another perspective into the study of flexible link which allows much lighter link weight and thus much faster motion of the robot. If we assume that the flexibility is modeled as a linear torsional spring, we obtain the dynamic model of the manipulator with flexible joints. Flexible robotic manipulators have several advantages over rigid manipulators depending on specific applications; some of these advantages are as follows: low actuator drive requirement, high speeds, low weight, small size, and low cost [3–6].The robust nonlinear control of these robots based on the state feedback requires the knowledge of state variables for each joint, which may be either positions or velocities of the motors and of the links or positions, velocities, accelerations and jerks of the links [5]. Not only is the full state measurement costly, but there are problems with link acceleration and jerk. Since the former is difficult and the latter impossible to measure, we are forced to consider an observer which provides estimations for these unmeasurable states from position and velocity measurements [7].Within the significant toolbox of mathematical tools that can be used for stochastic estimation from noisy sensor measurements, one of the most well-known and often used tools is the Kalman filter. As an extension to the same idea, the extended Kalman filter (EKF) is used if the dynamic of the system and/or the output dynamic is nonlinear. It is based on linearization about the current estimation error mean and covariance [8]. Although it is straightforward and simple, it has drawbacks too [9]. The Unscented Kalman Filter (UKF) is the newest revision of the Kalman Filter, proposed to overcome these flaws. It does not need the linearization for a nonlinear function and is more accurate and simpler than the EKF applied to nonlinear systems [10, 11].In this paper, we derive the dynamic model of a five-bar linkage robot with flexible joints and propose a state-space model for the robot. Then, we apply extended and unscented Kalman filters to estimate the proposed state for the robot. The augmented state is herein composed of the position, velocity, acceleration and jerk of the links. Computer simulations are well performed to verify the performances of the proposed filters.The remainder of this paper is organized as follows. Section2 presents the dynamic model of a five-bar linkage robot with flexible joints and derives a state-space model for the robot as well. In Sections 3 and 4, we describe the algorithmic details of the EKF and UKF formulations and implement these filters for the five-bar linkage robot. Section 5 shows the simulation results and discusses their significance. And Section 6 gives the concluding remarks.


## 2. Dynamic Modeling

Referring to Figure1, we define q1=[ql1,…,qln]T as the vector of link angles and q2=[(1/rm1)qm1,…,(1/rmn)qmn]T as the vector of motor shaft angles (reflected to the link side of the gears) for the n-link flexible-joint manipulator.  The dynamic model can be derived using the Euler-Lagrange equations [7, 12](2.1)D(q1)q̈1+C(q1,q̇1)q̇1+g(q1)+K(q1-q2)=0,Jq̈2+Bq̇2+K(q2-q1)=u,
where D(q1) is the inertia matrix (symmetric and positive definite), C(q1,q̇1) is the vector representing the damping, Coriolis and centrifugal torques, g(q1) is the vector of torques due to gravity, K=diag[k1,…,kn] is the joint stiffness coefficients modeling the joints elasticity, J=diag[J1,…,Jn] and B=diag[B1,…,Bn] are diagonal matrices representing rotor inertia and rotor damping, respectively, and u∈Rn  is the vector of input torques applied to the rotor [7, 12].Figure 1
Model of a single-link, flexible-joint manipulator.Figure2, shows the five-bar linkage manipulator with flexible joints built in robotics research lab in our department. Also, Figure 3 depicts the 5-bar linkage manipulator schematic where the links form a parallelogram [13]. It is clear from this figure that even though there are four links being moved, there are in fact only two degrees of freedom, identified as ql1 and ql2 [12].Figure 2
Five-bar linkage manipulator.Figure 3
Planar schematic of 5-bar linkage robot.We adopt a similar approach, that is, successive differentiation of the link position with respect to time, introduced by [7] to derive a state-space model for the 5-bar linkage robot. So the state vector is defined as
(2.2)x⃗=(q1q2q̇1q̇2q̈1q⃛1)T,
where
(2.3)q1=[ql1ql2]T,q2=[1rm1qm11rm2qm2]T.
Then following the discussion in [12], we set
(2.4)m3l2lc3=m4l1lc4,
which subsequently makes d12 and d21 be zero, that is, the inertia matrix becomes diagonal and constant. Therefore using (2.1)–(2.4), the rather complex-looking manipulator in Figure 2 can be expressed by the following decoupled set of equations:(2.5)ẋ1=x5,ẋ2=x6,ẋ3=x7,ẋ4=x8,ẋ5=1d11{-gcos⁡x1(m1lc1+m3lc3+m4l1)-k1(x1-x3)},ẋ6=1d22{-gcos⁡x2(m2lc2-m4lc4+m3l2)-k1(x2-x4)},ẋ7=1J1{u1-B1x7-k1(x3-x1)},ẋ8=1J2{u2-B2x8-k2(x4-x2)},ẋ9=1d11{gx5sinx1(m1lc1+m3lc3+m4l1)-k1(x5-x7)},ẋ10=1d22{gx6sinx2(m2lc2-m4lc4+m3l2)-k2(x6-x8)},ẋ11=1d11{gẋ5sinx1(m1lc1+m3lc3+m4l1)+gx52cos⁡x1×(m1lc1+m3lc3+m4l1)-k1(ẋ5-ẋ7)gx52cos⁡x1},ẋ12=1d22{gẋ6sinx2(m2lc2-m4lc4+m3l2)+gx62cos⁡x2×(m2lc2-m4lc4+m3l2)-k2(ẋ6-ẋ8)gx52cos⁡x1}.
This special feature helps to explain the popularity of the parallelogram configuration in industrial robots; since one can adjust the two set of angles (ql1,qm1) and (ql2,qm2) independently, without worrying about interactions between them.


## 3. Extended Kalman Filter

The Kalman filter addresses the general problem of trying to estimate the statex∈Rn of a discrete-time controlled process that is governed by a linear stochastic difference equation. As an extension to the same idea, the extended Kalman filter (EKF) is used if the dynamic of the system and/or the output dynamic is nonlinear. EKF is based on linearization about the current estimation error mean and covariance [8].


### 3.1. Definitions

Let us assume that the process has a state vectorx∈Rn  and a control vector u and is governed by the nonlinear stochastic difference equation
(3.1)xk=f(xk-1,uk,wk-1),
with a measurement  z∈Rmthat is
(3.2)zk=h(xk,vk),
the random variables  wk and vkrepresent the process and measurement noise, respectively. They are assumed to be independent of each other, white, and with normal probability distributions with covariance matrices Q and R. It can be shown that the time update equations of EKF is (3.3)x̂k-=f(x̂k-1-,uk,0),Pk-=AkPk-1AkT+WkQk-1WkT,
where x̂k-is the a priori state estimate [8]. These time update equations project the state and covariance estimate (Pk) from the previous time step k-1to the current time stepk. And the measurement update equations of the EKF are
(3.4)Kk=Pk-HkT(HkPk-HkT+VkRkVkT)-1,x̂k=x̂k-+Kk(zk-h(x̂k-,0)),Pk=(I-KkHk)Pk-,
where A,W,Hand Vare Jacobian matrices and Kis the correction gain vector. These measurement update equations correct the state and covariance estimate with the measurement zk  [8]. The design process of this filter is explained next.


### 3.2. Implementation

The differential equations are integrated using a fourth-order Runge Kutta method with a step size of 14 msec.Suppose that the position and velocity of the 5-bar linkage robot are measured as(3.5)zk⃗=[ql1ql2q̇l1q̇l2]k+vk,
where vkrepresents the measurement noise.Due to the recursive nature of the EKF algorithm, the state vector needs to be initialized in startup. The initial position and velocity components are taken as the first measured values. Here, the following initial conditions are selected randomly for the state vector:(3.6)x⃗initial=[π2ππ4π200000000]T.
We add uncertainty to the initial condition by selecting (3.7)P0=[(3π180)2(3π180)2(2π180)2(2π180)211111111]T,
and the process noise and measurement noise are chosen as(3.8)Q=diag⁡[(3π180)2(3π180)2(2π180)2(2π180)21010202030304040],R=diag⁡[(5π180)2(5π180)244].Thus, we developed all the necessary elements of the EKF. In Section5 the results of simulating the filter are presented.


## 3.1. Definitions

Let us assume that the process has a state vectorx∈Rn  and a control vector u and is governed by the nonlinear stochastic difference equation
(3.1)xk=f(xk-1,uk,wk-1),
with a measurement  z∈Rmthat is
(3.2)zk=h(xk,vk),
the random variables  wk and vkrepresent the process and measurement noise, respectively. They are assumed to be independent of each other, white, and with normal probability distributions with covariance matrices Q and R. It can be shown that the time update equations of EKF is (3.3)x̂k-=f(x̂k-1-,uk,0),Pk-=AkPk-1AkT+WkQk-1WkT,
where x̂k-is the a priori state estimate [8]. These time update equations project the state and covariance estimate (Pk) from the previous time step k-1to the current time stepk. And the measurement update equations of the EKF are
(3.4)Kk=Pk-HkT(HkPk-HkT+VkRkVkT)-1,x̂k=x̂k-+Kk(zk-h(x̂k-,0)),Pk=(I-KkHk)Pk-,
where A,W,Hand Vare Jacobian matrices and Kis the correction gain vector. These measurement update equations correct the state and covariance estimate with the measurement zk  [8]. The design process of this filter is explained next.


## 3.2. Implementation

The differential equations are integrated using a fourth-order Runge Kutta method with a step size of 14 msec.Suppose that the position and velocity of the 5-bar linkage robot are measured as(3.5)zk⃗=[ql1ql2q̇l1q̇l2]k+vk,
where vkrepresents the measurement noise.Due to the recursive nature of the EKF algorithm, the state vector needs to be initialized in startup. The initial position and velocity components are taken as the first measured values. Here, the following initial conditions are selected randomly for the state vector:(3.6)x⃗initial=[π2ππ4π200000000]T.
We add uncertainty to the initial condition by selecting (3.7)P0=[(3π180)2(3π180)2(2π180)2(2π180)211111111]T,
and the process noise and measurement noise are chosen as(3.8)Q=diag⁡[(3π180)2(3π180)2(2π180)2(2π180)21010202030304040],R=diag⁡[(5π180)2(5π180)244].Thus, we developed all the necessary elements of the EKF. In Section5 the results of simulating the filter are presented.


## 4. Unscented Kalman Filter

The basic premise behind the unscented Kalman filter is based on the idea that it is easier to approximate a Gaussian distribution than it is to approximate an arbitrary nonlinear function. Instead of linearizing using Jacobian matrices, the UKF uses a deterministic sampling approach to capture the mean and covariance estimates with a minimal set of sample points, and it has 3rd-order (Taylor series expansion) accuracy for Gaussian error distribution for any nonlinear system [11], while EKF uses linearizing Jacobian matrix, which is a first-order approximation. The UKF is claimed to have obvious advantages over EKF [10]. A brief overview of the UKF algorithm is presented in the following section.


### 4.1. Definitions

The unscented transformation (UT) is a method for calculating the statistics of a random variable which undergoes a nonlinear transformation. TheL dimensional random variable x with mean x̅and covariance Pxis approximated by 2L+1 weighted points given by(4.1)χ0=x̅,i=0,χi=x̅+((L+λ)Px)i,i=1,…,L,χi=x̅-((L+λ)Px)i-L,i=L+1,…,2L.
These sigma points are propagated through the nonlinear function
(4.2)yi=f(χi),i=0,…,2L,
from which the mean and covariance of the transformed probability can be approximated,(4.3)y̅≈∑i=02LWimyi,Py≈∑i=02LWic(yi-y̅)(yi-y̅)T,
with weights  Wi given by(4.4)W0m=λL+λ,W0c=λL+λ+(1-α2+β),Wim=Wic=12(L+λ),i=1,…,2L,
where λ=α2(L+κ)-L is a scaling parameter. The constant α determines the spread of the sigma points around x̅ and is usually set to small positive values less than one (typically in the range 0.001 to 1) whereas κ is the secondary scaling parameter usually set to zero or 3-L, and the constant β is used to incorporate prior knowledge of the distribution of x (for Gaussian distributions, β=2 is optimal). The scale parameters may be tuned to match the specific problem; some guidelines to choose them are provided in [10].The unscented Kalman filter (UKF) can be implemented using UT by expanding the state space to include the noise component:xka=[xkT,wkT,vkT]T. The UKF algorithm can be summarized as follows:(1)
initialization:(4.5)x̂0a=[x̂0T00]T,P0a=[P0000Q000R].(2)
iteration for each time stepk(∈1,…,∞),
(a)
calculate sigma-points:(4.6)χk-1a=[x̂k-1ax̂k-1a+γPk-1ax̂k-1a-γPk-1a],(b)
time update:(4.7)χk|k-1x=f(χk-1x,χk-1w,uk-1),x̂k-=∑i=02LWimχi,k∣k-1x,Pk-=∑i=02LWic[χi,k∣k-1x-x̂k-][χi,k∣k-1x-x̂k-]T,Zk∣k-1=h(χk∣k-1x,χk-1v),ẑk-=∑i=02LWimZi,k∣k-1;(c)
measurement update:(4.8)Pẑkẑk=∑i=02LWic[Zi,k∣k-1-ẑk-][Zi,k∣k-1-ẑk-]T,Px̂kẑk=∑i=02LWic[χi,k∣k-1x-x̂k-][Zi,k∣k-1-ẑk-]T,Kk=Px̂kẑkPẑkẑk-1,x̂k=x̂k-+Kk(zk-ẑk-),Pk=Pk--KkPẑkẑkKkT,
where
(4.9)χa=[(χx)T(χw)T(χv)T]T,γ=L+λ.


### 4.2. Implementation

The differential equations are integrated using a fourth-order Runge Kutta method with a step size of 14 msec. We initialize the filter in the same way as the EKF, using the same values for the state vector and covariance matrices.  We also need to set the tuning parametersα, β and κ. The optimum values for coefficients α and βare chosen as 0.001 and 2, respectively. And κ is set to zero. These optimum values are chosen such that they provide the best estimates for all experiments [11].


## 4.1. Definitions

The unscented transformation (UT) is a method for calculating the statistics of a random variable which undergoes a nonlinear transformation. TheL dimensional random variable x with mean x̅and covariance Pxis approximated by 2L+1 weighted points given by(4.1)χ0=x̅,i=0,χi=x̅+((L+λ)Px)i,i=1,…,L,χi=x̅-((L+λ)Px)i-L,i=L+1,…,2L.
These sigma points are propagated through the nonlinear function
(4.2)yi=f(χi),i=0,…,2L,
from which the mean and covariance of the transformed probability can be approximated,(4.3)y̅≈∑i=02LWimyi,Py≈∑i=02LWic(yi-y̅)(yi-y̅)T,
with weights  Wi given by(4.4)W0m=λL+λ,W0c=λL+λ+(1-α2+β),Wim=Wic=12(L+λ),i=1,…,2L,
where λ=α2(L+κ)-L is a scaling parameter. The constant α determines the spread of the sigma points around x̅ and is usually set to small positive values less than one (typically in the range 0.001 to 1) whereas κ is the secondary scaling parameter usually set to zero or 3-L, and the constant β is used to incorporate prior knowledge of the distribution of x (for Gaussian distributions, β=2 is optimal). The scale parameters may be tuned to match the specific problem; some guidelines to choose them are provided in [10].The unscented Kalman filter (UKF) can be implemented using UT by expanding the state space to include the noise component:xka=[xkT,wkT,vkT]T. The UKF algorithm can be summarized as follows:(1)
initialization:(4.5)x̂0a=[x̂0T00]T,P0a=[P0000Q000R].(2)
iteration for each time stepk(∈1,…,∞),
(a)
calculate sigma-points:(4.6)χk-1a=[x̂k-1ax̂k-1a+γPk-1ax̂k-1a-γPk-1a],(b)
time update:(4.7)χk|k-1x=f(χk-1x,χk-1w,uk-1),x̂k-=∑i=02LWimχi,k∣k-1x,Pk-=∑i=02LWic[χi,k∣k-1x-x̂k-][χi,k∣k-1x-x̂k-]T,Zk∣k-1=h(χk∣k-1x,χk-1v),ẑk-=∑i=02LWimZi,k∣k-1;(c)
measurement update:(4.8)Pẑkẑk=∑i=02LWic[Zi,k∣k-1-ẑk-][Zi,k∣k-1-ẑk-]T,Px̂kẑk=∑i=02LWic[χi,k∣k-1x-x̂k-][Zi,k∣k-1-ẑk-]T,Kk=Px̂kẑkPẑkẑk-1,x̂k=x̂k-+Kk(zk-ẑk-),Pk=Pk--KkPẑkẑkKkT,
where
(4.9)χa=[(χx)T(χw)T(χv)T]T,γ=L+λ.


## 4.2. Implementation

The differential equations are integrated using a fourth-order Runge Kutta method with a step size of 14 msec. We initialize the filter in the same way as the EKF, using the same values for the state vector and covariance matrices.  We also need to set the tuning parametersα, β and κ. The optimum values for coefficients α and βare chosen as 0.001 and 2, respectively. And κ is set to zero. These optimum values are chosen such that they provide the best estimates for all experiments [11].


## 5. Simulation Results

This section presents simulation results by Matlab. The simulation data and nominal values of the five-bar linkage parameters are selected as shown in Tables1 and 2. Also, the simulation step time is chosen 14 msec. To evaluate the performances of the proposed EKF and UKF for the five-bar linkage robot, we plotted the estimated states from the available measurements in Figures 4, 5, 6, and 7. They belong to the the first joint. The results for the second joint are similar.Table 1
5-Bar linkage manipulator data.
LinkMass (Kg)Length (m)C of g (m)10.2880.330.16620.03240.120.0630.37020.330.16640.29810.450.075Table 2
Simulation data for5-bar linkage.
ParametersNominal values (in SI units)Joint stiffnessK1=100,  K2=200Friction constantB1=0.1, B2=0.15Gravity coefficientg=9.8InertiaI1=1, I2=2, I3=1, I4=2Motor inertiaJ1=1, J2=1.5Gear ratiorm1=50,  rm2=50Input torquesτ1=2, τ2=5Figure 4
The estimated positionql1.Figure 5
The estimated positionqm1.Figure 6
The estimated velocityq̇l1.Figure 7
The estimated velocityq̇m1.Moreover, Figures8, 9, 10, and 11, depict the estimated accelerations and jerks for both of the joints.Figure 8
The estimated accelerationq̈l1 of the first joint.Figure 9
The estimated accelerationq̈l2 of the second joint.Figure 10
The estimated jerkq⃛l1 of the first joint.Figure 11
The estimated jerkq⃛l2 of the second joint.


## 6. Conclusion

In this paper the extended and unscented Kalman filters are employed for state estimation of a flexible-joint robot. First, the dynamic model of a five-bar manipulator is derived in order to apply the proposed filters. Then, simulation results illustrate that both filters can estimate the link acceleration and provide estimates of the link jerk using the position and velocity measurements. Knowledge of these states is necessary for application of robust outer-loop control theory. In the future we will try to utilize these estimations in robust nonlinear tracking controller design for flexible-joint robots. Furthermore, developing system identification techniques for the five-bar linkage robot would be another challenging task.



---

*Source: 482972-2010-12-16.xml*