**4. AI-based approach**

An AI-based approach is adopted for solving the estimation problem. The reason for this is that a combination of different types of sensor data should be handled, and the definition of long or short lawn grass is determined by the height of the lawn grass cutter from the ground. Moreover, a human operator estimates the length of a lawn grass based on sounds made by the lawn grass cutter while cutting grasses. Estimation using an AI-based approach is expected to be more efficient and accurate than estimation based on human judgment. The RF algorithm and SNN are adopted considering the execution speed in real-world applications.

#### **4.1 Random Forest algorithm**

The RF algorithm, a machine learning algorithm, originates from Breiman [17], and recently, its deep version has also been proposed [18]. This algorithm is used for classification, regression or clustering, etc. and is a type of ensemble algorithm using a set of decision trees as weak learners to avoid over-fitting and to maintain its high generalization performance. It is fast and achieves a comparatively high performance. According to the study [18], the deep RF algorithm achieves better results in specific applications while performing nearly as well in other wide applications. In the following, a specific RF algorithm is developed.

*4.1.1 Configuration of binary decision tree*

*Construction of binary decision tree.*

classification phase.

**127**

**Figure 4.**

**Figure 5.**

*Random forest algorithm.*

*AI-Based Approach for Lawn Length Estimation in Robotic Lawn Mowers*

*DOI: http://dx.doi.org/10.5772/intechopen.97530*

*4.1.2 Classification of data*

An example of a binary decision tree is shown in **Figure 5**. In the root node, the input data are divided into two subsets using the conditions, *x*<sup>1</sup> < *c*<sup>1</sup> and *x*<sup>1</sup> ≥*c*1. If the data satisfy the condition *x*<sup>1</sup> <*c*1, the data are classified into the class *l*<sup>1</sup> as shown in this figure. When all data are classified into the corresponding classes (that is, leaves), the binary decision tree is completed. Here, for example, a classification and regression tree algorithm is used for classification, and the objective function is Gini's diversity index [18]. All parameters in binary decision trees are used in the

For example, Bagging, an ensemble algorithm, is used for data classification. In this case, data that should be classified are distributed to all binary decision trees, and the decision of each binary decision tree is obtained. The final decision, that is,

An RF algorithm consists of a given number of binary decision trees. The training and inference phases of the algorithm are shown in **Figure 4(a)** and **(b)**, respectively. In the configuration of binary decision trees, a set of training data sampled from input data is given to each of the binary decision trees. Then, the binary decision trees are constructed, as shown in **Figure 5**.

The data consist of the followings:

f g *ni* ð Þ *i* ¼ 1, 2, ⋯, *p* : input data for classification, regression or clustering, etc. f g *xi* ð Þ *i* ¼ 1, 2, ⋯, *q* : features for classifying input data f g *ni* .

*AI-Based Approach for Lawn Length Estimation in Robotic Lawn Mowers DOI: http://dx.doi.org/10.5772/intechopen.97530*

#### **Figure 4.**

inertial measurement units (IMUs), MPU-9250 [16], are attached inside and to the surface of the robo-mower to measure acceleration and angular acceleration. Six built-in sensors are available for measuring the corresponding parameters as shown in **Table 1**. Here the noise of sensors is negligibly small; however, outliers are excluded in the Digital Twin. The adequate fusion of these sensors is determined in

The estimation problem of lawn grass lengths and ground conditions is defined below. The problem is to estimate lawn grass lengths in real time using sensor fusion

**Input:** set of available sensors, robo-mower's specifications, set of areas labeled. long lawn grass, short lawn grass, and without lawn. grasses, some of which are

**Output:** fusion of sensors necessary for estimation and estimation results for test

An AI-based approach is adopted for solving the estimation problem. The reason for this is that a combination of different types of sensor data should be handled, and the definition of long or short lawn grass is determined by the height of the lawn grass cutter from the ground. Moreover, a human operator estimates the length of a lawn grass based on sounds made by the lawn grass cutter while cutting grasses. Estimation using an AI-based approach is expected to be more efficient and accurate than estimation based on human judgment. The RF algorithm and SNN are

The RF algorithm, a machine learning algorithm, originates from Breiman [17], and recently, its deep version has also been proposed [18]. This algorithm is used for classification, regression or clustering, etc. and is a type of ensemble algorithm using a set of decision trees as weak learners to avoid over-fitting and to maintain its high generalization performance. It is fast and achieves a comparatively high performance. According to the study [18], the deep RF algorithm achieves better results in specific applications while performing nearly as well in other wide applications. In the following, a specific RF algorithm is

An RF algorithm consists of a given number of binary decision trees. The training and inference phases of the algorithm are shown in **Figure 4(a)** and **(b)**, respectively. In the configuration of binary decision trees, a set of training data sampled from input data is given to each of the binary decision trees. Then, the

