Design and implementation of auto car driving system with collision avoidance

: This paper presents designing and manufacturing the hardware and software of a low-cost robotic system, which can be installed into any petrol car with an automatic gearbox, giving the ability to a car to be driverless. The proposed approach is composed of three systems; first, a computer vision system detects the lane located ahead of the vehicle to provide a reference angle for the steering wheel; second, to make the proper decision, a control and collision avoidance system are implemented, which are responsible for collecting sensors data and perform the right action by applying a closed-loop control system; third, the electro-mechanical system, which physically controls the steering wheel, braking and accelerating of the vehicle by actuators. The proposed system has been tested on-ground in several experiments and returned with acceptable results.


PUBLIC INTEREST STATEMENT
Self-driving cars are getting more attention these days; they will take an essential role in our future. What we have tried to achieve in this paper is designing a low-cost hardware system that can be installed on any car to be turned into an autonomous vehicle, this achievement facilitates to researchers from the entire globe to develop and maintain their research without the barrier of high cost. We used simple motors to steer the steering wheel and drive pedals of the vehicle. A computer takes feedback from cameras and sensors to recognize the surrounding environment and control the vehicle autonomously, preventing any collisions and following a pre-determined path.

Introduction
Cost has always been a barrier to turn self-driving cars from blueprints into real world, this kind of technology is for a little portion of buyers only, which prevents human transportation from being moved to the next stage of future. However, regardless of the cost problem, many commercial self-driving vehicles have been achieved, such as Google (2017), Tesla (2017), and many other corporations which all of them relies on designing specific high-tech cars to be driverless. However, what about old, non-high-tech cars?
Because of a high percentage of old cars exist presently (ACEA, 2017), a possible solution is to focus on upgrading old cars instead of replacing them with expensive ones, following this approach allows more cost-effective and economical solution and results in evolution of humanity transportation outside the restriction of economical boundaries. Massive efforts were made in the academic community for this field of study, authors in Molina, Echeverry, Vasquez, & Mendez (2013) introduced an approach based on modifying the inputs of the vehicle. In many studies, (Hasunuma et al., 2003;Paolillo, Cherubini, Keith, Kheddar, & Vendittelli, 2014;Rasmussen, Sohn, Wang, & Oh, 2014) and (Yokoi et al., 2006) authors proposed an anthropomorphic humanoid robot which is able to be fit in the driver seat and drives the vehicle. Although these approaches do not require permanent vehicle modifications, but they can be very complex and hard to manufacture. Authors in Tsugawa, Yatabe, Hirose, & Matsumoto (1979) and Shoval, Zyburt, & Grimaudo (1998) propose another approach by designing a non-anthropomorphic robotic driver. However, it was not clear in Tsugawa et al. (1979) how it was designed, but (Shoval et al., 1998) has a complex design; thus a considerable assembly time, authors mentioned that it could take up to 4 h to be assembled. As a solution for complexity problem, authors in Namik, Inamura, & Stol (2006) proposed a much simpler design, but it has no robust steering system.
On the commercial side, some robotic drivers have already released Stahle Robot Systems for cars (2017) and Kairos Autonomi (2017) introduce a reliable driving system, but those models are complicated and much expensive.
Robotic drivers are an important field of study and industry, because relying on robotic drivers prevents the modification of vehicles and allows more dynamic solutions to be applied in real world. As a result of previous points, the goal which this paper achieved is designing an autodriving system that follows three criteria; ease of implementation and avoidance of customization of the vehicle, low complexity and ease of manufacturing, and finally low cost. The remaining sections of the paper are; Section 2 presents the developed system and its components. Section 3 describes the mechanical design of the proposed system. Section 4 focuses on steering modelling and self-driving capabilities. Brake and acceleration systems are investigated in Sections 5 and 6 respectively. Section 7 contains the experiments and the results. Finally, the paper is concluded in Section 8.

