PaTAVTT: A Hardware-in-the-Loop Scaled Platform for Testing Autonomous Vehicle Trajectory Tracking

With the advent of autonomous vehicles, in particular its adaptability to harsh conditions, the research and development of autonomous vehicles attract significant attention by not only academia but also practitioners. Due to the high risk, high cost, and difficulty to test autonomous vehicles under harsh conditions, the hardware-in-the-loop (HIL) scaled platform has been proposed as it is a safe, inexpensive, and effective test method. This platform system consists of scaled autonomous vehicle, scaled roadway, monitoring center, transmission device, positioning device, and computers. This paper uses a case of the development process of tracking control for high-speed U-turn to build the tracking control function. Further, a simplified vehicle dynamics model and a trajectory tracking algorithm have been considered to build the simulation test. The experiment results demonstrate the effectiveness of the HIL scaled platform.


Introduction
Autonomous vehicles, also known as self-driving vehicles or driverless vehicles, are capable of sensing the traffic environment, navigating through software algorithm, and controlling vehicle movement without driver's decisions and actions.Such vehicles have been widely used in logistics and cargo transportation, military purpose, and planetary exploration due to its great potential ability to improve safety, increase transportation capacity and minimize pollution [1][2][3][4][5][6][7][8].In the past 40 years, the development of autonomous vehicles has been greatly increased.Recently, Google, Tesla, Uber, and Baidu had demonstrated their autonomous cars, which can run on various roads company with live traffic [9].Therefore, with the resolution of technological, societal and legal issues, people will finally free themselves from the mental and physical burden of driving [4].
Although autonomous vehicles have many advantages, recent several accidents slow down their process of commercialization.Tesla cancelled the propaganda of self-driving function, and Uber also terminated all autonomous vehicle testing.In reality, both government and academia have reached an agreement that the autonomous vehicle needs to conduct comprehensive, systematic, and rigorous tests before it is officially commercialized.However, the testing of autonomous vehicle requires extremely time-consuming work and huge economic cost [10].An autonomous vehicle consists of five functions (as shown in Figure 1): (1) sensing and location systems; (2) global route planning; (3) behavior reasoning; (4) trajectory planning; (5) trajectory tracking control.Among these five functions, the first four can be simulated and tested by using the data collected from the autonomous vehicle sensors.Basically, it is a test of the software function of the autonomous vehicles.However, the trajectory tracking control process needs to be tested with real vehicles as the vehicle kinematic and dynamic constraints; controller responsiveness will influence the reliability, smooth, and comfort of autonomous vehicles.For the trajectory tracking control function, it requires that the control algorithm can provide the spatial path planning and  handle the direction/speed of the vehicle according to the real-time surrounding traffic information and high-accuracy map information [10].
The main two existing testing approaches of autonomous vehicle trajectory tracking are simulation testing and real vehicles testing.Although the software-based simulation has the advantages of low cost and high efficiency, the simulation model is based on the ideal mathematical model which ignores many practical factors might cause large difference between the simulation results and real cases results.It should be noted that the real world testing, although with much higher accuracy, is very time-consuming, expensive, and limited by weather and scenarios [11][12][13].In this regard, shortening the development cycle without sacrificing accuracy and reliability has been concerned [14].There are many well-known testbeds around the world for testing connected and automated vehicles, such as the MCity of the University of Michigan and the GoMento test site located in Contra Costa County, California, and CU CVIS testbed of Chang'an University in China.The former two testbeds focus on demonstration for applications of future Intelligent Transportation Systems.CU CVIS focuses on the metafunction testing for each part of CAVs and the comprehensive performance testing under the limit conditions [15].
Hardware-in-the-loop (HIL) simulation has combined both mathematical and mechanical models to emulate real vehicles as considering the influence of gravity, resistance, and friction which may cause the inaccuracy of the model.Compared to the testing in real traffic system, the HIL has the merit of low construction cost, short development cycle, and reproducible method [16].At present, HIL-based simulation has been widely used in the field of automotive testing.Deng et al. [17] proposed a HIL simulation system as an integral part of various autonomous driving programs, which is a laboratory environment to support the development, test and verification of many functions, and algorithms related to sensor-guided autonomous driving.Zulkefli et al. [18] proposed a HIL testbed to evaluate the performance of connected vehicle applications.This testbed integrated a laboratory powertrain research platform with a microscopic traffic simulator (VISSIM), which could be used to test various ITS applications such as CACC, Eco-Driving, and Speed Harmonization.Gietelink et al. [19] developed an indoor vehicle hardware-in-the-loop simulation system to test the advanced driver assistance systems embedded in a real vehicle.To best of our knowledge, most of HIL-based simulations embed a vehicle or vehicle parts into the system, which are usually complex and costly, and require large space.A research group from RWTH Aachen University, Germany, proposed a hardware implementation of a platoon of four 1 : 14 scaled trucks to test the cooperative platoon control algorithm [20].As considering critical safety factors, HIL simulation system is also used to precrash threat assessment [21].
In the proposed paper, a HIL scaled platform for testing autonomous vehicle trajectory tracking (PaTAVTT) is presented, which is a mechatronic testbed consists of scaled roadway, scaled vehicles, indoor positioning subsystem, and computer-aided Graphical User Interfaces.Compared with other HIL test systems, PaTAVTT has the following advantages.First, it is equipped with an indoor ultra-wideband-(UWB-) based high-precision positioning system matches the GPS precision in outdoor field, which can record the accurate trajectory of the scaled vehicle in motion.The deviation between the real trajectory and the reference would be an important criterion to evaluate the performance of the trajectory tracking algorithm.Second, the scaled platform bridges the software-based vehicle dynamics model with the real vehicle.The algorithm modules and parameters validated by Matlab or Carsim can be downloaded into the scale vehicle.After passing the tests on PaTAVTT, the algorithms can be further transplanted into the real vehicle.Third, many external factors such as the road surface material, road geometry and slope, and static or dynamic obstacles can be tested due to the low establishment and testing costs.
In this paper, the system structure of this HIL platform and the implementation of each submodule have been described.Further, a new methodology of U-turn has been developed and tested which can also be used in an autonomous vehicle.The testing results demonstrate that the HIL platform can be used to test the trajectory planning and tracking control of an autonomous vehicle, which potentially shorten its development cycle.The remainder of this article is organized as follows.Section 2 is the overview of the PaTAVTT.Section 3 presents a real-case study and the methodology of U-turn.The simulation results are presented in Section 4. Section 5 concludes the paper.The scaled vehicles are 37 cm in length, 30 cm in width, and 14 cm in height.The scaled vehicle is battery powered and the highest speed is 3 m/s.The positioning system is produced by Ubsense based on UWB wireless communication technology, which consists of a positioning antenna mounted on the wall and a label on the vehicle.Its positioning accuracy is about 30 cm which is approximately equal to the length of the scale vehicle.At this point, it matches the positioning precision of GPS, which has a precision of 3-5 m and is close to the length of a real vehicle.Each scaled vehicle is equipped with dual controllers and dual Central Processing Units (CPUs): one CPU is used to control the vehicle steering; the other is used to handle the output data from four kinds of sensors (UWB positioning sensor, ultrasonic distance sensor, camera/image sensor, and photoelectric encoder; see Figure 3).Ultrasonic distance sensors are used to detect the location of the front vehicle or obstacles to prevent collisions.The image sensor is used to detect the lane line to ensure that the vehicle is traveling within the lane.The photoelectric encoder is used to measure the speed and displacement of the vehicle.

