Keywords

1 Introduction

The RoboCup competitions goal for 2050 was started in 1997: a team with fully autonomous humanoid soccer player robots shall win against the winner of the world cup [1]. In order to reach this objective, RoboCup competitions are held every year with incremental steps toward this goal [2, 3]. One of the technical challenges in RoboCup competitions is Goal-Kick from Moving Ball. Figure 1 shows the steps of this challenge; a ball is thrown and the robot should place itself in the appropriate position and kick the ball.

Fig. 1.
figure 1

Steps of the RoboCup Goal-Kick from Moving Ball challenge [4].

In order to reach this ability, the robot should be able to predict the ball trajectory. Prediction is one of the primary abilities of the human. A psychology study in 1998 showed that a 6-month-old human infant has the ability to predict the trajectory of the objects [5]. This shows the necessity of the prediction in humanoid robots in order to act and think like humans.

A research by Seekircher et al. [6] presented an accurate ball tracking using Extended Kalman Filters in order to implement high level behavior in the RoboCup 3D soccer simulation scenario. There is considerable number of works carried out on tracking problem. However, it is different from trajectory prediction. Wang et al. proposed an online intention inference algorithm to predict the intention of the human before hitting the ball in a ping-pong match between human and robot [7]. But no algorithm for prediction of ball trajectory is presented in this work. In [8], a method was presented for catching a thrown ball. They focused on the trajectory of the robot to catch the ball by using a least squares method for prediction of the ball trajectory.

Birbach et al. [9] presented a method for estimating position and velocity of multiple flying balls for the purpose of robotic ball catching. To this end, a multi-target recursive Bayes filter, the Gaussian Mixture Probability Hypothesis Density filter (GMPHD), fed by a circle detector was used. Finally, they focused on detections that are likely to lead to a catchable trajectory which increases robustness. However, their work was an estimation of the ball position. A predictor based on nearest neighbor regression was presented by Mironov and Pongratz in [10], which does not require an exact physical model of the motion. The challenge of such application consists of a high volume of calculations that are needed to compare the current trajectory with examples from the database.

A research by Baum et al. [11] presented a visual tracking and Extended Kalman Filter based prediction method for catching a flying ball with a Hand-Arm-System. In [12], a method was proposed based on probability hypothesis density (PHD) filtering for predicting the ball trajectory.

These studies were estimating the ball position, either predicting the ball trajectory with methods that have a huge amount of calculation or not focusing on rolling ball on ground with variant values of the friction. In this paper, we focused on predicting the soccer ball trajectory rolling on the ground with different values of the friction compared with the constant value of the friction. Also, we presented different possible scenarios for friction force and demonstrate which method is the best solution for each scenario. We will apply all methods to friction scenarios and demonstrate the best method by using root-mean-square error (RMSE) and normalized root-mean-square error (NRMSE) as comparison factors. The main aim of our work is to predict the trajectory of the rolling ball in order to be kicked towards the goal; however, passing the ball to another robot and using it for a goalkeeper can be other possible applications.

The rest of the paper consists of 4 sections: Sect. 2 presents our proposed prediction methods and formulations of them in details. Section 3 contains information about the friction model that is used in our research and formulation of it. Assumptions and parameters of the simulation along with simulation results are presented in Sect. 4. Finally, in Sect. 5, a summary of our work, conclusions and directions for future works are presented.

2 Prediction Methods

Ball trajectory prediction could be carried out in two different schemes: online and offline. We use three methods for online scheme and one method for offline scheme, although other methods are also available in the literature, for instance recurrent neural networks [13]. The presented methods are valid while the ball is moving on the ground, in any direction; however, without loss of generality, we denote the position by x assuming the ball is moving in X-direction.

2.1 Online Methods

In the online scheme, the trajectory is predicted while the ball is moving, without any a priori knowledge about the environment, i.e. the physical condition of the ground is unknown to the robot.

