Abstract
The autonomous vehicle can recognize and understand environment, self-control, and achieve the driving level of the human driver. To create this kind of system, the following work was carried out: (a) a real time lane detection system is proposed, based on vision system functions, using webcam camera; (b) In order to detect curve lanes, deep learning is applied for lane detection, based on fully Convolutional Neural Network (CNN); (c) The cubic spline interpolation method is used for path generation, based on Global Positioning System (GPS) data, where distance between two adjacent path generation points is same. Compared with the connection method of the cubic polynomial fitting algorithm, the curve fitted path by the cubic spline interpolation method is smoother and more satisfied with the vehicle motion pattern; (d) Based on frenet coordinate frame, optimize trajectory planning method is used to plan safe, easy and comfort trajectory. Compared to the Cartesian coordinate frame, frenet coordinate frame simplifies the solution of road curve fitting problems, especially in the case of complex road environment; (e) Fuzzy sliding mode control method is proposed for vehicle steering control. Finally, the simulation and experiment results are used to prove the effectiveness of the proposed methods.
Keywords
Introduction
Autonomous vehicle systems have been a popular topic of research. The technical preparation of self-driving vehicles is maturing, with the increase in available computing power and the reduction in sensor costs. 1 The field of self-driving technology is not only related to vehicle control, path planning, sensory fusion, but also forewords such as artificial intelligence, machine learning, deep learning, and reinforcement learning. Self-driving will start a new technology and market revolution, in the next 5 to 10 years. Autonomous driving has been of interest to researches to push the boundaries of automotive racking, that is limited by the abilities of human drivers, with several companies and academics. Stanford University developed an off-road autonomous vehicle for the DARPA Grand Challenge. 2 Hanyang University developed an autonomous off-road Hyundai “A1” to compete in the Autonomous Vehicle Competition (AVC). 3 Google has tested its self-driving vehicles over 2 million miles, using 100 self-driving vehicles. 4 Tesla provides self-driving function in their 2016 model S cars. 5 Uber’s plans to eventually replace the human driven fleet with self-driving cars. 6
The core of the self-driving system, including three parts: perception, planning, and control. Self-driving system technology means that: self-driving car can recognize the surrounding environment and status of the vehicle through a variety of on-board sensors (camera, lidar, millimeter wave radar, GPS, inertial sensors, etc.), and make analysis and judgment, then autonomously control vehicle movement, and finally achieve self-driving based on the acquired environmental information (including road information, traffic information, vehicle location and Obstacle information, etc.) This paper proposes methods for self-driving system in perception, planning and control, based on on-board sensors.
In lane detection and tracking, several issues should be considered, namely choosing an appropriate lane model, developing an image processing for features extraction, probability of lane tracking, and effectiveness of real-time image processing ability. 7 Based on, 8 three main methods for lane detection using cameras includes: model of the lane markings, color information, and feature information method including edge, gradient and intensity.9,10 About road information, it makes the mathematical model of the lane markings, such as B-spline, 11 where candidate points are extracted from the lane markings. About color information, it applies a threshold to the image based on RGB and HSL color space, and places an 8-bit image. 12 To extract a lane, color threshold is based on RGB color space or HSL color space. Due to simplification of computer monitor design, the RGB color space is the most commonly used color space. However, it cannot be used for all applications. In order to describe a color in the RGB color space, the red, green, and blue color components are all used, so RGB is not as intuitive as other color spaces. The HSL color space uses only the hue component to describe color. Therefore, HSL is the best color space for image processing applications, for example color matching. 13 In this paper, a real-time lane detection system is proposed, which uses the capabilities of vision system functions, based on combination of feature information and color information.
The real-time lane detection system works well for clear straight lane. However, on curved lanes or sharp turns, the real time lane detection system would fail, due to complexity of the lane markers. The lane detector cannot distinguish the lane edge well. The lane detection system based on Convolutional Neural Network (CNN) can overcome this problem. CNN is the most popular deep learning architecture, due to the effectiveness of convnets. The main advantage of CNN is that it can automatically detect the important features without any human supervision. CNN is also computationally efficient. This enables CNN models to run on any device. 14
Path planning can be divided into two steps: global path planning and local path planning. Global path planning deals with generating the most ideal route to reach the final destination. Local path planning is responsible for obstruction avoidance and path planning for each segment generated by the global path planner. 15 There are some methods for local path planning, such as artificial potential field method, A* algorithm, and discrete optimization approach. The artificial potential method is calculated by the attractive and repulsive potential functions. However, the computations are complex and sometimes unsolvable, because the path is described in high order polynomial. 16 In addition, it does not always yield a path to the goal due to local minima in the vector field. 17 For A* algorithm, it does not work well on lane tracking based on driving with few obstacles. 17 The discrete optimization approach calculates a finite number of paths. A cost is computed for each path, and finally the path with least cost is selected. In this paper, a discrete optimization method 18 is used, based on the frenet coordinate system for autonomous vehicle path planning, which has strong practicability in assisted driving and self-driving.
Fuzzy logic is widely used in motion control, because it provides the ability to control system with construction of complex mathematical model. Fuzzy logic is used for mobile robot motion control, where sensors of mobile robot contain uncertain and incomplete information.
19
Fuzzy logic technology is also used in traffic management. There is applicability issue to create models of traffic, but IF-THEN logic can deal with vague expectations and respond to situations.
20
In this paper, fuzzy sliding mode control method is used to minimize vehicle’s steering angle error. The vehicle’s cross track error is defined as
The contribution of this paper is: (a) A real time lane detection system is proposed based on vision system functions, where image acquisition and processing functions are used to extract lanes. Although there exists lane detection algorithms in previous work, the proposed lane detection system processes fast and the performance is good. (b) In order to detect curve lanes, deep learning is applied for lane detection, based on fully CNN. It shows how to perform lane segment detection by training a deep neural network for lane segmentation. Compared with, 21 in this paper, the number of layers is increased, and the number of convolution kernels is modified in each layer. A parallel jump structure is used to connect the encoding feature map to the decoding feature map. UpSampling2D is changed to Conv2D Transpose to implement the upsampling process. (c) The cubic spline interpolation method is used for path generation, based on GPS data, where distance between two adjacent path generation points is same. Compared with the connection method of the cubic polynomial fitting algorithm, the curve fitted path by the cubic spline interpolation method is smoother and more satisfied with the vehicle motion pattern. (d) Optimize trajectory planning method depending on frenet coordinate frame is used to plan the safe, easy and comfort trajectory. In addition, compared to the Cartesian coordinate frame, frenet coordinate frame simplifies the solution of road curve fitting problems, especially in the case of complex road environment. Compared with pure pursuit algorithm, the result shows that the path planned by optimize trajectory planning method is more closed to the predefined path. (e) fuzzy sliding mode control method is used to design angular velocity control law to minimize vehicle’s steering angle error. (f) the simulation and experiment results show effectiveness of the proposed methods.
In this paper, section 2 gives the modeling of the vehicle. Section 3 describes two lane detection systems. Section 4 discusses the path generation and path planning methods. Section 5 outlines the fuzzy sliding mode method for vehicle steering control. Section 6 and Section 7 show the simulation result and experiment result, respectively.
Modeling
The local and global coordinate of the vehicle is shown as Figure 1.