Overview of PaTAVTT
The wireless communication system is realized by using 802.11acwireless Wi-Fi technology.Wi-Fi modules are installed to smart vehicles.All wireless communication is connected to a network router using Intranet.It should be noted that the system is able to simulate the trajectory control/optimization strategies.
PaTAVTT platform can be used to test various types of autonomous vehicle tracking control functions, such as single-vehicle control and platoon control.Please refer to Table 1 for details.

U-Turn and Its Negative Effects to Traffic Dynamics.
U-turn is a common traffic scenario which lowers vehicle speeds and affects the traffic flow.The U-turn signs from different countries are shown in Figure 4.It may cause  sideslip or rollover accident if the vehicle accelerates in a U-turn maneuver [22].As autonomous vehicles are able to automatically plan and control the trajectories, a proper Uturn algorithm can significantly improve the overall traffic efficiency, reduce fuel consumption, and minimize other negative effects.
Based on the PaTAVTT platform, this paper uses U-turn trajectory tracking as a case study and builds an autonomous vehicle dynamics model.We use Model Prediction Control (MPC) algorithm to perform and test the autonomous vehicles trajectory tracking control in U-turn scenario under different speed conditions.

Vehicle Dynamics Model.
The trajectory tracking control of autonomous vehicles is achieved by controlling the vehicle function system.Mathematical vehicle dynamics model is useful in vehicle design, crash simulation, and kinematic behavior analysis as it provides a quick simulation analysis compared with finite element (FE) models [23].In this regard, in this paper, we use vehicle dynamics model to be the prediction model and the autonomous vehicle dynamics model can be simplified as two-wheeled bike model.
In the plane Cartesian coordinate system (), the vehicle dynamics model has been shown in Figure 5. (  ,   ) and (  ,   ) are the center coordinates of the vehicle rear axle and front axle, respectively.V  and V  are velocity of the vehicle rear axle and front axle, respectively. is the driving direction of the vehicle,   is the angle of front wheel, and  is the wheelbase between the front and rear axle.
From Figure 5, we have where ẋ  and ẏ  are the lateral velocity and the longitudinal velocity of rear axle, respectively.
By combining (1) and ( 4), the model is simplified as The general expression of ( 5) is where the state variable  = [  ,   , ]  and the control input Trajectory tracking control is implemented by tracking reference vehicle.Therefore, assuming that the reference vehicle follows the given path, the reference vehicle will satisfy the above equation at any time.Using 0 to notate the reference vehicle, By using Taylor series and ignoring the higher-order function, ( 7) can be approximated by (8) as follows: By substituting ( 8) with ( 7), we have The model predictive control (MPC) used in this paper is a discrete time control method.Let χ = ( χ( + 1) − χ())/, where  is the sampling period.
Therefore, we can discretize the continuous dynamics function and (10) is the discrete time model, which will be used as the predictive model in this research.
where  and  are represented by