Double Exponential Smoothing Method (DES). In [14], Exponential Smoothing methods are divided into 15 classes based on trend and seasonality. Ball position, in our case, has clearly no seasonality, but it does have an increasing trend. Therefore, we adopt DES as our prediction method here. In this method, we assume that x is the position of the ball at time t. The predicted positions based on DES is obtained according to the following relations:

$$\begin{aligned} S_{i}=\alpha x_{i}+(1-\alpha )(S_{i-1}+b_{i-1}) \end{aligned}$$
(1)
$$\begin{aligned} b_{i}=\gamma (S_{i}-S_{i-1})+(1-\gamma )b_{i-1} \end{aligned}$$
(2)

where \(0<\alpha , \gamma \le 1,\) and \(\hat{x}\) represents predicted position. Also, \(\mathrm{i} = 1, 2, ..., \mathrm{n}\). \(S_{i}\) and \(b_{i}\) are calculated in n steps and are used to derive predicted position, as follows:

$$\begin{aligned} \hat{x}_{n+m}=S_{n}+mb_{n} \end{aligned}$$
(3)

Where, \(\mathrm{m = 1, 2, \ldots }\) is the number of steps ahead. When \(0\le t<T\), Eqs. (1) and (2) are used and the prediction for future positions is during \(t\ge T\) using Eq. (3), where T is determined based on the desired conditions.

There are different ways of calculating the coefficients \(\alpha \) and \(\gamma \), for instance in [15] an adaptive approach is described. We used constant values for coefficients in this work, because the defined problem is rather simplified and thus constant coefficients suffice. Nevertheless, adaptive prediction which takes prediction updates into account will be one of the important future works we are pursuing.

Autoregressive Method (AR). An autoregressive process of order p, or AR(p), is one which estimates the future value of a parameter based on a linear combination of p previous values of that parameter. An AR(p) process can be represented according to the following relation,

$$\begin{aligned} \hat{x}_{i+1}=\phi _{1}x_{i}+\phi _{2}x_{i-1}+\ldots +\phi _{p}x_{i-p+1} \end{aligned}$$
(4)

where \(\phi _{j}\), \(\mathrm{j} = 1, 2, \ldots , \mathrm{p}\), are the process coefficients and \(\hat{x}_{i+1}\) represents the one-step-ahead predicted position.

Some procedures exist in order to determine the appropriate order p; however, it has been shown that second derivative of position, i.e. acceleration, can be represented by a first-order AR model [16]. Therefore, in terms of acceleration, we can write:

$$\begin{aligned} \hat{a}_{i+1}=\psi a_{i} \end{aligned}$$
(5)

where a and \(\hat{a}\) represent the actual and predicted accelerations, respectively. Also, the relation between a and x in discrete space can be represented as:

$$\begin{aligned} a_{i}=\frac{x_{i}-2x_{i-1}+x_{i-2}}{(\delta t)^2} \end{aligned}$$
(6)

where \(\delta t\) is the corresponding sample time. Combining (5) and (6), a third-order AR model is obtained for position.

$$\begin{aligned} \hat{x}_{i+1}=(2+\psi )x_{i}+(-1-2\psi )x_{i-1}+\psi x_{i-2} \end{aligned}$$
(7)

Coefficients of an AR(p) model can be obtained through different methods. A well-known and efficient method is the Yule-Walker equations [17]. Considering the notation defined in (4), the Yule-Walker equations can be shown in matrix form as follows ((8b) is the equivalent form of (8a)).

(8a)
$$\begin{aligned} \varvec{ r=R\varPhi } \end{aligned}$$
(8b)

In (8a), \(r_{k}\), \(\mathrm{k} = 0, 1, \ldots , \mathrm{p}\), are the autocorrelation functions which are defined according to:

$$\begin{aligned} r_{k}:= \frac{c_{k}}{c_{0}} \end{aligned}$$
(9)

where \(c_{k}\) are the autocovariance functions which are defined as follows:

$$\begin{aligned} c_{k}:=E[x_{i}x_{i-k}] \end{aligned}$$
(10)

where E[.] denotes mathematical expectation. Theoretically, \( E[x_{i}x_{i-k}]\) should be computed with infinite number of observations. However, since this is not possible during an online prediction, the mathematical expectation could be approximated by proper number of observations (based on the parameter T explained in the previous section). Also note that for autocovariance function, we have \(c_{-k}=c_{k}\).

Using (9) and (10), the corresponding matrices r and R in (8a and 8b) can be obtained and, thus, the matrix of coefficients \({\varvec{\phi }}\) is achieved.

$$\begin{aligned} \varvec{\varPhi =R^{-1}r} \end{aligned}$$
(11)

For the acceleration model represented by (5), the single coefficient \(\psi \) can be obtained by using Eqs. (8a and 8b) to (11). Then, substituting the resulted \(\psi \) into (7), the third order model for one-step-ahead position is attained. To predict position m steps ahead, one should repeat the Eq. (7) m times. For instance, for \( {x}_{i+m}\) we can write:

$$\begin{aligned} \hat{x}_{i+m}=(2+\psi )\hat{x}_{i+m-1}+(-1-2\psi )\hat{x}_{i+m-2}+\psi \hat{x}_{i+m-3} \end{aligned}$$
(12)

where \(\hat{x}_{i+m-1}\) is the predicted position for m-1 steps ahead, and \(\hat{x}_{i+m-2}\) and \(\hat{x}_{i+m-3}\) are also defined in a similar manner.

Quadratic Prediction Method (QP). If we consider that the friction is the only force acting on the ball and it follows Coulomb’s law, a simplified kinetic model is attained utilizing Newton’s second law.

$$\begin{aligned} a=\frac{\sum {F}}{m_{b}}=\frac{-\mu m_{b}g}{m_{b}}=-\mu g \end{aligned}$$
(13)

where a and \(m_{b}\) are the acceleration and mass of the ball, respectively, \(\mu \) is the coefficient of kinetic friction, which is considered constant, \(\sum {F}\) represents the sum of the forces acting on the ball, and g is the gravitational acceleration.

The kinematic equation representing this motion is:

$$\begin{aligned} x=\frac{1}{2}at^{2}+v_{0}t+x_{0} \end{aligned}$$
(14)

where \(v_{0}\) and \(x_{0}\) denote the initial velocity and position of the ball, respectively, and t represents the time.

According to (13), the acceleration of the ball is constant and, thus, the position of the ball, defined by (14), represents a quadratic model in terms of time. Therefore, we can generally write:

$$\begin{aligned} x=A_{1}t^{2}+A_{2}t+A_{3} \end{aligned}$$
(15)

where \(A_{1}\), \(A_{2}\) and \(A_{3}\) are constants. If we can record three different positions at three different times at the beginning T seconds of the motion, coefficients \(A_{1}\), \(A_{2}\) and \(A_{3}\) can be readily used in order to form the equation of motion of the ball according to (15). Having the equation of motion, we can predict the position of the ball at each time during the motion for \(t\ge T\).

2.2 Offline Methods

In offline scheme the ball movement is repeated several times and the robot records the data received from the movements before the desired movement begins and learns how to predict the ball trajectory next time that the ball moves.

Self-Perturbing Recursive Least Squares (SPRLS). RLS is a recursive algorithm for determining the parameters of the system. Because of high error of RLS in low variance, we choose SPRLS [18] for predicting the ball position.

$$\begin{aligned} L_{i}=\frac{P_{i-1}\varPhi _{i}}{1+\varPhi _{i}^{T}P_{i-1}\varPhi _{i}} \end{aligned}$$
(16)
$$\begin{aligned} P_{i}=P_{i-1}(I-L_{i}\varPhi _{i}^{T})+\beta NINT(\lambda {e}_{i-1}^{2})I \end{aligned}$$
(17)
$$\begin{aligned} \hat{\theta }_{i}=\hat{\theta }_{i-1}+L_{i}(y_{i}-\varPhi _{i}^{T}\hat{\theta }_{i-1}) \end{aligned}$$
(18)