The local and global coordinate of the vehicle.
The local coordinate of the system is shown in Figure 2, where

Local coordinate system of the vehicle.
In Figure 3, point w is the center gravity point of the car. The configuration of the vehicle about point W is defined as
where

The kinematic model of the vehicle.
Lane detection system
Real time lane detection system
A webcam camera is equipped in front of the vehicle. Using the camera, the vehicle detects lane, and tracks lane. The real time lane detection system flowchart is shown in Figure 4. Firstly, the camera acquires image. In the second block, the image is resized to 640×480 for image processing. Because on the road, there are always two lanes. The lanes are straight or curve. The lanes are also solid lanes or dash lanes. Based on lane characteristics, four rectangle regions of interest (ROI) are defined to focus on lane area and analyze the lane data. Two ROIs are used to focus on left lane, and two ROIs are for the right lane, in order to detect dash and curve lane. Color threshold block coverts a color image to a binary image. If the color components are in the specified range, the pixel value of the original image will be set to 1. Otherwise, the pixel value is equal to 0. The color threshold, based on HSL color space, is used to extract lane. Hue channel is used to detect yellow lane. Luminance channel is for white lane detection. In order to remove or enhance isolated feature, grayscale morphology is used. Two functions are used in this block: erosion and dilation. Erosion reduces the brightness of pixels surrounded by neighbors with a lower intensity. Dilation increases the brightness of pixels, which are surrounded by neighbors with a higher intensity. Based on the environment condition, erosion or dilation is chosen for gray morphology. Finding edge block is used to find a line describing the edge with points along the edge, and output the coordinate information of the points. Converting pixel to real world is applied to transform pixel coordinate to real-world coordinate. For obtaining lane tracking points block, the algorithm is processed as Figure 5.

