# Autonomous and Safe Navigation of Mobile Robots in Vineyard with Smooth Collision Avoidance
## 2 Pillar Detection from Lidar Sensor Data
For safety, it is ideal for the robots to navigate the center of the vineyard lane (\(x=\frac{\mathrm{W}}{2}\)), keeping ample distance from grapes on both the sides. Hence, one of the points is (\(x=\frac{\mathrm{W}}{2},y\)). The three points of the first set for the robot to shift in either direction are given as,

\[P=\Big{\{}\mathrm{A:}\left(\frac{\mathrm{W}}{2},y\right)\mathrm{,B:}\Big{(} \frac{\mathrm{W}}{2},y+\psi_{1}\Big{)}\mathrm{,C:}\Big{(}\frac{\mathrm{W}}{ \lambda},y+2\psi_{2}\Big{)}\Big{\}}. \tag{8}\]

Here, the point \(\mathrm{A=(\frac{\mathrm{W}}{2},y)}\) and \(\mathrm{B=(\frac{\mathrm{W}}{2},y+\psi_{1})}\) are on the center of the lane. Assuming that the robot is shifting towards the left for collision avoidance, the point \(\mathrm{C=}(\frac{\mathrm{W}}{\lambda},y+2\psi_{2})\) lies on the left side of the corridor. The parameter \(\lambda\) controls the distance of the trajectory from the left lane of the vineyard. Considering the width of the robot, we set \(\lambda\) to 4, which generates a trajectory at a distance of \(\frac{\mathrm{W}}{4}\) from the left vineyard lane. The parameter \(\psi_{1}\) determines the starting point of the turn on the current trajectory, while the parameter controls the turning point after the robot has crossed the obstacle. After that, the robot must maneuver to resume the center of the lane. This requires the generation of the second set of three points which are given as,

\[P^{\prime}=\left\{\mathrm{D}:\left(\frac{\mathrm{W}}{\lambda},\mathrm{y_{t}} \right)\right.\mathrm{E}:\left(\frac{\mathrm{W}}{\lambda},\mathrm{y_{t}}+\psi_{ 2}\right)\right.\mathrm{F}:\left(\frac{\mathrm{W}}{2},\mathrm{y_{t}}+2\psi_{2} \right)\right\}. \tag{9}\]

Figure 6b shows the six points \(\mathrm{A},\mathrm{B},\mathrm{C},\mathrm{D},\mathrm{E}\) and \(\mathrm{F}\). Figure 6b shows the scenario of a vineyard lane with grapes on either side shown by small circles. A person is shown as an obstacle. The smooth trajectory for collision avoidance is shown in red color. It should be noted that a total of four circles needs to be fitted in the trajectory for collision avoidance. The first segment is fitted using points \(\mathrm{A},\mathrm{B}\) and \(\mathrm{C}\). The other three segments are fitted using points \(\mathrm{\{B},\mathrm{C},\mathrm{D}\}\), \(\mathrm{\{C},\mathrm{D},\mathrm{E}\}\), and \(\mathrm{\{D},\mathrm{E},\mathrm{F}\}\), respectively. The overall algorithm for obstacle avoidance is given in Figure 7. First, Algorithm 1 is used to detect the pillar positions. Next, the robot centers itself in the center of the lane and stars navigation. If an obstacle is detected, Lidar data are used to estimate its position, whether the obstacle is dynamic or static, and its relative speed if the obstacle is dynamic. Since the robot navigates the center of the lane, it decides the direction of turn (i.e., left or right) to avoid the obstacle. This is typically the opposite direction of the obstacle's position. Next, for the first maneuver, a set of three points (\(P\)) are set and the robot executes the turn on the smooth trajectory. The robot then moves in a straight line keeping a safe distance from the grapes. Once the robot has crossed over the obstacle on the straight path, a set of three new points (\(P^{\prime}\)) are generated, as given in Figure 7. The robot then executes another smooth turn to come back to the center of the lane. Once this has been performed, the robot continues its navigation through the center of the vineyard's lane. Figure 6: Smooth obstacle avoidance. (**a**) Generation of smooth trajectories at turns using segments of circular arcs. (**b**) Obstacle avoidance using smooth trajectories shown in red color keeping a safe distance from the crop. Estimating the position of a person is straightforward with a 2D Lidar sensor. The robot has a SLAM (simultaneous localization and mapping) module, which gives the current coordinates of the robot \((x_{t}^{r},y_{t}^{r})\) at time \(t\).