The Trajectory Tracking Control Algorithm of U-Turn
Based on MPC.MPC predicts the future state or output of the system via the established prediction model, which solves the optimal control sequence based on the constraints and performance of vehicle dynamics.It can calculate the following optimal control sequence by predicting the future state or output of the control object under previous optimal control sequence.After alternating this cycle, the object can be controlled by the system.MPC is effortless to be modelled and controlled, and it also has good robustness.Then, it can be used to solve multivariable and constrained problems and implement online optimization [24].
As shown in Figure 6, the control strategy for MPC-based U-turn trajectory tracking is as follows: it starts from the th sampling period, generating a set of control increments by optimization Δ *  = [Δ *  , Δ * +1 , . . ., Δ * +  −1 ]  to ensure the predicted trajectory highly fits the reference trajectory in the predictive time domain [ + ,  +   × ].It also limits the minimum amount changes of controlling output.  is the number of sampling points of control inputs, and   is the number of predictive points of the system state outputs, which usually commits   ≥   .

Objective Function Design.
As the objective function needs to ensure autonomous vehicle track the reference trajectory quickly and smoothly, the deviation of system state variables and the optimization of control variables should be considered.Then, the following objective function will be used to design the trajectory tracking controller,  where  and  are weight matrixes.The first item reflects the performance of trajectory tracking; the second item reflects the constraints on changes.This function can be easily converted into a standard quadratic programming form [25]. Therefore, considering the vectors

𝐽 (𝑘) =
(12) can be represented by In order to simplify the solving to (12), assuming   =   = , we have where From ( 15)∼( 16), the objective function can be converted into a standard quadratic form: where () can be ignored as it is independent of ũ and can not affect the determination of  * .Thus, we can redefine the function as This above function is expressed in standard form which can be solved by online QP problems solver such as Matlab.The amplitude constraints in the control variables of ( 19) can be represented as  min −  0 ( + ) ≤ ũ ( + ) ≤  max −  0 ( + ) .(20) After solving (19), the control inputs sequence can be derived as The first element in  *  is applied to the system to get an actual control increment, which is After entering the next control cycle, we repeat the above cycle processes to achieve the whole tracking control system.

