*3.6.3 Other machine learning algorithms*

Machine learning is a vast field of artificial intelligence, which includes many learning and modelling approaches. Another algorithm which could be an alternative solution to this problem is to implement the K-nearest-neighbour search algorithm, which is one of the most known unsupervised learning algorithms used for data clustering and classification. This is explained briefly in [17] as "Nearest neighbour search is an optimization technique for finding closest points in metric spaces. Specifically, given a set of n reference points R and query point q, both in the same metric space V" [17].

This would allow a training set similar to that of a neural network; however, here, they are all stored alongside their relevant move instruction. In larger data sets, this could be very beneficial, as there would be a large training set to compare to; however, with such a simple task as this, autonomous car application, it could be considered "overkill" as the potential for undertraining is too high. Furthermore, in safety-critical situations such as a car driving, a "best guess" kind of algorithm may not return the best results; should an anomaly arise, it could have serious repercussions.

## *3.6.4 Libraries for machine learning*

There are two commonly used C/C++ libraries which support machine learning, FANN and OpenCV. The decision was made to use OpenCV due to the fact that it is much more well-documented and has a tutorial part of their documentation which is considered to be very helpful. Furthermore, neither FANN's documentation nor the library itself has been modified since 2007, which deems it potentially outdated for newer versions of C++ [18].

### *3.6.5 Compelling performance constraints*

The developed system carries a variety of performance constraints. The Raspberry Pi does not have high processing capabilities, and thus the network needed to be efficient enough for the device to get at least five MLP runs per second in order to run smoothly. The amount of time between calculations will directly affect the quality of the cars' driving ability. This study is however merely a proof of concept, and thus a high processing power is not necessary to prove the concept works.

A further performance constraint would be in relation to the quality of the driving of the vehicle, for example, it could be very jittery when driving or be quite smooth—this is all proportionate to the amount of computations the neural network can do per second. If the computation power of the Pi means that this is quite slow, naturally, the vehicle will not be 100% accurate in staying between the lines, whereas if it can be developed to work efficiently, this may be less of a problem and the vehicle will drive more "smoothly".

A solution's quality could be measured in terms of the number of errors/stops the vehicle makes in a given time frame, and the lower this value is, the more efficient the device is.

#### **3.7 Hardware design and implementation**

Below is the design of the hardware side of the system, excluding the external camera; we used two motors to control drive and steering and two HC-SR04 ultrasonic distance sensors to ensure for obstacle detection (**Figure 5**).

**311**

*Computational Efficiency: Can Something as Small as a Raspberry Pi Complete…*

Implementation of the hardware can be a challenge without the correct equipment. Following the initial designs, in the prototyping stage, a breadboard was used (see above) to manually switch wires and avoid soldering until the circuit was fully working. However, breadboards are not a long-term solution, and the wires will begin to fall out of the sockets, so at the point that a working circuit is created, it

This then allows the creation of a long-term solution: a custom printed circuit board (PCB) soldering is required to do this, but it is much more secure and thus more reliable, especially in projects which experience a high level of movement.

A more modular layout is required for a project of this sort, because it is designed to be totally mobile and adaptable to different circumstances.

Consequently, a Scalextric-type (modular) approach with around 6 corners and 10

The turning circle of the car required a large space, and the size of an A2 paper was chosen to make a modular-type design of which various sheets could contain

should be noted down in a form such as this (**Figure 6**).

PCB designs usually represent the following (**Figure 7**).

different directions which led to the following two possibilities:

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

*3.7.1 Hardware circuit design*

*System design architecture of hardware.*

**Figure 5.**

**3.8 Track design**

straight pieces would be a good idea.

*Computational Efficiency: Can Something as Small as a Raspberry Pi Complete… DOI: http://dx.doi.org/10.5772/intechopen.88342*

**Figure 5.** *System design architecture of hardware.*

*Control Theory in Engineering*

same metric space V" [17].

*3.6.4 Libraries for machine learning*

for newer versions of C++ [18].

*3.6.5 Compelling performance constraints*

the vehicle will drive more "smoothly".

**3.7 Hardware design and implementation**

efficient the device is.

repercussions.

*3.6.3 Other machine learning algorithms*

Machine learning is a vast field of artificial intelligence, which includes many learning and modelling approaches. Another algorithm which could be an alternative solution to this problem is to implement the K-nearest-neighbour search algorithm, which is one of the most known unsupervised learning algorithms used for data clustering and classification. This is explained briefly in [17] as "Nearest neighbour search is an optimization technique for finding closest points in metric spaces. Specifically, given a set of n reference points R and query point q, both in the

This would allow a training set similar to that of a neural network; however, here, they are all stored alongside their relevant move instruction. In larger data sets, this could be very beneficial, as there would be a large training set to compare to; however, with such a simple task as this, autonomous car application, it could be considered "overkill" as the potential for undertraining is too high. Furthermore, in safety-critical situations such as a car driving, a "best guess" kind of algorithm may not return the best results; should an anomaly arise, it could have serious

There are two commonly used C/C++ libraries which support machine learning, FANN and OpenCV. The decision was made to use OpenCV due to the fact that it is much more well-documented and has a tutorial part of their documentation which is considered to be very helpful. Furthermore, neither FANN's documentation nor the library itself has been modified since 2007, which deems it potentially outdated

The developed system carries a variety of performance constraints. The Raspberry Pi does not have high processing capabilities, and thus the network needed to be efficient enough for the device to get at least five MLP runs per second in order to run smoothly. The amount of time between calculations will directly affect the quality of the cars' driving ability. This study is however merely a proof of concept, and thus a high processing power is not necessary to prove the concept

A further performance constraint would be in relation to the quality of the driving of the vehicle, for example, it could be very jittery when driving or be quite smooth—this is all proportionate to the amount of computations the neural network can do per second. If the computation power of the Pi means that this is quite slow, naturally, the vehicle will not be 100% accurate in staying between the lines, whereas if it can be developed to work efficiently, this may be less of a problem and

A solution's quality could be measured in terms of the number of errors/stops the vehicle makes in a given time frame, and the lower this value is, the more

Below is the design of the hardware side of the system, excluding the external camera; we used two motors to control drive and steering and two HC-SR04 ultra-

sonic distance sensors to ensure for obstacle detection (**Figure 5**).

**310**

works.