System design overview
The proposed robotic-driver system has two working modes. The first mode is used when people want to control the vehicle remotely; an application installed on Android smartphone sends control signals via UDP to the onboard Cubieboard2 wirelessly. The Cubieboard2 and the smartphone are connected via WIFI through the onboard access point, the single-board computer Cubieboard2 receives the UDP signals and makes the proper output to GPIO pins, allowing full control of car's braking, acceleration, and steering. See Figure 1(a).
The second mode is the autonomous mode, which makes the vehicle capable of following a predeterment path and avoid collision without human intervention. A camera placed at vehicle's bumpers sends a direct feed to onboard PC, then the image recognition software detects the centre line of the lane and calculates the amount of error to send the proper commands to the steering system. In addition, ultrasonic sensors placed at vehicle's bumpers scan the lane region plane located ahead of the vehicle, if any obstacles are detected, a stop command is sent to the braking system for stopping the car thus avoiding collision. See Figure 1 However, some assumptions were taken into consideration to simplify work conditions without affecting the novel approach.
• Due to the small area of testing ground, increasing car velocity was not needed, thus, throttle pedal is available to be controlled manually in wireless mode. In autonomous mode, the vehicle operates using the idle speed of the engine.
• The car engine assumed to be already running and the automatic gearbox is on drive mode (D).

Mechanical design
The control of steering is based on fixing a gear on steering wheel and a pinion beneath it ( Figure  2), the pinion and the gear mesh together allowing movement of steering wheel by achieving 1:7 transmission ratio; a stepper motor connected to the pinion generates a high torque sufficient to rotate the steering wheel.
Before manufacturing process, several simulations were run on Solidworks. Spur gears were selected due to (1) parallel-shaft relation and (2) both of gears are on the same plane.
All the mechanical systems are fixed on the main base; a part which holds all the systems and maintains a static position allowing them to operate without displacement, also, the base allows dynamic positioning proportional with measurements of each car model. Figure 3 shows steering motor holder, which guarantees a free angle and dynamic height ((a) and (b) on Figure 3), brake actuator holder is designed to stand the push force caused by hydraulic brakes of a car and also has a dynamic height as shown in Figure 3(c). Finally, the throttle actuator holder which does not need as much push force as brake system, thus a simpler approach was implemented as shown in Figure 3

Steering system
4.1. Steering system modelling Modelling the steering system is necessary to verify the controller design, and to find the angle relationship between the steering wheel and tires of the vehicle (See Figure 5).   A gravitational sensor fixed on both of steering wheel and front tires collected the data. The starting point is assumed to be when steering wheel is turned to the far left, this assumption resulting three sequential revolutions shown in Figures 6-8 respectively; The collected data were used in interpolation operation to derive the desired polynomial function; however, the results exhibited non-linearity in steering system due to the Ackermann geometry.
The following equation shows the concluded function using MATLAB:

Path recognition
Path detection in some of previous works was based on using infrared sensors (Jen & Mai, 2012); however, the system presented operates in outdoor circumstances, which is due to exposure to dust, sunlight, and many other weather conditions. An additional key element to take into consideration is the soil type and colour of the testing ground, the experiments of the vehicle were performed in a sandy and very dusty soil, and thus the image recognition has to be robust to prevent any malfunction during on-ground tests. A black line was placed in centre of the road; the image recognition software detects the line and performs error calculation algorithms allowing path correction of the vehicle.
The developed line extraction algorithm is described in Figure 9; first, to get accurate measurements, the camera has to be calibrated in order to correct the distortion. After conversion to grayscale, morphology operations are applied to remove the soil background and reduce any unnecessary information contained in the image. After binary conversion and skeleton generation, a sequence of morphology filters is applied to eliminate any noise in the resulting image. At the end, Hough transformation returned the straight lines contained in the image, allowing error calculation of angle and displacement of the line.  The presented algorithm is implemented using OpenCV library and C# programming language via a camera with a resolution of 640 × 480 pixels and 30 FPS. To detect the line with minimum error rate, the camera is fixed on the forward bumper of the vehicle, which is 35 cm above the ground (see (a) on Figure 10) and with 60°slope as shown in (b) on Figure 10: The camera is directed towards the line, which captures the required portion of the line needed to make error calculation, Figure 11 shows the displacement error annotated by (a):

Electronic and electrical design of the steering system
A hybrid stepper motor has been selected due to its ease of controlling and high precision. Sanmotion 103H7128-5810 stepper model from SANYO-DENKI is chosen for the steering actuator. The motor has a torque of 2.0 Nm with rated current of 3.0 A, and the core of its driver is an Atmel  The interface between stepper driver and PC is based on vUSB library (V-USB, 2017) and Atmel 8bit Microcontroller, following this approach allows much easier and economical approach for system design. Figure 12 shows the block diagram of the electronic system, the PC sends the desired commands to stepper driver via vUSB interface, and real-time feedback of stepper motor coils are returned to PC for angle determination.

Stepper Motor
Stepper Driver