Real time lane detection system flowchart.

Obtaining lane tracking points.
Lane detection system using fully CNN
In this section, deep learning is applied to detect lanes based on fully CNN. It shows how to perform lane segment detection by training a deep neural network for lane segmentation. SegNet is an encoding-decoding structure. It uses different method in upsampling and downsampling. Based on, 21 Figure 6 shows pipeline used in lane detection system. The neural network architecture includes seven convolutional layers, three polling layers, three upsampling layer and seven deconvolution layers. However, this model is not stable during lane detection, so the model is improved in this paper as shown in Figure 7. Different from network in Figure 6, the number of layers is increased in the network. The number of convolution kernels is modified in each layer. A parallel jump structure is used to connect the encoding feature map to the decoding feature map, so that multi-layer information can be used in classification prediction. UpSampling2D is changed to Conv2D Transpose to implement the upsampling process, since Conv2DTranspose has the process of learning, which has better result. The BDD100K data is used, consisting of images and labels. For training, the dataset is divided into training set and validation set. The neural network architecture includes 10 convolutional layers, four polling layers, four concatenate layers and 10 deconvolution layers. The model is compiled with mean squared error as the loss function. And the model is trained on the training set, and validated on the validation dataset. Images are inputs of prediction process. Using the trained model result, the prediction process outputs images with regions of the detected lane.

Pipeline used in lane detection system. 21

Pipeline used in lane detection system for this paper.
Path generation and path planning
Cubic spline interpolation model
Autonomous vehicles do path planning and tracking algorithm based on GPS data. However, due to communication delay, the GPS data cannot be obtained continuously. Distances between each two conjunction GPS points are not same. Therefore, if the GPS data is directly used to do the path planning and tracking algorithm, without path generation algorithm, the speed of the vehicle is always changed. In order to control autonomous vehicle smoothly and safely movement, constant speed is pursued for the vehicle. The cubic spline interpolation method is used for path generation, based on GPS data, where distances between two adjacent path generation points are the same. Compared with the connection method of the cubic polynomial fitting algorithm, the curve fitted path by the cubic spline interpolation method is smoother and more satisfied with the vehicle motion pattern. The cubic polynomial fitting algorithm produces a curve arc in some straight lines’ segments. This is not the expected vehicle operating characteristic. Based on vehicle kinematics, the vehicle should take a straight line as much as possible. Only in the direction of the transition, a curved path, which matches the vehicle turning characteristics, is needed. The feature of cubic spline interpolation method is as:
The cubic spline curve is continuous and smooth at the joint.
The first and second derivatives of the cubic spline are continuous.
The second derivative of the boundary of the natural cubic spline is continuous.
A single point does not affect the entire interpolation curve.
Three points
Equation (7) passes through
Based on feature 2, the first derivative of both sides of equation (11) can be obtained as:
Based on feature 3, the second derivative at the start and end points should be continuous, the following are obtained.
Supposed that there are n+1 path points:
Combining the above six equations (9) to (14), the parameters
where
Optimization of trajectory planning method based on frenet coordinate frame
Frenet coordinate frame
The centerline of the road is defined as the road reference line. As shown in Figure 8, a frenet coordinate frame is established using the tangent vector t of the reference line and the normal vector n. The coordinate frame is based on the starting road center line, and the coordinate axes are perpendicular to each other. The direction of the road reference line is

