LOCATING A TWO-WHEELED ROBOT USING EXTENDED KALMAN FILTER

Original scientific paper The Kalman filter is a very general method of filtering which can solve problems such as optimal estimation, prediction, noise filtering, and optimal control. A problem with detection of correct path of moving objects is the received noisy data. Therefore, it is possible that the information is incorrectly detected. There are Different methods to extract the correct data from the received information. This paper aims to detect the path of a two-wheeled robot using extended Kalman filter. For this purpose, triangular, circular, elliptical, and Sinusoidal paths were used to explore various scenarios. The results showed that the Kalman filter optimally detects the correct path with less than 3 % error rate. These results also show that error rate related to detect circular and triangular paths has the highest and lowest value, respectively, using the extended Kalman filter; in addition, the results showed that the error rate strongly depends on path changes.


Introduction
In many applications which are dangerous to humans, mobile robot could hold a special place in many processes to become major components of the systems [1÷6].Robot performance monitoring and analysis is one of the problems discussed on this technique.Therefore, this study seeks to identify the correct path of robots.The information received from robot movements is noisy; the path may be detected by a percentage error or even wrongly.Therefore, the basic data mining techniques has been always a priority when working with robots.
One of the most important types of robots is twowheeled robots used to move objects, to do services and to explore.This paper aims to detect the path of these robots using extended Kalman filter.By received noisy information and the equation of two-wheeled robot, Kalman filters extract pure data without noise.
There are various kinds of Kalman filters such as extended, neutral etc.It is possible to combine different types of methods such as Metropolis and this algorithm to solve statistical equations.In addition, the Monte Carlo method solves problems which cannot be solved by conventional techniques by generating random numbers.In combination of this method and the Adaptive Kalman Filter, one of the most important conditions for the convergence rate and the required time is to select the proposed distribution [7].Another application of Kalman filter is calibration of satellite positioning components like a gyroscope.In such problems, Kalman filter algorithm is applied by selecting state variables such as focal distance, reference point and the first order distortion coefficients [8].The extended Kalman filter also can be used to analyse characteristics such as salt moisture, temperature, or an investigation into the plants.
Annual and monthly sampling and comparison of the results with real data shows the effectiveness of these methods [9,10].Overall assessment of the marine ecosystem can also be performed using a Kalman filter.In this application, the ecosystem includes two other models as sub-models [11].
Given that robotic science, particularly research on mobile robots, is considered as one of the hottest topics of the day and due to the great efficiency of wheeled mobile robots, this study tries to track and pattern a Two-wheeled robot moving on different tested and non-tested tracks by examining extended Kalman filter control method to determine the correct track of a two-wheeled robot.In this paper, we first review the two-wheeled robot and the governing relationships followed by the relationships of the two-wheeled mobile robot.In the next section, Kalman filter, algorithms, and the governing relationships are discussed.Then, this section evaluates the extended Kalman filter as the main instrument used in this study to determine the track.The software MATLAB is used for required simulations for different tracks of the twowheeled robot.In conclusion, the overall results obtained from this study are provided following validation of the results.