Control flow of the system
Determining the data flow between every micro-system is an important step before choosing a control flow of the steering system. Figure 13 shows the selected approach for angle error correction of the steering system, the lane recognition software calculates the error angle of front wheels, and a steering wheel rotation angle is calculated based on the approach introduced in Section 4.1. (See Figure 13(a)). The relation between steering wheel and motor is determined by gear ratio presented in Section 3 (see Figure 13(b)). Finally, the motor coil steps are calculated based on the selected motor specification (see Figure 13(c)). Figure 14 shows the logic behind steering system. However, after experiments, steering system failed to respond in some situations due to the high torque required to drive the steering wheel from its stationary state. To solve the previous problem, the steering wheel must be given some initial torque to overcome the resistance of inertia caused by accelerating. PWM duty cycle of the motor is increased by 5% when moving from hold state.

Obstacle detection
Ultrasonic sensors are fixed on vehicle's forward bumper (see Figure 15), which are able to scan the front area for any obstacles within 3.5 m.
A specially designed circuit which has an Atmel 8-bit Microcontroller does the echo calculations to detect if an obstacle is ahead of the vehicle, if any, a signal is sent through vUSB interface to onboard PC, which will send brake signal to stop the car (see Figure 16).

Electronic and electrical design of the brake system
A linear actuator must interface with hydraulic brake system of the car, which needs a high force in almost all car models. To overcome this issue, Linak LA31 linear actuator has been selected to operate brake system. The selected actuator has push force max to 6000 N with rated current of  0.5 A. The core of the actuator driver is Atmel 8-bit Microcontroller. Figure 17 shows the implementation of the brake system.

Control flow of the system
The control flow of collision system is simple; ultrasonic sensors scan the lane in front of the vehicle, a brake command is sent in case of any obstacle is detected, Figure 18 shows the flowchart of the system.

Acceleration system
The acceleration system of the vehicle is controlled in manual mode by a push-pull actuator. Eagle Master CL-500 actuator was selected, which gives basic control of acceleration to one speed only.

Experiments and results
The total cost of implementing the driver system is $510. Assembly time is less than 80 min. All the circuits and mechanical parts were designed from scratch and manufactured locally to achieve low-cost criterion. Image recognition was run using an onboard PC with Intel Core i7-3630QM processor at 2.4 GHz with 12 GB of RAM.
Tests were conducted at a field located in the University of Aleppo campus, which has an area of 7,500 m 2 with 100 m high and 75 m width. Due to the limited size of the area, the vehicle operated at 15 km/h speed autonomously. A calibration phase of lane recognition software at the beginning of each experiment had to be done for adapting brightness and correcting weather-related anomalies.

Steering system experiment
Following method presented in Section 4.2, the image recognition software was able to recognize the line and calculate the error from a live capture during on-ground tests which are presented in Figure 20.
Applying a closed-loop control algorithm (presented in Section 4.4) results in the following data set, which represents the displacement error during a live experiment. Figure 21 exhibits the ability of the system to control steering of vehicle to minimize the error, however, more advanced control methods can be applied in future to improve the smoothness of line following.

Braking system experiment
The ultrasonic system was able to detect up to 3.5 m in outdoor conditions, which is agreeable with experiment parameters (velocity at 15 km/h with 100 × 75 m testing ground), more robust sensor fusion can be applied in future research.  However, the data showed some discontinuities in obstacle detection (from 1.5 to 2 s in Figure  22) which is due to the shape of human body, but most importantly, the brake command was sent as soon as the ultrasonic detected the obstacle at 1.5 s with 3.4 m ahead, and stopped with 0.6 m ahead.
Other unexpected circumstances could happen during live experiments, such as power and hardware failures, it was important to address the safety of the vehicle through the following points: • The system has a backup power source in case of power failures.
• All circuits of the system are isolated using Photocouplers.
• In case of any unexpected failure detected, braking system will automatically stop the vehicle.
More safety features to be added in future work.

Conclusion and future work
The paper has introduced a simple and robust robot system capable of driving different types of vehicles without the need for any modifications. First, after modelling and simulation of steering system, we developed the lane recognition software, which gave the ability to the vehicle to follow a pre-determined path. Second, auto braking system was implemented using the feedback of ultrasonic sensors. Third, the electro-mechanical system was able to physically control steering wheel, brake pedal, and throttle pedal of the vehicle. The prototype was successfully tested in several experiments and under different conditions, which exhibited the reliability of the proposed system. However, due to the limited size of the testing ground, tests were performed at low speed only, which did not give the opportunity to develop and test the system at high speed. The team currently is working on testing the system on real streets and at high speed, also to develop more practical and compact mechanical system allowing more flexibility.