Frenet coordinate frame.
Optimization trajectory planning method
Due to lane change or obstacle avoidance, there is a certain lateral offset between the car and the desired lane. The car should return to its desired lane, based on the best compromise result between the comfort experience in the car and the time required to reach the desired lane position. In longitudinal direction, if the car is moving too fast or too close to the front car, it must slow down significantly without rushing. Comfort can be described by the jerk, which is difference of acceleration.
18
Based on,
22
a quantic polynomial is the jerk-optimal connection of a start state
where
Trajectory plan in lateral direction
In Lateral Direction, define the start state as
Define the end state as
Define
Instead of calculating the best trajectory, a series of candidate trajectories are generated, and then a valid trajectory with the least cost path is selected. The cost function is described as:
where
where
Trajectory plan in longitudinal direction
In order to plan trajectory in longitudinal direction, three conditions are considered: following, merging and stopping, and keeping at a constant speed. To calculate the cost function, for the following, merging and stopping cases, the start state is set as
For the following cases, the target position is defined as:
where
The first derivative and second derivative of
For merging case, the target position is defined as:
where
For stopping case, the target position is defined as:
where
For these two cases, the cost function is expressed as:
In the keeping at a constant speed case, for a start state
The cost function is expressed as:
Finally, comparing the cost function in lateral direction and the cost function in longitudinal direction as below, the best trajectory can be selected.
where
Fuzzy sliding control method for vehicle steering
The vehicle movement along a predefined trajectory is expected in constant speed. If constant steering angle is used to control the vehicle, the vehicle’s movement will be oscillatory. For solving the problem, we propose a fuzzy sliding mode control method to control vehicle’s steering angle. Define the vehicle’s cross track error as
The exponential reaching law is designed as
where
The control law is defined as
In order to prove the stability of the control law, the Lyapunov function is designed as
The derivative of the Lyapunov function is
When
Fuzzy rule.
The triangular function is defined as:
The output is based on centroid defuzzification method, and is given as (55).
The fuzzy exponential reaching law is defined as
The fuzzy sliding mode control law is as
Simulations
Real time lane detection simulation
The powerful capabilities of LabVIEW are used to simulate lane detection. The original figure is shown in Figure 9. The vehicle should detect yellow lane and white lane, simultaneously. To show the effectiveness of lane detection system, the figure is chosen, where lanes are not shown clearly. The vehicle has to use vision functions to remove noise. As shown in Figure 10, a rectangle image is extracted from the figure, which only contains lane’s information. The rectangle contains the left-top and right-bottom coordinates as (0, 240) and (640, 480), respectively. Based on Figure 4, four ROIs are defined as up-left, down-left, up-right, and down-right. In Figure 10, four ROIs are shown as four green rectangles. NI Image Acquisition (IMAQ) color threshold function is applied to threshold HSL image into an 8-bit image. Hue, saturation and Luminance ranges are set as (85,252), (106,252), and (0,255) to threshold the color, and the lanes are presented as white color. IMAQ find edge function is used to find straight edges within a region in an image. In up-left, down-left and down-right ROIs, the edges of lanes are detected and the detected lane is marked as red color. Gray morphology function performs grayscale morphological transformations. It is used to remove noise. IMAQ edge tool is used to find edges along the detection lane in the image. The detection lane’s points are as pink points in Figure 9. The lane’s information is in pixel coordinates. The lane’s information is transformed in real world coordinates using the calibration information. Based on Figure 5 and equations (5) and (6), the yellow lane in Figure 9 is the tracking lane for vehicle.

Original figure for lane detection.

Lane detection result based on the proposed real time lane detection system.
Fully CNN lane detection simulation
Based on description in Figure 7, the model is trained. After 10 epochs, the model is finished with MSE for training of 0.0024 and validation of 0.0024. After training, the result is saved in a json along with its weights. Two images are tested for lane detection, using deep learning based on CNN. The original images are sized as 640×480. Firstly, the images are resized to 80×160. Based on the training result, after prediction process, two images are shown in Figures 11 and 12, where the detected lane region is filled in green.

Predicted result of lane detection based on fully CNN proposed in this paper.

Predicted result of curved lane detection based on fully CNN proposed in this paper.
Based on the fully CNN method in, 21 after training the model, test results are shown in Figures 13 and 14. After 20 epochs, the model finished with MSE for training of 0.0046 and validation of 0.0048. The results are worse than the results in Figures 11 and 12.

Predicted result of straight lane detection based on CNN.