Two-wheeled robot
Nowadays mobile robots are widely discussed in the research communities and have various applications in industry and everyday life.In addition, other applications such as scientific, entertaining and advertising applications are considered.These robots include twowheeled mobile robots.The precise control and navigation of the two-wheeled robot, which shows nonlinear behaviour, requires an accurate model.One of the major problems caused by the removal of noise is distortion effect, non-modelled dynamic effect, and nonlinear characteristics of this type of robots.Therefore, the main objective is to eliminate these effects and to reduce the error, so that the two-wheeled robot moves along the desired direction with a certain speed.
Geometric model of the two-wheeled mobile robot with differential motor system is shown in Fig. 1.In this figure, P c denotes the centre of mass of the robot; P 0 is the origin of coordinate system of the robot, P l is the reference input; 2r shows the axis of the wheel; 2b is the distance between wheels of the robot; ϕ shows the angle between robot axis and coordinate axis.Finally, θ l and θ r are angular velocity of left and right wheels, respectively.The equation of motion is: So that, q = [x c , y c , θ r , θ l , φ] T denotes the system variables.In this case, assuming that the wheels do not slip and P 0 moves along the x-axis, the system kinematics is defined as [12]: Dynamic equations using Lagrange equation is [13]: (3) where, M(q) is the matrix of inertia moment, C(q) is the matrix of Coriolis forces, B(q) is input matrix, and A τ (q) is the Jacobian matrix, τ is the input vector which is the torque to the left and right wheels and λ is the additional forces into the system.Given the equations, state space vector is obtained as follows.In this equation, Control inputs are angular acceleration of the left and right wheel obtained by converting ( ) ( ) . Here, ( ) ( ) (5) In this system, the minimum distance between P 1 y 1 and y 2 is a path forward speed of the robot.By determining system of equations, the system is linearized.The system is controllable and Lyapunov stable in equilibrium point x = 0 [15].Note that the used twowheeled robot system is a complex system; thus linear methods can be used to control the system by appropriate control signal [14] in order to linearize the system as follows: (6) After linearization, the system becomes two singleinput and single-output systems which are decoupled from each other: A quadratic system which is the position model and a first order system which is a velocity model: The linearized position equation which is a quadratic system can be written in the form of a discrete state space by considering two additional scenarios related to the delay, as follows.The discretization is obtained by discrete equations as: [ ] The linearized velocity equation which is a first-order system can be written in the form of a discrete state space by considering one additional scenario related to the delay, as follows: According to the kinematic and dynamic equations obtained in this study, the extended Kalman filter was performed on the considered system to design and employ different controllers for routing a two-wheeled robot.Considering various circular, elliptic, Sinusoidal and polygons (triangles) tracks, the results were compared; by displaying error rates, the final results were provided.

Kalman filter
The Kalman filter is a recursive filter used in dynamic single-input single-output and multi-input multioutput systems to determine position.The filter estimates the state of a system by a series of flawed measures mixed with noise.One of the important applications of this filter is to specify sequentially accurate information about the position and velocity of a studied mobile by a continuous series of observations of the location of a given object [16].
It is noteworthy that each of the mentioned inputs and observations is associated with some error.This is because of the fact that received information is not too noisy in an ideal noiseless environment to need a Kalman filter.The Kalman filter is required in cases in which there are consecutive entries, mixed with random noises, and the purpose is to extract the main noiseless inputs.The noise detection algorithms randomly and certainly consider noise and the function governing the system.Given that the previous and current scenarios of a system are known, the purpose is to determine the next scenarios.The noise is added randomly and uncertainly to the system scenarios which are function of a certain condition; therefore, they do not experience a sudden mutation.Thus, the random values of noise can be recognized from relatively certain values of system scenarios and the initial input can be extracted [19,17].To understand this better, consider ideal and non-ideal systems.Ideally, the diagram block of the system is shown in Fig. 2. The present discussion involves all processes and considers a general scenario; therefore, the system is considered by feedback.In fact, the relations governing a system are not as shown in Fig. 2; due to noises existing in the real life which disturb the system, instead, the block diagram of the system is shown in Fig. 3.Many factors could cause errors in correct detection of the primary inputs, classified into two types of measurement errors due to system or environmental factors.However, even if the effects of these errors are not taken into consideration, the two noises shown in the figure, j v the measurement noise and j w related to the process (system), cannot be ignored.As a practical example, when heart rate of a patient is measured, breathing v j and causes of the problems, (such as asthma) which are more important than the first w j , influence the measurement.Kalman filter is used in a wide range of engineering applications such as radar and computer vision; they are important in control theory and control systems engineering.Currently, wide combinations of the extended Kalman filter are used.The basic formula called as simple Kalman filter as well as the extended Kalman filter and a range of root square filters developed by Bearman, Thornton and many others are frequently used.The mostly used Kalman filter is the lock-phase ring now available in radio, computer and virtually any other type of video equipment or communication [20].

