## 3 System Design of Mobile Robot Person-Following System
### Target Trajectory Prediction  
Target trajectory prediction is quite a significant topic in robotics in general and is especially essential in person-following robot systems. The trajectory prediction algorithm predicts the future trajectory of the target, that is the future positions of the person over time, when the target is lost. In this paper, we present a novel approach to predict the trajectory of the target based on comparing the performance of various algorithms and selecting the algorithm with the best performance. We compared a wide variety of regression models to determine the most appropriate model for online learning and predicting the trajectory data. We trained the Lasso cross-validation (LasCV), Huber regressor (HR), VBLR, and linear regression (LR) models by fitting the trajectory data obtained at the corners in the environment. The blue and black bars in Figure 5 indicate the \(R^{2}\) scores for the accuracy and time for the computation time, respectively. Among the models with high accuracy, we chose the LR model, which is the fastest model, for our trajectory prediction. All the models were implemented using Scikit-learn [34], a powerful machine learning library [35]. A scenario in which the target is lost and recovered by path prediction is shown in Figure 6. Figure 6a shows a person turning 90\({}^{\circ}\) at a corner and suddenly disappearing from the FoV of the robot. The person turns at the corner at \(t_{0}\) (Figure 6a) and disappears from the FoV of the camera at \(t_{1}\) (Figure 6b). The robot predicts the target's trajectory and then plans the global and local planners to recover the tracking of the person at \(t_{n-1}\) (Figure 6c). The trajectory prediction algorithms rely only on the stored past trajectory information. Figure 5: Comparison of regression model accuracy and computation time. Therefore, the mobile robot estimates and stores the time series-based positions of the target person while tracking the target person using the RGB-D sensor. The training data \(D_{tr}\) consist of \(m\) pairs of \((x,y)\) positions with their associated timestamps \(t_{k}\):  
\[D_{tr}=((x_{0},y_{0}),t_{0}),\ldots,((x_{1-m},y_{1-m}),t_{1-m}) \tag{4}\]  
where \(t_{k}>t_{k-1}\) for \(k=0,\ldots,1-m\). The input of the person positions along the \(x\) coordinate is \(\mathbf{x}=x_{0:1-m}\); that along the \(y\) coordinate is \(\mathbf{y}=y_{0:1-m}\); and the corresponding timestamps are \(\mathbf{t}=t_{0:1-m}\). We adopted the linear regression model in this work and then applied the second-order polynomial with a constrained output of one of the coordinates to predict the target trajectory using an online method. The approach consists of the following four steps: In the first step, the last 50 positions, which are empirically obtained and critical, are used only in the training module. Thus, \(m=50\). These data are feed into the linear regression model as the input. In the second step, the relationship between the dependent variables \((x,y)\) and the independent variable \((t)\) is modeled. In simple linear regression, the model is described by:  
\[ \begin{array}{l}x=a_{1}t+b_{1}\\ y=a_{2}t+b_{2}.\end{array}  \tag{5}\]  
In the third step, a second-order polynomial is applied to predict the trajectory of the target as follows:  
\[ \begin{array}{l}x=a_{1}t^{2}+b_{1}t+c_{1}\\ y=a_{2}t^{2}+b_{2}t+c_{2}\end{array}  \tag{6}\]  
where \(a_{1}\), \(b_{1}\), \(c_{1}\), \(a_{2}\), \(b_{2}\), and \(c_{2}\) are arbitrary parameters that are estimated from the data. The linear regression model is transferred from a first-order model to a second-order one. This transformation is a common approach in machine learning for adopting trained linear models to nonlinear functions while retaining the speed of the linear methods. The model is still a linear regression model from the point of view of estimation [36]. In the fourth step, the output of one of the coordinates is constrained. The trajectory consists of \(m\) pairs of \((x,y)\) positions on the 2D plane.