## 3 System Design of Mobile Robot Person-Following System
### Robot Controller Including Target Recovery  
We defined four main states for controlling the mobile robot, that is namely, the tracking, LOP, LPP, and searching states, in addition to the initialization state, as shown in Figure 7. It is important to keep the target person in the FoV of the robot while executing the person-following task. The LOP, LPP, and searching states are called recovery states. In these states, the control module aims to maintain the robot in an active state for the recovery of a lost target using the LiDAR sensor. In the tracking state, the robot follows the target while tracking the target using a visual sensor. In the LOP state, the robot navigates to the last observed position of the target in the tracking state after the target has disappeared in the first attempt to recover the target. If the target cannot be recovered, the robot will switch to the LPP state in the second attempt. If the robot does not find the target at the LPP, it will switch to the searching state where it rotates and scans randomly in the final attempt.  
In special cases, the robot switches from the LOP to the searching state if the last observed distance is less than one meter, that is if the target is very close to the robot.  
Closed-loop control is implemented for all the states except the searching state. The linear velocity (\(V\)) and angular velocity (\(\omega\)) of the robot in the three different control states are defined as follows:\[\text{Tracking state:}\qquad\begin{array}{ll}V=k_{tv}(0.5A-a)\\ \omega=k_{tv}(320-c_{u})^{2},\end{array} \tag{9}\]  
\[\text{LOP state:}\qquad\begin{array}{ll}V=k_{tv}\sqrt{(y_{t}-y_{r})^{2}+(x_{ t}-x_{r})^{2}}\\ \omega=k_{tv}(\varphi_{t}-\theta_{r}),\end{array} \tag{10}\]  
\[\text{and LPP state:}\qquad\begin{array}{ll}V_{k}\simeq\dfrac{1}{\Delta T_{ k}}\bigg{\|}\bigg{(}\begin{array}{ll}x_{k+1}-x_{k}\\ y_{k+1}-y_{k}\end{array}\bigg{)}\bigg{\|}\\ \omega_{k}\simeq\dfrac{\theta_{k+1}-\theta_{k}}{\Delta T_{k}}. \end{array} \tag{11}\]  
where \(k_{tv}\), \(k_{tv}\), \(k_{tv}\), and \(k_{tv}\) are constants with the values of \(85\times 10^{-7}\), \(258.8\times 10^{-7}\), \(1\), and \(1\), which are empirically obtained, respectively. \(A\) is a constant that represents the camera resolution of \(640\times 480\), and \(a\) is the area of the target boundary box in a 2D image sequence in pixels. \(c_{u}\) is the center of the target box on the u axis in pixels. In the tracking state, the robot moves forward if \(a\) is less than \(0.5\)\(A\) and backward otherwise. It turns right if \(c_{u}\) is less than \(320\) and turns left otherwise. \([x_{r},y_{r},\theta_{r}]\) and \([x_{t},y_{t},\varphi_{t}]\) represent the real-world poses of the robot and the target at the LOP moment (Figure 6a). In the LOP state, the robot first turns right if \(\theta_{r}\) is less than \(\varphi_{t}\) and turns left otherwise. It then always moves forward to the LOP. \((x_{k+1}-x_{k})\), \((y_{k+1}-y_{k})\), and \((\theta_{k+1}-\theta_{k})\) are the Euclidean and angular distances between two consecutive configurations \(k,k+1\). \(\Delta T_{k}\) is the time interval for the transition between the two poses. In the LPP state, the robot moves forward to its goal unless there are no dynamic obstacles in its path. If there are obstacles, the robot moves back to avoid a collision. It turns right if \(\theta_{k}\) is less than \(\theta_{k+1}\) and turns left otherwise (more details in [37; 38]).