Kalman filter algorithm
In cases where there are random processes and system is under their conditions, the exact amount of variables and scenarios is not specified in the next moments; they need to be predicted by output and the type of the system.Therefore, statistical processes are applied.Given that the random process needs to be estimated and modelled, therefore, ( 11) and ( 12) can be used to determine the position: Eqs. ( 11) and ( 12) are related to the measurement and process, respectively; in addition, the variables in these equations are defined as follows [20,21]: • w k − white noise with known covariance • Z k − vector measured at the moment k • H k − matrix relating the measured value and states of the system in normal mode without noise • v k − measurement error, which is assumed to be white noise with covariance.
The mean and covariance of the noises are given by the following relations: Here it is assumed that an initial estimate of the process is obtained in k t at the beginning of the Kalman filter algorithm; the estimate is based on information from the relationships governing the process.This initial estimate is indicated by ˆk x − in which the minus sign indicates the initial estimate obtained by measuring in moment t k .In addition, it is assumed that the error Technical Gazette 22, 6(2015), 1481-1488 covariance matrix ˆk x − is known in advance; in this case, the estimation error is defined as: (18) In addition, the related covariance matrix is obtained as follows: (19) Many systems are under certain circumstances which make initial estimates, measurement or initial measurement not exist.In these cases, if the mean is zero, the estimation will start from zero and the error covariance matrix will be set equal to the matrix covariance X.However, here it is assumed that ˆk x − exists and the purpose is to make a better initial estimate by measuring Z k .Therefore, a linear combination of measurements is formed with noise and initial estimates. ( In this case, ˆk x and K k are the corrected estimate and combination factor, respectively.The main problem is to find optimal K k ; so that the best correction occurs.Here, as in many processes related to stochastic systems, the mean square error minimization is used.Therefore, the error covariance matrix related to corrected estimate is formed as follows: (21) Then (20) is inserted in (21); by substituting, X k , ( 22) is obtained: (22) Considering the fact that measurement noise is uncorrelated, we can write: (23) This relationship is the most complete and most general equation to correct the error covariance matrix; K k can be used to any advantage.
Again, let us obtain the optimal by minimizing the mean square error; the purpose is to reduce the total values of the original diameter elements P k .The P k equation is extended and written as follows: (24) By setting the previous equation to zero and solving it to obtain the optimal, (25) is obtained: (25) The special T k K obtained to minimize the mean square error of estimate in ( 25) is called the Kalman gain.The covariance matrix related to this estimate can be computed and obtained as (26) by substituting the optimal value in the overall relationship.(26) This relation only can be used for optimal gain; however, the simplified equations related to correction of Kalman gain and estimation of the optimal scenarios will be organized to solve this problem.In the case k K is obtained in time t k , the initial values X k and P k will be required to take advantage of optimal Z k at a later stage and restore the corrected estimation ˆk x .Using these estimates for ˆk x and the matrix of transition, initial estimate is obtained for the next step.The average of w k is zero and lacks self-correlation; thus, it can be omitted from ( 27). ( Next, it is necessary to form the error matrix as ( 28): In addition, correlation of w k and e k is zero.Here, all the required values at the time 1 k t + are obtained and measured values 1 k z + are available.Using the equations mentioned before, estimation can be corrected; therefore, a recursive loop is obtained as shown in Fig. 4; this loop is called Kalman filter.According to the intended application, the Kalman filter loop can be repeated every stage.
Because the Kalman filter is a recursive loop which can be permanent and infinite, it can sometimes lead to divergence of the results.Therefore, its probability can be eliminated by avoiding consecutive rounding and considering various errors (not using the approximation).
Because the Kalman filter is a recursive loop which can be permanent and infinite, it can sometimes lead to divergence of the results.Therefore, its probability can be eliminated by avoiding consecutive rounding and considering various errors (not using the approximation).

Extended Kalman filter
Extended Kalman filter algorithm is similar to the conventional Kalman filter.In this section, the filter and its associated relationships are studied [21,22].The state space model is as follows: (29) where, x(k), x(k−1) and ω(k) represent the position vector at time k and k−1, the transition matrix from time k to time k−1 and the white Gaussian noise (periodic noise), respectively.a is a common internal parameter venture between different positions in which it is constant (theoretically) a = I 2×2 .The governing equation can be stated as the same as Kalman filter, as follows: .Using the linear parameters for approximation of the extended Kalman filter is iterated once as below [22 ÷ 25].
1.The current position is predicted based on the previous position. ).
3. The modified matrix Kg (Kalman gain) is calculated; in the following equation, R is the measured noise distribution.

Simulation and analysis of results
In this section, error rate is extracted to evaluate the algorithm and ability of the extended Kalman filter to track and detect correctly by moving in circular, elliptical, sinusoidal and polygons (triangle) tracks and comparing the results.Figs. 5 and 6 show the result of movement on the circular and elliptical tracks, as well as error related to movement on circular and elliptical as shown in Figs.7  and 8.The anticipated results of the Kalman filter are shown in red in all directions.
Clearly, the greatest rate of error is related to the crossing points located on the main diagonal, due to the many changes around these parts.The changes related to triangular track are shown in Fig. 9.As Figs. 5 and 6, the greatest error rate is related to points with considerable changes in their values.
Sinusoidal tracks are shown in Fig. 11.The error associated with this track is shown in Fig. 12 according to which the error is related to the function extremes.
By simulations carried out for two-wheeled mobile robot in different directions using the extended Kalman filter, the results are displayed in Tab. 1.As shown in Tab. 1, the lowest error rate is related to circular track and the highest error rate is related to triangular track in tracking a two-wheeled mobile robot using the extended Kalman filter.The robot track can be detected by different ways including observer, pole placement, fuzzy logic and active observer [26 ÷ 29].According to results shown in Tab. 1, the two-wheeled robot tracking using extended Kalman filter is more accurate than other methods used for tracking.The experimental observations showed that error rate of most control tracking methods is over 0,1 %, while the error rate of the extended Kalman filter tested by this study on different tracks was 0,028 for all tracks.Relocation or movement of objects on a specified track is one of the most important activities related to robotics.Many applications seek for the correct prosecution and surveillance of robots on their movement in the desired directions.Using the extended Kalman filter algorithm, this study detected the direction of a twowheeled robot.To determine the accuracy of the proposed algorithm, different circular, elliptical, etc. tracks were studied and the error related to different scenarios was shown.The results show that this algorithm is highly able to detect the correct robot track.The lowest error rate was related to circular track due to uniformity of the changes on the track; on the other hand, the highest error rate was related to triangular track due to considerable changes in the peaks.The results showed that the error rate is highly dependent on the changes in the track; the change in the track will change the error rate.The innovation of this study was to use the extended Kalman filter instead of the ordinary Kalman filter to track a two-wheeled robot as well as to determine the error rate of this approach on different tracks including triangular which was tested for the first time.This study is the first to evaluate factors such as resistance against disturbance and uncertainty, resistance against noise, speed and amount of calculations etc. to track a two-wheeled mobile robot and to test on a new control method (the extended Kalman filter) given the different tracks.This study tracked a two-wheeled mobile robot using the extended Kalman filter.For a more accurate comparison, it is recommended to use several control methods simultaneously to track a two-wheeled robot.Because the triangular track is widely used for mobile robots, the practical studies are required to eliminate shortcomings of correct tracking due to high level of error in this special track.

Figure 1
Figure 1 the geometric model of the two-wheeled robot

( 7 )
T P and T v are dead time of position and velocity models.Linearized equation of the position model can be written (T P = t d ):(8)

Figure 2
Figure 2 Block diagram of the ideal process

Figure 3
Figure 3 Block diagram of the non-ideal process

Figure 4
Figure 4 The recursive Kalman filter algorithm In the extended Kalman filter, the estimate x'(k | k−1) is called the first order approximation which uses the optimal Estimation of x'(k−1.|.k−1); it is obtained by observations x'(k−1.|.k−1) and state equations ( ) ( 1) ( ) x k ax k k ν = − + .In this section, the Taylor is used in a point of the first order approximation x'(k | k−1) in which ( ( )) F x k is considered a nonlinear function.

4 .
At this point, the current position is predicted by the previous position and the current observation.5.Covariance x = x'(k | k) is updated as a final step after which the loop is repeated.

Figure 5 Figure 6 Figure 7
Figure 5 Movement on a circular track

Figure 8
Figure 8 The error rate related to movement in the elliptical track 5 Validation of results

Figure 9 Figure 10 Figure 11 Figure 12
Figure 9 Movement on the triangular track

Table 1
Comparing results obtained from simulation of the extended Kalman filter on different tracks