f g *ni* ð Þ *i* ¼ 1, 2, ⋯, *p* : input data for classification, regression or clustering, etc.

binary decision trees are constructed, as shown in **Figure 5**.

f g *xi* ð Þ *i* ¼ 1, 2, ⋯, *q* : features for classifying input data f g *ni* .

The data consist of the followings:

each of the proposed algorithms, and this is verified in the experiments.

data. The objective function is to increase the accuracy of estimation.

**Objective Function:** maximization of estimation accuracy.

adopted considering the execution speed in real-world applications.

**3.3 Estimation problem of Lawn grass lengths**

The Estimation Problem.

*Robotics Software Design and Engineering*

specified as test areas.

**4. AI-based approach**

**4.1 Random Forest algorithm**

developed.

**126**

areas.

*Random forest algorithm.*

**Figure 5.** *Construction of binary decision tree.*

#### *4.1.1 Configuration of binary decision tree*

An example of a binary decision tree is shown in **Figure 5**. In the root node, the input data are divided into two subsets using the conditions, *x*<sup>1</sup> < *c*<sup>1</sup> and *x*<sup>1</sup> ≥*c*1. If the data satisfy the condition *x*<sup>1</sup> <*c*1, the data are classified into the class *l*<sup>1</sup> as shown in this figure. When all data are classified into the corresponding classes (that is, leaves), the binary decision tree is completed. Here, for example, a classification and regression tree algorithm is used for classification, and the objective function is Gini's diversity index [18]. All parameters in binary decision trees are used in the classification phase.

#### *4.1.2 Classification of data*

For example, Bagging, an ensemble algorithm, is used for data classification. In this case, data that should be classified are distributed to all binary decision trees, and the decision of each binary decision tree is obtained. The final decision, that is, the class to which the data belong, is determined on the basis of the majority rule. This process is faster if the binary decision trees are executed in parallel, and the decision quality is higher than if only one binary decision tree is used. As a 1D simulator, or a Virtual Twin, processing time for estimating the target area is essential.

*4.2.2 Application of shallow neural network*

*DOI: http://dx.doi.org/10.5772/intechopen.97530*

*AI-Based Approach for Lawn Length Estimation in Robotic Lawn Mowers*

trained independently.

*5.1.1 Measurement data*

collected sensor data.

**Figure 7.**

**129**

*Remote-controlled driving of Robo-mower.*

**5. Experimental results**

SNN on real-world sensing data.

**5.1 Experiments on RF algorithm**

In the following, two SNN models are developed with a cascade connection. The first model estimates the target areas that are with or without lawn grasses because this can be distinguished according to the acceleration of the robo-mower operating in a corresponding area. The second model estimates the height of the lawn grass as long or short. It is expected that this might be determined by checking the current of the motor depending on the load on the cutting blade. These two models are connected in series, that is, a cascade configuration. Furthermore, these SNNs are

This section focuses on the experiments and evaluations of the RF algorithm and

The data measured by the sensors are obtained by driving the robo-mower on a field with long lawn grasses and short lawn grasses as well as without lawn grasses. The actual remote-controlled robo-mower is shown in **Figure 7**. The remote-control system through Bluetooth communication is incorporated in the robo-mower by mounting a mini-PC and running an ROS on it. The mini-PC can also handle the

#### **4.2 Shallow neural network**

As another AI-based approach, a SNN is used. "Shallow" means it has only one hidden layer, and this is expected to fasten processing. The estimation performance of SNN is compared with that of the RF algorithm.

#### *4.2.1 Design of shallow neural network*

The deep neural network performs well in image recognition, and it has been used in autonomous driving of automobiles, appearance inspection, image recognition of robots, and other applications. However, it requires a large amount of training data, and accordingly, a huge amount of processing time is needed in network training. In addition, the inference should also be executed on a GPU machine. On the contrary, the size of signal data is not so big because they are timeseries, and no deep neural network may be needed for its recognition. For example, the on-line hammering sound inspection based on the simplest neural network with no hidden layers, a support vector machine, achieves more than 99% accuracy within a short time [19].

In the following, an SNN, as shown in **Figure 6**, is constructed. Here, the number of hidden layers is only one, and this layer has ten neurons. The number of neurons in the input layer equals the size of input signal length or statistical features such as the maximum value, minimum value, average value, median value, standard deviation value, peakedness value, and skewness value, all of which are obtained from the input sensor signal. The number of neurons in the output layer is two, that is, areas with or without lawn grasses, or with short or long lawn grasses. A hyperbolic tangent activation function and a softmax function are incorporated into the output layer.

**Figure 6.** *Shallow neural network configuration.*

*AI-Based Approach for Lawn Length Estimation in Robotic Lawn Mowers DOI: http://dx.doi.org/10.5772/intechopen.97530*