Predicted result of curved lane detection based on CNN.
Trajectory planning and tracking simulation
In Figure 15, the reference points are defined as (0, 0), (0, –4), (20.5, 1), (30, 6.5), (40.5, 8), (50, 10) and (60, 6) in meters to generate the trajectory. Based on cubic spline interpolation method, the white trajectory is generated, where the white trajectory passes through the reference points. In the white trajectory, distances between two adjacent points are the same. Therefore, the vehicle can move in the constant speed. Obstacles are located at (20, 10), (30, 6), (30, 8), (35, 8), and (50, 3). When the vehicle tracks the white trajectory, the vehicle should avoid the obstacles. Using the optimization trajectory planning method based on frenet coordinate frame, the best trajectory is planned as the red lane. The trajectory avoids obstacles and finally tracks the generated path. Using the fuzzy sliding mode method, the vehicle’s yaw angle error is minimized as shown in Figure 16. In the frenet coordinate frame, initially, the vehicle is located at (1,0). Firstly, the vehicle should track the white path from its initial point, so error occurs. At time step 26-42, the vehicle should avoid obstacle, instead of tracking the white trajectory. Therefore, the vehicle should change its orientation to avoid obstacle, error occurs. However, finally, the vehicle yaw angle is close to zero.

Vehicle trajectory planning and tracking.

Vehicle’s Yaw angle.
As shown in Figure 17, pure pursuit trajectory planning method is compared with frenet optimized trajectory planning method. Passing through points (0, 0), (8, –4), (12, 2), (16, 4), (20, 2), (24, 0) and (27, 3) in meter, path is generated as blue lane in Figure 17. Based on frenet optimized trajectory planning method, the trajectory is planned as red lane. It is almost the same as the generated blue lane. However, based on pure pursuit trajectory planning method, green lane is planned. There is difference between the planned green lane and the generated blue lane, in x range of (0, 3).

Comparison result between frenet optimized trajectory planning method and pure pursuit trajectory planning method.
In order to show the effectiveness of the trajectory, the proposed trajectory planning and tracking method is tested using a simulator. The simulator is made to demonstrate the performance on an outdoor autonomous vehicle. As shown in Figure 18(a), the left window is the simulator window, and the right window is shown the path based on the algorithm processing in LabVIEW. Based on the proposed path planning algorithm and fuzzy sliding control method for vehicle steer, the speed and steer commands are calculated. Then the commands are sent to the simulator based on RS232 communication. The vehicle in the simulator will move based on the speed and steer commands. Initially, the vehicle is located at (10 m, 0, 0). The light blue obstacle is located at (28 m, 0). The length of the vehicle is around 1.1 m. The target speed is defined as 10 km/h. The green lane is described as the generated path, which guarantees that the vehicle avoids the obstacle well. The dark blue lane is shown as the vehicles actual path. In Figure 18(b), the vehicle arrives at (20 m, –1 m) to avoid the predefined obstacle. In Figure 18(c), the vehicle tracks back to its predefined straight line. In Figure 18(d), the vehicle moves forward to its predefined straight line. The test simulator video is shown in https://www.dropbox.com/s/5up9w26hra799xv/path%20tracking.mp4?dl=0.

Test results of trajectory planning method and fuzzy sliding control method for vehicle steer using a simulator: (a) Initially, the vehicle is located at (10 m, 0, 0), (b) The vehicle arrives at (20 m, –1 m) to avoid the predefined obstacle, (c) The vehicle tracks back to its predefined straight line, and (d) The vehicle moves forward to its predefined straight line.
Experiment
The experiment is used to show the effectiveness of the trajectory planning method. As shown in Figure 19, the length of curved lanes is 4 m. The distance between two black lanes is 1.1 meter. Firstly, a curve path is generated, using cubic spline interpolation model. Then, the vehicle plans and tracks the trajectory successfully, based on optimization trajectory planning method in frenet coordinate frame. At t = 20 s, the vehicle passes through the curved part of the lane. At t = 30 s, the vehicle finishes the full path.

A vehicle plans and tracks the trajectory, based on optimize trajectory planning method in frenet coordinate frame. (a) t = 3 s, (b) t = 20 s and (c) t = 30 s.
Conclusions
In this paper, a real time lane detection system is proposed based on vision system functions, using webcam camera. In order to detect curve lanes, deep learning is applied for lane detection, based on fully CNN. The cubic spline interpolation method is used for path generation, based on GPS data, where distances between two adjacent path generation points are the same. Optimization trajectory planning method depending on frenet coordinate frame is used to plan a safe, easy and comfort trajectory. In addition, compared to the Cartesian coordinate frame, frenet coordinate frame simplifies the solution of road curve fitting problems, especially in the case of complex road environment. Fuzzy sliding control method for vehicle steering control is proposed. Finally, the simulation and experiment results show the effective performance of the proposed methods.
Footnotes
Handling Editor: James Baldwin
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