Simulation and Testing on PaTAVTT
According to the road design standards, as considering the vehicle sideslip, the formula to calculate the road safety speed with large transverse gradients is where  is the tire-road adhesion coefficient;  is the transverse gradient of road;   is the radius of curvature;  is the gravitational acceleration [26].
When the vehicle is driving on the road with large tireroad adhesion coefficient under high-speed condition, the vehicle will have an overturning moment which is caused by centrifugal force and lateral adhesion.The overturning moment may result in the gravity of the vehicle to shift to the outside tire (i.e., the phenomenon of lateral-load transfer).Once the overturning moment is increased to the extent that makes the inside tire leaves off the road, the untripped rollover will occur.The critical rollover speed of the vehicle on the load with large tire-road adhesion coefficient, V  , is where  is the wheel-track and ℎ is the center of gravity height [27].
The main factor of vehicle rollover is the center of gravity height, ℎ, and if the center of gravity height is lower enough, the rollover will not occur.In this paper, the research object is small vehicles, which usually have relatively low center of gravity height.Therefore, the road safety speed, V  , is greater than V  .
In this case study, the following parameters are used:  = 0.65,  = 3 ∘ ,  = 9.8 m/s 2 ℎ = 0.7 m,  = 10 m, and V  = 8.442 m/s.The simulation trajectory tracking results based on MPC under different vehicle speed conditions are shown in Figure 7.The speed varied from 8.4 m/s to 3.6 m/s with a negative step of −0.3.From the figure, we see that when the vehicle speed decreases, the vehicle movement trajectory gets closer to the reference trajectory.
The snapshots of lab tests are presented in Figure 8.Using the simulation results, we deploy 5 scaled vehicles to conduct the trajectory tracking experiment, and we set the desired speed of the vehicles the one tenth of the simulation reference speed (V = 0.6m/s).The testing results on PaTAVTT platform are shown in Figure 9.As can be seen in the figure, the trajectories are pretty close which demonstrates the effectiveness of the proposed testing platform.Furthermore, we calculated the parameters of the trajectories of 5 homogenous vehicles as shown in Table 2.The trajectory overlap ratio (TOR) is defined as follows: where  is the number of the total trajectory points at a sampling period of 0.04 s and   is the number of the trajectory points located in the reference trajectory buffer, which is a stripe with a width equal to the scaled vehicle and takes the reference trajectory as its mean axle.From the table, it can be concluded that the proposed U-turn algorithm does well in repeatability, robustness, and trajectory tracking.
We further apply the proposed algorithm to real world testing environments (see Figure 10) and conduct the same Uturn trajectory experiment for 10 times.Experimental results (see Figure 11) show that the algorithm can generate very consistent results.This further demonstrates the effectiveness of the proposed methodology and the scaling effect can be controlled.Moreover, the control effect of the same MPC algorithm on a real vehicle is better than that on a scaled vehicle (see Table 3), mainly because the real vehicle is equipped with ESP and other electronic devices to help control the stability of the vehicle.

Conclusion
It is difficult to test real autonomous vehicle under harsh conditions.Using the hardware-in-loop scaled platform to test scaled autonomous vehicle becomes an apparent alternative.In this paper, we use the HIL platform to test the slip of scaled autonomous passing through U-turn under high-speed condition.After comparing its result with the real vehicle testing, we have proved the feasibility of using HIL scaled platform as surrogates of the real autonomous vehicle for testing automated vehicle.Note that the proposed test platform has a very high flexibility in simulating real world traffic operations, including those with purely traditional vehicles.For example, it can be used for conducting traffic capacity analysis [28][29][30], Long Distance Commuter lane (Qu and Wang, 2015), traffic oscillations [31,32], traffic safety analysis [33][34][35], and others.At the end of this paper, we use a simple case study of high-speed U-turn to build the tracking control function.A simplified vehicle dynamics model and a trajectory tracking algorithm have been considered to build the simulation test.The experiment results demonstrate the effectivity of HIL scaled platform.
In the future, we will continue this research on three aspects.Firstly, we will theoretically discuss the factors that result in the trajectory difference between scaled vehicles and real vehicles with the same trajectory tracking algorithm.Secondly, we will test scaled vehicles on its dynamic trajectory planning and tracking performance under traffic disturbances.Last but not least, we will utilize PaTAVTT to conduct experiments and validations on the trajectory V elocityofthevehiclerearaxle V  : Velocity of the vehicle front axle : The driving direction of the vehicle   : The angle of front wheel : The wheelbase between the front and rear axle ẋ  : The lateral velocity of rear axle ẏ  : The longitudinal velocity of rear axle : The configuration (position and orientation) of the center of the axis of the wheels  0 : State output of the reference vehicle : Co n tr o li n p u t  0 : Control input of the reference vehicle

Figure 1 :
Figure 1: The generic function chart of an autonomous vehicle.

Figure 6 :
Figure 6: Control strategy for MPC-based U-turn trajectory tracking.

YFigure 7 :
Figure 7: U-turn trajectory tracking results based on MPC.(a) The simulation trajectory tracking results based on MPC under different vehicle speed conditions.(b) Longitudinal speed error (vehicle speed = 8.44 m/s).(c) Yaw angle of the trajectory (vehicle speed = 8.44 m/s).(d) Longitudinal position error (vehicle speed = 8.44 m/s).(e) Lateral position error (vehicle speed = 8.44 m/s).

Figure 8 :
Figure 8: A snapshot of the testing process.

Table 1 :
Function list of PaTAVTT platform.

Table 2 :
Statistical results of the trajectories of 5 homogenous scaled vehicles.

Table 3 :
Statistical results of a real autonomous vehicle for 10 rounds.