where \(e:=y-\hat{y}\) is the estimation error with \({y}:={\theta }^{T}\varPhi \) and \(\hat{y}:=\hat{\theta }^{T}\varPhi \) denoting real and estimated outputs, respectively. Also \({\varPhi }\) is vector of input parameters, \({\theta }\) is vector of estimated parameters, I is identity matrix, \({\beta }\) is design coefficient, \(\lambda \) is sensitivity coefficient, and NINT(.) function is defined as:

$$\begin{aligned} NINT(x):=&\bigg \{ \begin{gathered} x \qquad x\ge 0.5 \quad \\ 0 \quad 0\le x<0.5\\ \end{gathered} \end{aligned}$$
(19)

If we consider that the acceleration is constant, by combination of (13) and (14) we have:

$$\begin{aligned} x=-\frac{1}{2}\mu gt^{2}+v_{0}t+x_{0} \end{aligned}$$
(20)

Hence, we can write

$$\begin{aligned} -2(x-v_{0}t-x_{0})=\mu gt^{2} \end{aligned}$$
(21)

Comparison between (21) and \({y}:={\theta }^{T}\varPhi \) results in:

$$\begin{aligned} y=-2(x-v_{0}t-x_{0}) \end{aligned}$$
(22)
$$\begin{aligned} {\theta }^{T}=\mu g \end{aligned}$$
(23)
$$\begin{aligned} \phi =t^{2} \end{aligned}$$
(24)

3 Friction Model

There are several models of friction to use in simulation. Here we have used LuGre model [19] because of simplicity and also good accuracy in many cases. The formulation of this model is:

$$\begin{aligned} \begin{aligned}&F_{f}=\sigma _{0}z+\sigma _{1}\dot{z}+\sigma _{2}v \\&\dot{z}=v-\frac{\sigma _{0}\vert v\vert }{s(v)}z \\&s(v)=F_{c}+(F_{s}-F_{c})exp(-(\frac{v}{v_{s}})^{\delta _{vs}}) \end{aligned} \end{aligned}$$
(25)

where \(F_{f}\) is the friction force, \(\sigma _{1}\) and \(\sigma _{2}\) are damping coefficients that are related to the presliding and kinetic friction states, respectively, v is the velocity, the parameter \(v_{s}\) determines how quickly s(v) approaches \(F_{c}\), \(F_{s}=\mu _{s}m_{b}g\) and \( F_{c}=\mu _{k}m_{b}g \) are static friction force and coulomb friction force, respectively, \(\mu _{s}\) and \( \mu _{k}\) denote friction coefficients and \(\delta _{vs}\) is the shape factor of Stribeck curve.

We assumed two scenarios with different friction forces in order to investigate the effect of friction on prediction quality, although many other possible scenarios exist. As shown in Fig. 2, the friction in first scenario is almost constant over time. Whereas Fig. 3 shows that it is variant over time in the second scenario. The common coefficients between two scenarios are (the value for \(\delta _{vs}\) is derived from [20], while the others are chosen arbitrarily in order to obtain reasonable friction forces. Also, the mass of the ball is the standard RoboCup ball mass): \( m_{b}=0.425\,\mathrm{kg}, v_{s}=0.1\,\mathrm{\frac{m}{s}}, \delta _{vs}=1\).

Scenario 1 coefficients are: \(\mu _{s}=0.25, \mu _{k}=0.1, \sigma _{0}=30\,\mathrm{\frac{N}{m}}, \sigma _{1}=2\,\mathrm{\frac{N \, s}{m}}, \sigma _{2}=0\,\mathrm{\frac{N \, s}{m}}\) and scenario 2 coefficients are: \( \mu _{s}=0.15, \mu _{k}=0.06, \sigma _{0}=100\,\mathrm{\frac{N}{m}}, \sigma _{1}=0.5\,\mathrm{\frac{N \, s}{m}}, \sigma _{2}=0.14\,\mathrm{\frac{N \, s}{m}}\).

Fig. 2.
figure 2

First scenario friction force-time diagram.

Fig. 3.
figure 3

Second scenario friction force-time diagram.

4 Simulation

4.1 Assumptions and Parameters

In our simulation, we assumed \(T=0.5\,\mathrm{s}\), initial velocity, \( v_{0}=2\,\mathrm{\frac{m}{s}}\) and in order to compare our prediction methods, we use RMSE and NRMSE which start from \(t=T\).

$$\begin{aligned} RMSE=\sqrt{\frac{1}{M}\sum _{i=1}^{M} (x_{i}-\hat{x}_{i})^{2}} \end{aligned}$$
(26)
$$\begin{aligned} NRMSE=\frac{RMSE}{x_{\max }-x_{\min }} \end{aligned}$$
(27)

x and \(\hat{x}\) are the actual and predicted positions, respectively, and M is the total number of predicted steps. Also \(x_{\max } = x(t=t_{end})\) where \(t_{end}\) denotes the time at which the ball stops, and \(x_{\min }= x(t=0)\) for offline method and \(x_{\min }= x(t=T)\) for online methods.

We assumed DES method parameters as: \(\alpha =0.9, \gamma =0.5\)

For QP method, in order to derive \( A_{1},A_{2},A_{3}\) we need three equations. After T seconds, using positions at \(t_{1}=0\), \(t_{2}=\frac{T}{2}\) and \(t_{3}=T\) and (15) we have three equations to derive \(A_{1},A_{2},A_{3}\) then we have:

$$\begin{aligned} \begin{aligned}&A_{1} = \frac{(t_{3}x_{0}-t_{3}x_{1}-t_{2}x_{0}+t_{2}x_{2})}{t_{3}t_{2}(t_{3}-t_{2})} \\&A_{2} = \frac{-(t_{3}^{2}x_{0}-t_{3}^{2}x_{1}-t_{2}^{2}x_{0}+t_{2}^{2}x_{2})}{t_{3}t_{2}(t_{3}-t_{2})} \\&A_{3}=x_{0} \end{aligned} \end{aligned}$$
(28)

In SPRLS method, we assumed \(v_{0}=2.5\,\mathrm{\frac{m}{s}}\) for training phase and \(v_{0}=2\,\mathrm{\frac{m}{s}}\) for prediction phase. Also, RMSE and NRMSE are calculated from \(t=0\). Initial values for SPRLS method are: \(\hat{\theta }_{0}=1.962, P_{0}=1, {e}_{0}=1\) and the parameters are: \(\lambda =100, \beta =30000\).

4.2 Simulation Results

We simulated our methods by means of Simmechanics library (second generation) of MATLAB’s Simulink. Our vision system frequency is 20 Hz and in order to achieve more real results, we chose this frequency for running the simulation in MATLAB.

As can be seen in Figs. 4 and 5, the QP method has yielded by far the best result for scenario 1, where the friction force is almost constant over time. This fact can be further proved quantitatively by Tables 1 and 2, where the RMSE and NRMSE are obtained to be 0.0036 m and 0.0034, respectively, for this method. This is, however, not surprising since the predefined model in QP method is in great accordance with the friction force which is applied to the ball during the whole motion in this scenario. Apart from this, the offline SPRLS method has resulted in a good prediction with an acceptable NRMSE of 0.1913. The other two online methods, namely AR and DES, showed poorer predictions with NRMSE of 38.68% and 41.52%, respectively.

For scenario 2, Table 2 indicates that online QP and offline SPRLS still lead to more accurate predictions. However, from another perspective, the 4239% rise in the RMSE for QP method from scenario 1 to scenario 2 shows that when the friction force does not comply with the predefined model in QP, the precision of this method decreases drastically. Meanwhile, the 45.6% increase in the RMSE of SPRLS method shows that such a remarkable change has not occurred for this method. The interesting point in scenario 2 is, however, the 30% reduction of the RMSE in AR method in comparison with scenario 1, which demonstrates that this method has adapted itself better to scenario 2. But this is not the case for DES since its performance has deteriorated in scenario 2.

Looking more closely at Figs. 5 and 7, one can obviously observe that both AR and DES methods have predicted a linear trajectory for the ball, which means that the ball will move infinitely and will never stop. The same concept can be interpreted by investigating the relevant mathematical relations presented in Sect. 2.1. This is, however, not compatible with the physical reality of the problem. Therefore, it can be deduced that methods which merely rely on numerical data for prediction often fail to take the physical concepts into account, and are thus suitable for the situations where little data is available about the actual circumstances beforehand. These methods can also be utilized when the prediction is to be carried out not far into the future; linear predictions can be a good approximation of the curved ball position graph (with respect to time) dependent on the applied friction force. Of course, great care should be taken in adopting numerical methods. As discussed in the previous paragraph, AR method yielded a much better result in scenario 2 (the friction force of which was depicted in Fig. 3) than DES method. However, for a different form of friction, the same result is not guaranteed to be attained, which shows the importance of the physical conditions governing the problem.

Ultimately, it can be concluded that when the physical conditions of the ball and ground are known to a good extent beforehand, model-based methods such as online QP are suitable choices for predicting the trajectory of the ball. If, on the other hand, online predicting is not required and the opportunity for pre-training exists, offline SPRLS method provides a good chance to estimate the physical conditions governing the problem and thus to predict the trajectory by an acceptable accuracy. Moreover, online model-free or numerical methods such as AR or DES can also provide us with good predictions, but the precision of the results greatly depend on the variation of the friction force with time (Fig. 6).

Table 1. Calculated RMSE for all methods
Table 2. Calculated NRMSE for all methods
Fig. 4.
figure 4

Trajectory predicted using offline method comparing with actual trajectory in first scenario.

Fig. 5.
figure 5

Trajectory predicted using online methods comparing with actual trajectory in first scenario.

Fig. 6.
figure 6

Trajectory predicted using offline method comparing with actual trajectory in second scenario.

Fig. 7.
figure 7

Trajectory predicted using online methods comparing with actual trajectory in second scenario.

5 Conclusion and Future Works

In this paper, we aimed at predicting the trajectory of the ball for humanoid robots, which can be used for different goals such as the Goal-Kick from Moving Ball challenge in Robocup. We simulated two different friction forces and compared three online and one offline methods for this aim. The simulated scenarios were presented in one direction; however, the equations are all valid while the motion is completely on the ground.

The results of the simulations indicated that the accuracy of the prediction methods is highly dependent on the frictional condition which governs the motion. However, we concluded that if the physical conditions are known before the start of the motion, online model-based methods such QP are good candidates, while model-free AR and DES methods could be utilized online when either little information about motion is available or the time interval of the prediction is rather small. Offline SPRLS method is also useful when the robot has the opportunity to be pre-trained.

There are many directions regarding future works. First, these methods should be implemented on real humanoid robots to predict the ball trajectory in order to kick, pass or intercept the ball in real-life scenarios, since the explored friction force scenarios in this paper were only two examples of various possible ones. Predicting the three-dimensional trajectory of the ball is also of great interest. As another future direction, more realistic and human-like factors can be taken into account. For instance, the prediction could be updated and improved as the ball moves nearer to the robot by considering proper adaption laws for the presented methods. Also other factors which lead to deviation from ideal circumstances should be considered, such as small obstacles along the path of the ball, lack of perfect roundness of the ball and air drag.