Institutionen för systemteknik Department of Electrical Engineering Examensarbete Development of a Driver Model for Vehicle Testing Examensarbete utfört i Reglerteknik vid Tekniska högskolan vid Linköpings universitet av Andreas Jansson & Erik Olsson LiTH-ISY-EX--13/4728--SE Linköping 2013 Department of Electrical Engineering Linköpings universitet SE-581 83 Linköping, Sweden Linköpings tekniska högskola Linköpings universitet 581 83 Linköping Development of a Driver Model for Vehicle Testing Examensarbete utfört i Reglerteknik vid Tekniska högskolan i Linköping av Andreas Jansson & Erik Olsson LiTH-ISY-EX--13/4728--SE Handledare: Mattias Hjort vti, Linköping Jonas Linder isy, Linköpings universitet Examinator: Daniel Axehill isy, Linköpings universitet Linköping, 10 October, 2013 Avdelning, Institution Division, Department Datum Date Division of Automatic Control Department of Electrical Engineering Linköpings universitet SE-581 83 Linköping, Sweden Språk Language Rapporttyp Report category ISBN Svenska/Swedish Licentiatavhandling ISRN Engelska/English Examensarbete C-uppsats D-uppsats Övrig rapport 2013-10-10 — LiTH-ISY-EX--13/4728--SE Serietitel och serienummer ISSN Title of series, numbering — URL för elektronisk version http://www.control.isy.liu.se http://www.ep.liu.se Titel Title Framtagning av förarmodell för fordonstester Development of a Driver Model for Vehicle Testing Författare Andreas Jansson & Erik Olsson Author Sammanfattning Abstract The safety requirements for vehicles are today high and they will become more stringent in the future. The car companies test their products every day to ensure that safety requirements are met. These tests are often done by professional drivers. If the car is tested in an everyday traffic situation, a normal experienced driver is desired. A drawback is that a human will eventually learn the manoeuvre he/she is told to do. An artificial driver is therefore to prefer to make the test repeatable. This thesis’ purpose is to develop and implement an artificial driver as a controller in order to follow a predefined trajectory. The driver model’s performance driving a double lane change manoeuvre should be as close to a real driver’s as possible. Data was gathered by inviting people to drive in a simulator. The results from the simulator tests were used to implement three different drivers with different experiences. The gathered data was used to categorize the test drivers into different driver types for each specific velocity by using the vehicle position from the test results. This thesis studies the driver from a controller’s perspective and it resulted in two implemented controllers for reference tracking. The first approach was a Model Predictive Controller with reference tracking and the other approach was to use a FIR-filter in order to describe the drivers’ characteristics. A vehicle model was implemented in order to do the double lane change manoeuvre in a simulation environment together with the implemented driver model. The results show that the two approaches can be used for reference tracking. The MPC showed good results with the recreation of the test runs that were made by the categorized drivers. The FIR-filter had problems to mimic the drivers’ test runs and their characteristics. The advantage with MPC is its robustness, while the advantages with the FIR-filter are its, in comparison, simplicity in the implementation and the algorithm’s low computational cost. In order to make the FIR-filter more robust, some improvements have to be made. One improvement is to use gain scheduling in order to adjust the filter coefficients depending on the velocity. Nyckelord Keywords Driver model, Double lane change, MPC, FIR-filter Abstract The safety requirements for vehicles are today high and they will become more stringent in the future. The car companies test their products every day to ensure that safety requirements are met. These tests are often done by professional drivers. If the car is tested in an everyday traffic situation, a normal experienced driver is desired. A drawback is that a human will eventually learn the manoeuvre he/she is told to do. An artificial driver is therefore to prefer to make the test repeatable. This thesis’ purpose is to develop and implement an artificial driver as a controller in order to follow a predefined trajectory. The driver model’s performance driving a double lane change manoeuvre should be as close to a real driver’s as possible. Data was gathered by inviting people to drive in a simulator. The results from the simulator tests were used to implement three different drivers with different experiences. The gathered data was used to categorize the test drivers into different driver types for each specific velocity by using the vehicle position from the test results. This thesis studies the driver from a controller’s perspective and it resulted in two implemented controllers for reference tracking. The first approach was a Model Predictive Controller with reference tracking and the other approach was to use a FIR-filter in order to describe the drivers’ characteristics. A vehicle model was implemented in order to do the double lane change manoeuvre in a simulation environment together with the implemented driver model. The results show that the two approaches can be used for reference tracking. The MPC showed good results with the recreation of the test runs that were made by the categorized drivers. The FIR-filter had problems to mimic the drivers’ test runs and their characteristics. The advantage with MPC is its robustness, while the advantages with the FIR-filter are its, in comparison, simplicity in the implementation and the algorithm’s low computational cost. In order to make the FIR-filter more robust, some improvements have to be made. One improvement is to use gain scheduling in order to adjust the filter coefficients depending on the velocity. v Sammanfattning De säkerhetskraven som idag ställs på fordon är höga och det kommer bli mer strikt i framtiden. Bilföretag testar sina bilar varje dag för att se om komponenterna och bilen klarar säkerhetskraven som ställs. Till dessa tester används professionella testförare. I en vardaglig trafiksituation är det önskvärt att en normalt erfaren bilförare utför testen. En mänsklig förare kommer använda sin inlärningsförmåga vid repeterande manöver, vilket inte är önskvärt. En artificiell förare är därför att föredra. Den artificiella föraren ska köra så likt en verklig förare som möjligt vid en "double lane change"- (DLC) manöver. Detta examensarbete har som avsikt att implementera en förare som en regulator för att kunna följa en förutbestämd trajektoria på samma sätt som en verklig förare. I detta examensarbete har "DLC"-manövern studerats. I examensarbetet har insamlad data från testförare använts för att kunna implementera tre olika förartyper med olika erfarenheter. Den insamlade datan användes till att kategorisera testförarna för varje särskild hastighet. Två tillvägagångssätt har gjorts med föraren, en där föraren är en modellbaserad prediktionsregulator med referensignalsföljning (MPC) och en där föraren implementeras som ett ändligt impulssvarsfilter (FIR-filter). En fordonsmodell har implementerats för att en "DLC"-manövern ska kunna testas i en simuleringsmiljö. Resultaten blev att de två metoderna klarade av referensföljningen. MPC:n var bra på att återskapa testförararnas körningar. FIR-filtret hade problem med att härma förarnas körningar och deras karaktäristik. Fördelen med MPC är dess robusthet och fördelen med FIR-filtret är dess, i jämförelse, simplicitet vid implementering samt den låga beräkningskostnaden för algoritmen. För att göra FIRfiltret mer robust måste förbättringar göras. En förbättring är att använda gain scheduling för att anpassa filterkoefficienterna beroende på hastigheten. vii Acknowledgments We want to send big thanks to the thesis’ examiner Daniel Axehill at Linköpings University and the supervisors Jonas Linder at Linköping University and Mattias Hjort at VTI for the contributing discussions and guidance. Thanks to all test drivers that participated with the test drives in the simulator. Furthermore, we would like to thank the FTS group at VTI for many interesting discussions and laughs throughout the thesis. Finally, we would like to thank our families and friends for their support, making our studies at the university so much better than we ever could expected. Andreas Jansson & Erik Olsson Linköping, October 2013 ix Contents Notation 1 Introduction 1.1 Background . . . . . . . . . 1.2 Purpose . . . . . . . . . . . 1.3 Objective . . . . . . . . . . 1.4 The Thesis’ goals . . . . . . 1.5 Related and Previous Work 1.5.1 Vehicle model . . . . 1.5.2 Driver Model . . . . 1.6 Thesis Outline . . . . . . . xiii . . . . . . . . 1 1 2 2 2 3 4 4 6 2 Vehicle Model 2.1 Steering Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 The Tyres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Results and Discussion for Vehicle Model . . . . . . . . . . . . . . 7 7 9 9 3 Test Drives and Data Gathering 3.1 Test Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 The Test Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Results and Discussion for the Simulator Tests . . . . . . . . . . . 15 15 16 18 4 Driver Type Modeling 4.1 The Driver Types . . . . . . . 4.2 Categorizing the Drivers . . . 4.3 Reference Trajectories . . . . 4.4 Discussion of the Driver Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 23 24 28 31 . . . . . . . . . . . . a Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 33 35 36 38 38 41 . . . . . . . . . . . . . . . . . . Modelling 5 MPC as a Driver 5.1 The Driver’s Vehicle Model . . . 5.2 Model Predictive Control . . . . 5.2.1 Implementing the MPC as 5.3 Results for the MPC as a Driver 5.3.1 MPC Drivers at 45 km/h 5.3.2 MPC Drivers at 50 km/h . . . . . . . . . . . . xii Contents 5.4 5.3.3 MPC Drivers at 55 km/h . . . . . . . . . . . . . . . . . . . 5.3.4 MPC Drivers at 60 km/h . . . . . . . . . . . . . . . . . . . Discussion of the MPC as a Driver . . . . . . . . . . . . . . . . . . 6 FIR-Filter as a Driver 6.1 FIR-Filter as a Driver . . . . . . . . . 6.2 Results for the FIR-filter as a Driver . 6.2.1 FIR-Filters Drivers at 45 km/h 6.2.2 FIR-Filters Drivers at 50 km/h 6.2.3 FIR-Filters Drivers at 55 km/h 6.2.4 FIR-Filters Drivers at 60 km/h 6.3 Discussion of the FIR-filter as a Driver 43 46 48 . . . . . . . 51 51 53 56 59 61 63 65 7 Summary 7.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 67 68 Appendix A Hardware 73 Appendix B The Vehicle Model 74 Appendix C Tyre Dynamics 78 Appendix D The Driver’s Vehicle Model 83 Appendix E MPC 85 Appendix F The Simulator 89 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notation Abbreviations Abbreviation VTI DLC IMU MPC FIR PID Meaning The Swedish National Road and Transport Research Institute Double Lane Change Inertial Measurement Unit Model Predictive Control Finite Impulse Response Proportional-Integral-Derivative xiii Chapter 1 Introduction Traffic safety is a frequently discussed subject due to all the accidents that happen every day. To decrease the number of accidents, the automotive engineers and designers of vehicle safety systems have to understand how a driver reacts in a critical situation. The interaction between the driver and vehicle can be analysed if it is possible to do an accurate simulation of the human driving behaviour. A drive simulator can be used for this purpose, which is positive in both an economical and a safety perspective compared to if the tests were done with real vehicles. 1.1 Background An important field of study is the one on the steering of the driver. This includes the study on how a driver reacts when he/she has to do a evasive manoeuvre [21]. There are two types of testing to assess vehicle handling: open-loop and closedloop. The time trajectories of inputs are predefined in an open-loop test, which make them independent from the response of the vehicle, e.g., J-turn and fishhook. These kinds of tests are performed with no feedback, i.e., the test relies on the input data to the system. These tests can be done by a car driving robot with high repeatability. During a closed-loop test, the vehicle needs to navigate through a predefined path with acceptable accuracy. This is however more demanding since a control algorithm will be needed to approximate human drivers’ actions. There is also a need of a reliable road-sensing system, which can be quite expensive. This is why car companies often use professional drivers in closed-loop tests [2, 21]. A vehicle test can be categorized into two types: an expected and a nonexpected. A non-expecting test can be an evasive manoeuvre because an animal crosses the road. An expected test is, e.g., when the driver is told to do a U-turn on a predefined path. If a car company wants to test the performance of a vehicle in a normal situation, they rather use an average driver to be sure the situation is close to a realistic scenario in traffic. The downside of using an average driver is his/her ability to make progress the more he/she does the test, which gives a misleading test result. This can be prevented by having many test drivers to take the test. However, this can result in too big deviations in the test result. 1 2 Introduction These downsides are eliminated by using a model of a driver in a robot [2, 21]. The Swedish National Road and Transport Research Institute, VTI, in Linköping Sweden has a robot which can be used for steering and accelerating/braking a car and the company wants a software implemented in order to make this robot’s driving performance close to a real human driver’s. This task provided the basis for this thesis work. This thesis work demands prerequisites in modelling, control theory and programming. 1.2 Purpose The purpose of this thesis work was to develop a driver model that can be used in a closed-loop test to evaluate vehicle performance for drivers with different experiences. 1.3 Objective The objective was to develop and implement a model of the human driver in a controller which controls a vehicle driving robot. The robot is supposed to drive the car similar to how a human driver would drive along a predefined trajectory which in this thesis work will be the double lane change (DLC), seen in Figure 1.1. This corresponds to an expected test because the track is known by the driver when he/she begins the test. Figure 1.1: The double lane change manoeuvre 1.4 The Thesis’ goals The thesis’ objective described above can be divided into sub-goals in order to get a brief overview over this thesis. 1.5 Related and Previous Work 3 Objective The sub-goals tasks have to be done to make sure the objective of this thesis is fulfilled: • Implement a vehicle model which later can be used for testing the driver model. – Find a proper vehicle model in literature. – Implement the model in Matlab/Simulink. – Validate the model with the existing model that is implemented in one of VTI’s driving simulators. • Gather test data from a driving simulator at VTI. This data will be used to study the steering action of a person and how he/she positions the vehicle when doing a DLC. – Invite people to VTI. – Give instructions on how the test shall be performed to the invited test drivers and make sure they understand the information. – Make sure the test drivers successfully complete the DLC manoeuvre for the given velocity in order to get good data for the driver model. • Use the data in order to categorize the drivers and create reference trajectories for these drivers at a given velocity. – Use the data considered as "good" from the test drivers. This data is the test runs where the drivers successfully performed the DLC manoeuvre, i.e., a manoeuvre without any cone hits. – The good data is used to divide the drivers into three types: experienced, inexperienced and moderately experienced. – Create a reference trajectory for the vehicle placement during the DLC manoeuvre given a driver and velocity. • Implement a controller for reference tracking that uses a simulated trajectory for a driver and velocity. – Do a literature study in order to find a proper reference tracking algorithm. – Implement the chosen algorithm in Matlab/Simulink. – Validate and tune the controller until it works without any errors. 1.5 Related and Previous Work This section gives brief information about related and previous work done within the important parts in this thesis. 4 1.5.1 Introduction Vehicle model The literature in the field of vehicle dynamics today is vast. The question when modelling a vehicle is how much of the vehicle’s behaviour that must be included in the vehicle model. The more dynamics included in the model, the more complex it gets. There is well written literature about the steering and wheel dynamics, which are the most important factors in this thesis. The steering dynamics are well discussed in Sharp et al. [20] where a ten state nonlinear state space model for the steering dynamics is used. A simpler model can be used by studying the bicycle model which is a simplified vehicle model with two wheels only [4]. Keen and Cole [7] discuss how the vehicle can be described with a bicycle model which captures the vehicle dynamics quite well. The tyre’s dynamics must be well modelled with longitudinal and lateral forces combined with slip in order for the model to react normal in a situation as described in Figure 1.1. Pacejka and Besselink [14] have done a deep study in wheel dynamics and use the Magic formula to describe the relation between the slip of the tyres and the forces that are generated by them. 1.5.2 Driver Model The driver modelling can be quite complex depending on which driver characteristics the model must handle. As discussed in Benderius [2], there are different model perspectives that can be identified when modelling a driver. The two most significant perspectives are the control perspective and the cognitive perspective. The Control Perspective In this perspective, the human driver can be seen as a controller. The human estimates "control inputs" (vehicle position, distance to other drivers etc.) with his/her senses, where the eyes are most important. The human uses the information from the senses to control the vehicle with his/her hands and feet to be sure that the vehicle’s velocity and position is good in regard of the road and other drivers. The steering action is an important part when modelling the driver, which is well discussed in Ungoren and Peng [21], Benderius [2], Plöchl and Edelmann [15], Prokop [17] where the authors use the situation described in Figure 1.2. The figure shows how the vehicle is located a distance d from the trajectory and the angle between the vehicle heading and the tangent of the trajectory is β. An experienced driver would want to minimize these variables, which is what the authors do in different manners using penalty functions or parameter estimation and optimization. How to determine the driver model parameters is discussed in Renski [19], where the author optimizes a driver by using collected data from simulations. The optimal control signal can be calculated by minimizing a local performance index over a preview interval given a dynamic linear system, which is discussed by the authors in MacAdam [11]. In MacAdam [12] the author discusses how the controller in MacAdam [11] can be used for simulations of closed-loop automobile driving. A more complex approach is suggested in Cole [4], where the neuromuscular dynamics are studied when the driver puts torque on the steering 1.5 Related and Previous Work 5 wheel to navigate the vehicle. The control perspective seems to be the most studied one, probably because it is all based on control theory which has been well studied the last 100 years. d β 30 Figure 1.2: A vehicle that is located on a distance d from the road path with a difference between the road path tangent and the vehicle’s heading β. The Cognitive Perspective This perspective looks on how it is possible to create a model over the human mind. This is far more difficult than the control perspective because little is known about how the human mind works. In Wann and Wilkie [23], the authors ask: how do we judge a bend? The authors discuss how the retinal flow varies on the visual direction whether the driver is heading in a straight line or is in a curve. The visual direction is here defined as the angle between the vehicle’s yaw angle and the driver’s gaze. The proposed model tries to accomplish two things: minimizing the movement of visual direction and minimizing the rotation in the retinal flow. A phenomenon called looming is discussed in Li and Milgram [9], which means when a driver is in collision course with an object, the object will expand symmetrical in the drivers field of view, which can trigger reflexes. In MacAdam [13], the author discusses the importance of the human time delay and threshold limitations, e.g., a human can feel 0.005g linear accelerations. A model done by the cognitive perspective is a good way to complete a model done by, e.g., the control perspective, but it is hard to use it in a standalone fashion [2]. 6 1.6 Introduction Thesis Outline This thesis is divided in 7 chapters. Chapter 2 describes how the vehicle model works and how it was implemented. A validation of the vehicle model is presented in the same chapter where some of the dynamics are compared with the dynamics from a model which is implemented in a simulator at VTI. The results from the simulations with the test drivers and how the tests were done are presented and discussed in Chapter 3. Chapter 4 covers the categorization of the driver based on the test results and how the results can be used to build new trajectories. The driver modelling using an MPC approach is covered in Chapter 5 and the driver modelling with a FIR-filter approach is presented in Chapter 6. These two chapters also cover the control theory which is needed to create the driver model together with the simulation results for respectively driver. Chapter 7 summarizes the thesis with the conclusions of this thesis and possibilities for improvements and future work. Chapter 2 Vehicle Model This chapter contains a description of the implemented vehicle model. The vehicle model consists of two modelled parts: The steering dynamics and the tyres. The Figures 2.1 and 2.2 show the forces and states for the four-wheeled vehicle. Figure 2.1 shows the modelled vehicle from the side where the distances from the axis to the centre of gravity can be seen. The h0 s in the figure are the distances to the roll axis which are used to calculate the vertical load, Fz in Figure 2.2. The definition of the roll axis is where the chassis wants to roll. Other vertical forces, e.g., the forces from the weight transfer of the chassis due to the roll and suspension, are neglected. Figure 2.2 shows the vehicle model from above. The vertical and lateral forces, Fx and Fy , are calculated by using the slip of the vehicle. Unlike the assumption of constant roll angle of the vehicle, the yaw angle and yaw rate are included as states in the vehicle model. 2.1 Steering Dynamics The steering dynamics are modelled as in Sharp et al. [20] where the authors use a model with ten states. The ten states are listed in Table 2.1. Table 2.1: The Vehicle Model’s States State number x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 Quantity Yaw Angle Yaw Rate Longitudinal Velocity (local reference system) Lateral Velocity (local reference system) Longitudinal Position (global reference system) Lateral Position (global reference system) Rear Wheels Angular Position Rear Wheels Angular Velocity Front Wheels Angular Position Front Wheels Angular Velocity 7 Unit [rad] [rad/s] [m/s] [m/s] [m] [m] [rad] [rad/s] [rad] [rad/s] 8 Vehicle Model This model includes lateral and longitudinal forces on the front and rear of the vehicle together with airdrag and downforce. The model also includes the front and rear axle torque. All the equations handling the steering dynamics can be found in Appendix B. df dr Faz lr lf x7,x8 x9,x10 M g Tf Tr Jr G Jm hrr Jf Fax hg hrf Frx Ffx Roll axis Ffz Frz Figure 2.1: The vehicle seen from the side with the states and forces. x5 δ tf 1 Wb Ffx x1,x2 Ffy M,Iz,G 3 x3 2 x4 Frx tr Fry 4 x6 Figure 2.2: The vehicle seen from above with the states and forces. 2.2 The Tyres 2.2 9 The Tyres The tyres have been modelled as in Pacejka and Besselink [14] where the Magic Formula is used in order to determine the lateral and longitudinal forces on the tyres given the angular slip. The angular slip αf for the front tyres and αr for the rear tyres are calculated as αf = −δ + arctan ( x4 + lf x2 180 ) x3 π (2.1) and x4 − lr x2 180 (2.2) ) x3 π where δ is the resulting turn in degrees from the steering wheel action. All the equations handling the tyres’ dynamics can be found in Appendix C. Figure 2.3 shows a typical Magic Formula-curve. The force is zero when the slip angle is zero for the normal case, but the curve can be used to initiate rolling resistance by lowering the curve or by moving it more to the right. This means when the vehicle has zero slip, i.e., when the vehicle is rolling and the driver does not step on the gas or brake, the vehicle will decelerate slightly. αr = arctan ( Longitudinal forces from longitudinal slip 3000 2000 Force [N] 1000 0 −1000 −2000 −3000 −100 −80 −60 −40 −20 0 20 Longitudinal slip [%] 40 60 80 100 Figure 2.3: An example of the Magic Formula from a simulation done on the modelled vehicle. This curve shows how the force is equal to zero when the slip is zero. 2.3 Results and Discussion for Vehicle Model The vehicle model implemented is used together with the driver model for validating if the artificial driver behaves like a real driver. A validation is done with the vehicle model in the driving simulator to ensure the modelled vehicle’s dynamics 10 Vehicle Model behaves in a satisfactory manner. The model in the simulator was used for the data gathering so the importance of the two vehicle models giving similar results is crucial. The implemented model is validated by using the same initial states and front wheel angle as the simulator model. There is no braking and the clutch is pressed down so no torque is applied to the wheels from the powertrain. The steering wheel angle for the manoeuvre can be seen in Figure 2.4. The driver is turning the vehicle to the right and then a longer turn to the left. There is no major steering after three seconds. 2 1.5 Steering wheel angle [rad] 1 0.5 0 −0.5 −1 −1.5 −2 10 10.5 11 11.5 12 12.5 Time 13 13.5 14 14.5 15 Figure 2.4: The steering wheel angle for the validation. This is the input for the vehicle model which shows how the driver wants to steer the vehicle. The different approaches for modeling the tyres are the main reason why the dynamics for the modelled vehicle differ from the dynamics for the vehicle model in the simulator. The tyres used in this thesis are modelled in pairs, the front tyres and the back tyres, while each tyre in the simulator model is modelled individually. The model in this thesis has two longitudinal and two lateral forces for the front and rear axis (Ff x , Frx , Ff y and Fry in the Figures 2.2 and 2.1). The DLC manoeuvre exposes the tyres to great forces due to the fast steering movements from the driver. The equations for the longitudinal and lateral forces take several quantities into consideration, e.g., the slip angle and normal force on each tyre. The vehicle model used in this thesis does not take roll into consideration. The roll for the vehicle will create bigger down force on the tyres located on the opposite side from which the vehicle is steering, e.g., the tyres on the right hand side will feel a bigger down force if the vehicle is steering left. This will make the yaw rate bigger for the model taking roll into consideration due to the extra down force making the other side of the vehicle steer faster thanks to the friction. The comparison between the two models are shown in Figures 2.5 and 2.6. Figure 2.5 shows the velocities of the vehicle during the manoeuvre where the steering wheel angle described in Figure 2.4 was used. Figure 2.6 shows the longitudinal, lateral and yaw accelerations of the vehicle during the same manoeuvre. The difference in yaw rate between the two models brings differences in the longitudinal and the lateral acceleration. The equations for the longitudinal acceleration ax and the lateral acceleration ay which are used in this vehicle model 2.3 Results and Discussion for Vehicle Model 11 and the one in the simulator can, e.g., be found in Wong [24] and are calculated as (2.3) ax = V̇x − Vy Ωz and (2.4) ay = V̇y + Vx Ωz where Ωz is the yaw rate. The fact one model includes roll and the other does not results in different yaw rates between the two models, as discussed above. Equations (2.3) and (2.4) will therefore calculate accelerations that will differ between the two models. This will also result in a difference between the two models’ longitudinal and lateral velocity. This may be the biggest reason why the curves differ in the Figures 2.5 and 2.6. Longitudinal velocity Velocity [m/s] 23 Simulator Model Implemented Model 22 21 20 19 0 2 4 6 8 10 Time 12 14 16 18 20 Lateral velocity Velocity [m/s] 2 Simulator Model Implemented Model 1 0 −1 −2 0 2 4 6 8 10 Time 12 14 16 18 20 Yawrate Yawrate [rad/s] 0.5 Simulator Model Implemented Model 0 −0.5 0 2 4 6 8 10 Time 12 14 16 18 20 Figure 2.5: The longitudinal, lateral and angular velocities for the implemented vehicle model and the model used in the simulator. This is the result from a test where the driver steps on the clutch at 80 km/h and has the steering wheel angle shown in Figure 2.4. 12 Vehicle Model Longitudinal acceleration Acceleration [m/s2] 0.2 Simulator Model Implemented Model 0 −0.2 −0.4 −0.6 0 2 4 6 8 10 Time 12 14 16 18 20 Lateral acceleration Acceleration [m/s2] 10 Simulator Model Implemented Model 5 0 −5 −10 0 2 4 6 8 10 Time 12 14 16 18 20 Yaw acceleration [rad/s2] Yaw acceleration 2 Simulator Model Implemented Model 1 0 −1 −2 −3 0 2 4 6 8 10 Time 12 14 16 18 20 Figure 2.6: The longitudinal, lateral and angular accelerations for the implemented vehicle model and the model used in the simulator. This is the result from a test where the driver steps on the clutch at 80 km/h and has the steering wheel movement shown in Figure 2.4. The reason why the model in the simulator could not be used from the beginning was because the model was originally written in the programming language Fortran. There was however one person at VTI who worked with the interpreting of the Fortran code to the Matlab/Simulink environment. This person managed to finish this interpretation at the same time as the implementation of the vehicle model in this thesis was finished. This made it possible to do a validation of this thesis’ model with the interpreted model, which was validated with the Fortran model in the simulator. The interpreted model was chosen for further work even though the two models had similar dynamics. This model was chosen because it is implemented in the simulator which was used for the data gathering described in Chapter 3. The model implemented in this thesis shows the possibility to use a simpler model for this problem formulation. An even simpler approach could have been done if a bicycle model would have been used instead, e.g., the one found in [20]. This would have saved some time 2.3 Results and Discussion for Vehicle Model 13 because of the model’s simplicity. However, using a bicycle model may not be enough for covering all the vehicle’s dynamics in a satisfactory manner. The biggest differences between the implemented model and the model in the simulator, besides how the tyres were modelled and the omission of the roll, are: • The model in the simulator includes the dynamics of the engine and powertrain and calculates the torque on each tyre given the throttle position. The modelled vehicle has the front and rear axle torque as known inputs. • The simulator model includes the suspension on each wheel. This feature is not included in the modelled vehicle. • Besides the roll of the vehicle, the vehicle model in the simulator also takes the pitch of the vehicle into consideration. Another physical quantity left out in the implemented model is the camber angle of the vehicle’s tyres. The camber angle can be seen in Figure 2.7 where the camber angle is the angle between the normal of the surface and the tyre. The vehicle’s forces would have been greater if the camber angle would have been taken into consideration. This can bee seen in, e.g., (C.5) (Appendix C) for the lateral force, where the term SV y depends on the camber angle γ. Figure 2.7: One of the vehicle’s tyres. The Camber angle is the angle between the normal of the surface (straight line) and the tyre (dashed line). This vehicle has a negative camber angle. A typical value on the camber angle for a car is somewhere between +1 to −2 degrees. These angles are small and make less impact on the vehicle’s dynamics compared to the roll of the vehicle. Chapter 3 Test Drives and Data Gathering This chapter presents the setup used for the data gathering from the test runs in the simulator together with the test results. The data gathering was done in one of VTI’s simulators. A requirement for the test drivers was to not have any earlier experiences of a DLC manoeuvre in the simulation environment. The simulator used was SIM III at VTI, Linköping. The technical specification for this simulator can be found in Appendix F. 3.1 Test Specification It was desirable to get test results without too high deviations because the results should not differ too much in the DLC manoeuvre. In order to not get too high deviations in the results, the test drivers were allowed to get comfortable with the simulation environment before the real tests started. Another important factor was to make sure none of the test drivers got too many test runs and learned how to do an optimal DLC manoeuvre. A good balance between the comfort and keep the drivers inexperienced with the DLC manoeuvre had to be made. The test setup was therefore: • The test driver did the DLC manoeuvre at low velocity around 30 km/h as a warm-up. • This warm-up went on for around 2-4 turns before the real test started. • During the real test, the test driver got 4-5 tries on a required velocity. • If the test driver managed the manoeuvre, the required velocity increased 5 km/h. • The maximal velocity in these tests was set after the test person’s performance, i.e., the highest velocity where the test driver successfully did a DLC manoeuvre. 15 16 Test Drives and Data Gathering The required velocity would also be the maximal velocity of the vehicle during a manoeuvre. This made it easier for the test drivers to maintain the velocity of the vehicle by giving full throttle. This ensured the test drivers to only concentrate on steering through the cone track. When the test driver entered the zone where the manoeuvre took place, he/she pressed down the clutch pedal which made the velocity losses small. The clutch pedal was pressed down during the whole manoeuvre until the vehicle exited the last cones, see Figure 1.1 in Section 1.3. The manoeuvre was done on wet asphalt, which resulted in a low friction between the surface and the tyres. The main reason why the simulations were done on wet asphalt was because of the real tests later. The DLC manoeuvre would wear out the tyres after a few tries on dry asphalt, which leads to an economical issue. The data gathered after each test was saved on a .dat-file which can easily be handled in Matlab. The physical quantities to be logged were decided in advance and needs to be set in the simulator before the tests start. The most important data for this test is the input to the vehicle, the steering wheel action. 3.2 The Test Drivers Two simulation days were held at VTI where people were invited to drive the simulator and do the DLC manoeuvre. The test’s supervisors informed the test driver on how he/she should drive in the simulator. All the test drivers were supervised with a camera and microphone so the test supervisors could speak with them and give advices if something had been misinterpreted. A total of 37 tests were done in the simulator. A goal set by the test supervisors was to make sure the test drivers at least should accomplished one DLC manoeuvre at a velocity between 45-60 km/h. The idea when the robot implementation is to keep the robot from driving in velocities over 60 km/h, just for safety reasons. Most of the test drivers invited to the simulator were people from the university of Linköping with no experience of driving in a driving simulator at VTI. People from VTI were invited as well, as long as they did not have experience from the simulator. Figure 3.1 shows the ages and number of the male drivers participating in this simulation test. 3.2 The Test Drivers 17 Total number of male test drivers 10 9 8 Number of test drivers 7 6 5 4 3 2 1 0 20 21 22 23 24 25 33 34 Age Figure 3.1: Partition of male test drivers based on their ages. The total of male test drivers participating were 21. The ages and number of female test drivers can be seen in Figure 3.2. The two figures show how most of the test drivers are in the ages between 20-25 years. The total of test drivers during the two test days were 37, divided in 21 men and 16 women in different ages. Total number of female test drivers 10 9 8 Number of test drivers 7 6 5 4 3 2 1 0 19 20 21 22 23 24 25 40 53 57 Age Figure 3.2: Partition of female test drivers based on their ages. The total of female test drivers participating were 16. Each test driver was asked to complete a questionnaire after he/she finished a simulation. This is a questionnaire VTI wants the test driver to answer in order to get some feedback if something in the simulator can be implemented better. One of the questions on this questionnaire is how many kilometres the person drives every year in a vehicle (car, truck, bus or mc). The answers from the test drivers are shown in Figure 3.3. Ten thousand kilometres are quite a long distance and a person driving this distance a year probably has his/her work in a different city and therefore needs to 18 Test Drives and Data Gathering Driving experience per year for all test drivers 35 30 Number of test drivers 25 20 15 10 5 0 0−10000 10000−20000 20000−30000 Total of kilometers/year over 30000 Figure 3.3: The driving experience of the test drivers in kilometres. commute. Another reason may be driving is involved in the person’s occupation. Most of the test drivers were students who do not own a car. 3.3 Results and Discussion for the Simulator Tests Figure 3.3 showed how most of the test drivers are quite inexperienced drivers. However, the differences between the test results should not be too big because the DLC manoeuvre is not a common situation in the traffic. The biggest difference between the experienced and the inexperienced drivers was the ability to know the vehicle’s placement during the manoeuvre. Figure 3.4 shows how the cone track is formed and the distances between passages. 1.77 m 4.47 m 2.97 m Last Passage First Passage 1m 16.25 m 2.397 m 20.25 m 3.2 m Middle Passage 10 m 2m 2m 2m 8m Figure 3.4: The entire track. The figure shows the distances between the cones and the dimension of the car. The minimum lateral movement the driver has to do to successfully complete the manoeuvre is 2.77 m. 3.3 Results and Discussion for the Simulator Tests 19 A common error for an inexperienced driver observed during the test runs in the simulator was to drive the vehicle a little to the right through the first passage, which resulted in some cone hits. This is because of the drivers’ position in the car, where the driver sits on the left side and therefore has more control on the left side than the right side of the vehicle. Other common errors were: • The left turn in the end of the first passage came too early, which resulted in a cone hit on the last cone to the left. • The test driver did a too weak effort to go through the middle passage, which resulted in a cone hit on the right side. • The left turn into the last passage came too early, which resulted in some cone hits on the left side. • The test driver did a too violent turn after the middle passage, which made the driver to lose control of the vehicle and some cones got hit in the last passage. Figure 3.5 shows the position for the car when a driver has done over 20 DLC manoeuvres. The figure shows how the test driver ends the simulation after almost 7000 meters and the vehicle’s lateral position differs approximately 4 meters. The driver lost control of the vehicle two times, one right after 4000 meters and one time after 6000 meters, also seen in Figure 3.5. The driver drove approximately 200 m between the cone passages as soon as he/she exited one manoeuvre. This distance was never logged. A serie of double lane change−manoeuvres for one test driver 3 2 Lateral position [m] 1 0 −1 −2 −3 −4 0 1000 2000 3000 4000 Longitudinal position [m] 5000 6000 7000 Figure 3.5: The position for the vehicle during a test with several DLC manoeuvres. Every top on the curve is where the driver goes through the middle cone passage. The driver drove almost 7000 metres and lost control of the vehicle two times (at 4300 and 6200 meter) before he/she stopped the vehicle. The rectangle highlights one part of the curve which can be seen in the upper plot in Figure 3.7. 20 Test Drives and Data Gathering The data gathered during the simulations was divided into a smaller data set containing all the manoeuvres where no cones were hit. This is done in order to get rid of all the outliers, e.g., when a test driver lost control of the vehicle. This can be done by using a logged data vector named cone-hit, which contains the info if any cones were hit or not during a manoeuvre. This means it cannot be decided whether a test driver hit one cone or many cones. This scenario can be seen in Figure 3.6. The straight line is equal to one when the vehicle is inside the cone track. This straight line is set to zero as soon as the vehicle exits the cone track. Two bars can be seen in Figure 3.6, where the dashed line equals to zero but the straight line is one. This shows how the test driver did two successful manoeuvres. The second bar shows how the test driver hit a cone somewhere in the middle of the track, but it is uncertain if the driver hit more cones after the first hit. The fourth bar shows how the test driver almost did a successful manoeuvre, but he/she hit a cone/some cones in the end of the track, and again, it is uncertain if the driver only hit one cone or if he/she drove over two or more cones. Vehicle in cone−track and cone−hit 1 Inside cone track Cone hit 0.8 0.6 0.4 0.2 0 550 560 570 580 590 Time [s] 600 610 620 630 Figure 3.6: The solid line shows when the vehicle is inside (equals to one) or outside (equals to zero) the cone track. The dashed line gets equal to one if a cone gets hit. Figure 3.7 shows the logged position for the vehicle when the driver does a successful manoeuvre in almost 55 km/h, which is the same curve highlighted with a rectangle in Figure 3.5. The frequency for the data logging in the simulator is 100 Hz. The point on the vehicle logged during the manoeuvre is located in the middle of the front axis, about one meter from the front of the vehicle. The reason why so many test drivers were used during the data gathering was because it was an opportunity for colleagues and friends to try an advanced driving simulator. This offer of driving a simulator this advanced may not occur again for many of the people who were at VTI as test drivers. Two days for data gathering were considered enough and the fact a total of 37 test drivers showed up was satisfactory. It perhaps would have been more interesting if a certain age of the test drivers would have been studied instead of the quite big spread between ages in order to 3.3 Results and Discussion for the Simulator Tests 21 Position for a vehicle through the cone track at 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 Longitudinal position [m] 40 50 60 Steering wheel angle for a vehicle through the cone track at 55 km/h Steering wheel angle [rad] 4 2 0 −2 −4 0 10 20 30 Longitudinal position [m] 40 50 60 Figure 3.7: The position and steering wheel angle for a vehicle during a successful manoeuvre. The upper curve in this figure is the manoeuvre highlighted with a rectangle in Figure 3.5. Note, the cones in the plots from now on until the result plots in Chapter 5 - 6 have bigger dimensions than they have in reality, just for making it clearer where they are located. see what the differences could be between two different ages. Another possible arrangement for future works is to make sure the ratio between the test drivers’ genders is the same. The implemented driver model could represent gender and age of a person if these studies are done. If a decision is made on which group of people is going to be used as test drivers is taken, only a few people have to be used for the data gathering. By using the results from this small group of people, an average trajectory for the position of the vehicle and steering wheel action can be calculated with a deviation. More trajectories can be created using Monte Carlo-simulations when the average and deviations from the group of drivers are used. Chapter 4 Driver Type Modeling The typical characteristics of the drivers have to be found in order to create a model representing an inexperienced driver, a moderately experienced driver and another model representing an experienced driver. The easiest way is by looking on the differences between an experienced driver and an inexperienced driver. The categorization made here is based on the results from the DLC manoeuvres done in the simulator. An inexperienced driver is here a driver who performs poorly when it comes to do a DLC manoeuvre. This does not mean the driver has to be inexperienced when it comes to driving in real traffic. The experienced drivers in this thesis are test drivers who performed good DLC manoeuvres. The biggest difference between the drivers was how they placed the vehicle in the cone track. This was easiest to observe at high velocities when it is crucial to know when it is possible to steer the vehicle. An assumption is an experienced driver who knows how he/she has to turn early to manage the manoeuvre. It was therefore assumed the experienced driver is earlier with the steering wheel action than an inexperienced driver who could be late with the turns and therefore had to steer more violent in order to do a successful DLC manoeuvre. Another assumption on the experienced driver is his/her ability to successfully complete the DLC manoeuvre at high velocities. 4.1 The Driver Types Figure 4.1 shows the results for a typical inexperienced driver (dashed line) and a typical experienced driver (solid line). The figure shows the vehicle’s placement during a simulation. Typical for the inexperienced driver is to wait too long before the first left turn, because he/she is uncertain of the vehicle’s position and wants to be sure no cones are hit in the first passage. Another error by the inexperienced driver is he/she waits too long before steering the vehicle from the middle passage to the last passage. These late steering actions lead to another typical action for an inexperienced driver; the driver has to compensate with a hard right turn, which leads to a hard left turn when the vehicle shall go through the last gate. This behaviour created the oscillations seen in the plot for the lateral position in 23 24 Driver Type Modeling Figure 4.1. The driver is able to control the vehicle with the steering wheel and will make the oscillations disappear if the velocity is low. The consequence in a higher velocity would probably result in a driver who loses control over the vehicle and crashes. The typical trajectory for the experienced driver can be seen in the Vehicle position for an experienced and inexperienced driver at 55 km/h Lateral position [m] 4 Inexperienced driver Experienced driver 2 0 −2 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Steering wheel angle for an experienced and inexperienced driver at 55 km/h Steering wheel angle [rad] 6 4 2 0 −2 Inexperienced driver Experienced −4 −6 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.1: Typical position and steering wheel angle for the vehicle in a DLC manoeuvre for the inexperienced and experienced driver. The inexperienced driver turns the vehicle later compared to the experienced driver. The turn through the last passage, seen in the steering wheel angle plot, is more violent than the same turn done by the experienced driver. Figure 4.1. The experienced driver can locate the vehicle on the track and knows when he/she can turn left without hitting any cones in the first passage. The experienced driver also knows when it is possible to turn right from the middle passage to the last passage. By steering early from the middle passage, the experienced driver has more time to steer the vehicle through the last passage. The oscillations which occurred for the inexperienced driver disappears when planning the path like this. 4.2 Categorizing the Drivers The driver types are classified as experienced, moderately experienced and inexperienced. To categorize the drivers from the simulation tests a method called k-means clustering was used. The idea behind this method is to divide a set of curves into k different clusters, in this case k = 3, one group which represents the 4.2 Categorizing the Drivers 25 inexperienced drivers and two more for the other two driver types. The algorithm for the k means clustering is described in Figure 4.2. First, it is decided how many Start Choose the number of clusters k Centroid Calculate the distance between objects and centroid of the cluster No object changed cluster? End Group the objects based on minimum distance Figure 4.2: The k means clustering algorithm. The algorithm continues as long as any of the objects change cluster during an iteration. clusters (k) the datasets are going to be divided into. The algorithm first randomly assigns k clusters for every data point and then updates. The algorithm computes the initial mean as the centroid of the cluster’s randomly assigned points. Each data point is then assigned to the cluster whose mean is closest. The new mean of each cluster is then updated and this progress will go on until the algorithm converges which is when the assignments no longer change. An algorithm for curves is here used which works like the algorithm described above. This is done by using lrm (linear regression mixture) and srm (spline regression mixture) clustering. This is done in Matlab with the Curve Clustering toolbox [6]. The results from clustering the trajectories in Figure 4.3 are shown in the Figures 4.4 - 4.7. The 26 Driver Type Modeling labelling of the clusters is based on the results from the simulation runs described in Chapter 3. The experienced drivers completed the manoeuvre at high velocities because they were early with the steering. At the velocity 60 km/h, the lateral position of the vehicle cannot be too high in order for the drivers to have time to steer the vehicle down through the last cone passage. The labelling of the clusters is therefore made by comparing the highest mean of the lateral position between the clusters. The experienced drivers are assumed to have the lowest mean, while the inexperienced drivers have the highest mean. The resulting clusters together with this assumption are used to labelling each cluster with a driver. Test results 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 Longitudinal position [m] 40 50 60 10 20 30 Longitudinal position [m] 40 50 60 Steering wheel angle [rad] 6 4 2 0 −2 −4 −6 0 Figure 4.3: The trajectories for all test drivers at 55 km/h. 4.2 Categorizing the Drivers 27 Vehicle position for all experienced drivers at 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Steering wheel angle for all experienced drivers at 55 km/h Steering wheel angle [rad] 6 4 2 0 −2 −4 −6 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.4: These curves were categorized as a result from experienced drivers when the k means clustering method was used on the curves in Figure 4.3. Vehicle position for all moderate drivers at 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Steering wheel angle for all moderately drivers at 55 km/h Steering wheel angle [rad] 6 4 2 0 −2 −4 −6 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.5: These curves were categorized as a result from moderately experienced drivers when the k means clustering method was used on the curves in Figure 4.3. The three curves in Figure 4.7 are the mean of the vehicle’s lateral position given the longitudinal position from the curves in Figures 4.4 - 4.6. The result shows something interesting. The typically driver behaviour characteristics for the DLC-manoeuvre discussed in Section 4.1 can be seen in this figure. As discussed 28 Driver Type Modeling Vehicle position for all inexperienced drivers at 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Steering wheel angle for all inexperienced drivers at 55 km/h Steering wheel angle [rad] 6 4 2 0 −2 −4 −6 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.6: These curves were categorized as a result from inexperienced drivers when the k means clustering method was used on the curves in Figure 4.3. in Section 3.3, the experienced driver (solid curve) steers the vehicle earlier than the other two. This makes it easier for the driver to steer the vehicle back down to the last cone passage. The inexperienced driver (dot curve) is a bit late with the first left turn and wants to make sure the vehicle will go through the cone port in the middle without hitting any cones, therefore the bigger amplitude on the curve for the lateral position. The inexperienced driver is late with the turn back to the last passage which leads to a violent turn, which can be seen in the plot for the steering wheel angle. The moderately experienced driver (dash-dot curve) shows a behaviour which is somewhere between the other two drivers’. One reason why the moderately experienced driver has calmer steering wheel angle could be because the experienced driver knows he/she can be more violent with the turns and still manage the manoeuvre. The inexperienced driver is more violent with the steering wheel because he/she is struggling with the manoeuvre at this velocity. 4.3 Reference Trajectories The reference trajectories are crucial in order to get the implemented driver models to work. The reference trajectory are the lateral position of the vehicle. This can in reality be seen as the human driver’s eyes which he/she is using to see if the vehicle’s position is acceptable with respect to the predefined path the driver has in mind. This path is defined as the distance the driver is fixing his/her sight and is determined by a constant look ahead horizon. The reference trajectory can of 4.3 Reference Trajectories 29 Mean vehicle position for the three driver clusters at 55 km/h Lateral position [m] 4 2 0 −2 −4 0 10 20 30 Longitudinal position [m] 40 50 60 50 60 Mean steering wheel angle for the three driver clusters at 55 km/h Steering wheel angle [rad] 6 4 2 0 −2 −4 −6 0 10 20 30 Longitudinal position [m] 40 Figure 4.7: These curves are created by taking the mean of the vehicle’s lateral position, given the vehicle’s longitudinal position, for every curve from the Figures 4.4 - 4.6. These trajectories are used as references for the drivers described in the Chapters 5 and 6. The steering wheel angles in the second plot are calculated in a same manner as the lateral positions in the first plot; by calculating the mean given the longitudinal position from the data in each cluster. All the trajectories from the cluster come from test drives who successfully completed the DLC manoeuvre, so the mean trajectories are guaranteed to be successfully manoeuvres as well. course be something else, e.g., the yaw of the vehicle. This would be the same as a driver looking on the upcoming curvy road and thereafter decides how much it is necessary to steer in order to successfully complete the steering manoeuvre. The reference trajectories for the driver models in the Chapters 5 and 6 use the curves in the Figures 4.4 - 4.6 when the driver is told to drive in 55 km/h. For picking the reference trajectory, a function randomly picks two curves for the vehicle’s lateral position given the longitudinal position for one driver type and velocity, calculates the mean of the lateral position for these two curves and sends this mean curve as a reference to the driver. Chances are the references comes closer the mean if more curves are picked, which would make the references look the same. Example 4.3.1 shows how a reference trajectory is created. 30 Driver Type Modeling Example 4.3.1 Figure 4.8 show a cluster for experienced drivers at 50 km/h. The function for creating reference curves takes randomly two curves from cluster. These two curves can be seen in Figure 4.9. The function then calculates the mean of these two curves and one reference trajectory for an experienced driver at 50 km/h is created. Experienced drivers at 50 km/h 4 3 Lateral position [m] 2 1 0 −1 −2 −3 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.8: Cluster containing the experienced drivers trajectories from the simulator drives at 50 km/h. Two randomly picked trajectories from the good drivers at 50km/h cluster 4 3 Lateral position [m] 2 1 0 −1 −2 −3 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.9: Two trajectories from Figure 4.8 which were picked randomly by a function. 4.4 Discussion of the Driver Type Modelling 31 Mean position of the two randomly picked trajectories 4 3 Lateral position [m] 2 1 0 −1 −2 −3 −4 0 10 20 30 40 Longitudinal position [m] 50 60 Figure 4.10: The mean of the trajectories in Figure 4.9 which is going to be used as a reference trajectory for an experienced artificial driver in a simulation at 50 km/h. 4.4 Discussion of the Driver Type Modelling This thesis has sought to create a driver by doing nothing more than letting the user decide the driver type and velocity. A user gives a driver type and velocity as input and the implemented algorithms make sure the driver is created without any more intervention from the user. This is why machine learning had to be used for categorizing the three different driver types. The k means algorithm was an effective tool to use for creating the three different drivers given the gathered data. There is also a small drawback with the algorithm. The clustering algorithm found curves from the bad drivers and very bad drivers and categorized them as inexperienced drivers. It also categorized the curves for the good drivers and the very good drivers as experienced drivers. Left are the curves in between these other curves, which were categorized as moderately experienced drivers. At higher velocities where the requirements for the drivers are higher, results with a lower variance for the moderately experienced driver compared to with other two driver types. This can be seen in Figures 4.6 - 4.4 where the curves for the moderately experienced drivers have less variance than the other driver types at 55 km/h. In reality, the experienced drivers should be more relaxed with lesser variance than a less experienced driver. The choice of using the lateral position of the vehicle as the reference trajectory was based on the previous work where most of the authors in the Section 1.5.2 used this approach. Another reason was because it is easier to interpret and verify the lateral position in a plot, especially if the cones are printed as well, compared to if the yaw angle would have been used as the reference. The labelling of the drivers was done by assuming the inexperienced drivers have the highest mean of the lateral position. The labelling was made in order to minimize the interventions from the users. Otherwise the user would have to categorize three clusters for each velocity every time after the clustering. The reference trajectories which are going to be used for the driver model is here 32 Driver Type Modeling created with a quite simple method. The trajectories are determined by calculating the mean of the vehicle’s lateral position for one driver type and velocity given two random curves. It is important to have a large data set to be sure different reference trajectories are used. The number of possible reference trajectories for a data set containing l curves for the vehicle position can be calculated as the binomial coefficient: 2l . The curves are also combined in threes to maximise the number of reference trajectories if the dataset only contains three or four curves. An alternative method for creating reference trajectories is by using Gaussian regression. Inputs needed are a data set with inputs x and targets y, a covariance function k and test inputs x∗ . The goal is to predict the means and variances given the inputs, by computing the negative log marginal likelihood with the covariance kernel and its hyperparameters. Gaussian regression processes is a interesting field in machine learning, which can, e.g., be studied in Rasmussen [18]. Chapter 5 MPC as a Driver In this approach, Model Predictive Control (MPC) is used to control the vehicle as a driver. The MPC uses reference tracking in order to calculate a control signal, which is the steering wheel angle. The controller will use a linear vehicle model with four states. This model is not as complex as the one described in Chapter 2. The main reason is because this simplified vehicle model contains dynamics which is easier for a normal driver to perceive. 5.1 The Driver’s Vehicle Model When a driver is driving a vehicle, he/she knows the velocity by looking at the speedometer and he/she also has the ability to determine the deviation in length between the centre of the path and the centre of the vehicle by using his/her eyes. The yaw-angle is not as easy to determine by eyes as the lateral placement, especially when the angle is small. Perhaps there is a chance to decide bigger angles with some deviation. Other typical states, e.g., yaw-rate, accelerations and the lateral velocity are however very hard for a human to determine while driving, if he/she is not using an IMU. The driver can use other senses to observe changes in quantities when driving a vehicle. It is, e.g., possible to feel the changes in acceleration. An assumption done in this thesis is the eyes are the most dominant sense in comparison with the other senses, when it comes to collecting information and the focus will be on quantities observed by the eyes. A state space model of a vehicle model will be used in order to implement an MPC for the driver model. This model will not be near as complex as the model used in Chapter 2. The model used here is the same one as can be found in MacAdam [12]. This vehicle model, which can be expressed on a linear state space form ẋ = Fx + gu y = mT x (5.1) is linear with four states and has the steering wheel angle as control input. The 33 34 MPC as a Driver matrices and vectors in 5.1 are written as: 2C +2C 2l C −2l C −( αfM U αf ) −(U + f αrM U r αr ) 0 0 2lf Cαr −2lr Cαr 2l2 Cαr +2l2 Cαr ) −( f Iz U r ) 0 0 Iz U F = −( 1 0 0 U 0 1 0 0 g= 2Cαf M Gr 2lf Cαf Iz G r 0 0 (5.2) m= 0 0 1 0 (5.3) The states and the parameters of the driver’s vehicle model can be seen in Table 5.1. The matrix m in (5.1) is used to pick the states which were later used Table 5.1: The Driver’s Vehicle Model’s Parameters & States States and Parameters x1 x2 x3 x4 CαF ,CαR U M Iz lf , lr Gr Quantity Lateral Velocity Yaw Rate Lateral Position Yaw Angle Front and rear cornering coefficients Forward vehicle velocity Vehicle mass Vehicle yaw inertia Distance of the CG from the front and rear axles Steering ratio Unit [m/s] [rad/s] [m] [rad] [N/rad] [m/s] [kg] [kgm2 ] [m] [-] in the optimization routine. The state used was the lateral position which can be seen in (5.1) and (5.3). The values used for the model’s parameters can be found in Appendix D. The given state space model for the driver’s vehicle model is continuous. The discrete z-plane is mapped to the continuous s-plane in order to make this model discrete. This is done by using z = esT (5.4) which is the natural logarithm function [5] and T is the sample time. The discretization method used was the bilinear transformation or Tustin’s method, esT = esT /2 1 + sT /2 ≈ −sT /2 1 − sT /2 e (5.5) which is a first order approximation of the logarithm function. Combining (5.4) and (5.5) result in: 2 1 − z −1 1 + sT /2 (5.6) s= z= 1 − sT /2 T 1 + z −1 5.2 Model Predictive Control 5.2 35 Model Predictive Control Model Predictive Control is a control strategy which has been developed since the late seventies and there are vast of literature written about how to calculate and implement it [3]. The book Model Predictive Control [3] covers information both on how MPC works and how to tune and implement it. Nonlinear MPC (NMPC) is well discussed as well in the same book. The book Industriell Reglerteknik Kurskompendium [5] has a chapter about MPC and is a good alternative if the reader wants a brief introduction to MPC. In Keen and Cole [7], the authors use MPC to control the steering action in order to optimize the vehicle’s trajectory. Figure 5.1 shows a descriptive block diagram over the authors’ closed loop system. The steering controller uses information about a predefined path together with a predictor. The predictor is for the trajectory estimation which generates the driver’s estimates of the future closed-loop vehicle state trajectory. The controller uses the predicted data together with the info about the road to calculate a control signal to the vehicle. The IMF -block (Internal Model Family) contains the capability of the driver, which is a set of linearised system models over how well a driver understands the vehicle’s dynamics. In this case, the dynamic is the slip angle of the vehicle. An experienced driver knows how to handle the vehicle when the slip angle becomes big. The non-experienced driver would lose control for the same slip angle. In Kim and Cole [8], the authors use the same strategy as described in Keen and Cole [7], but includes the steering wheel angular velocity to the cost function. The biggest difference between the controllers is Kim and Cole [8] use a time variant controller. Driver Model Reference Trajectory Internal Model Family Steering Controller Vehicle Predicted Trajectory Estimation Figure 5.1: Block diagram over the system. 36 MPC as a Driver 5.2.1 Implementing the MPC as a Driver The idea with MPC is to take a control problem and turn it into an optimization problem with constraints. The optimization problem is solved online every time a new measured signal is available, which means good hardware will be required for the sometimes heavy calculations. The advantage with the MPC is its ability to take constraints and limitations on the control signals and the states into account during the optimization. This is the biggest difference compared to another common control strategy: Linear Quadratic (LQ) control. With this method, multivariable control problems can be solved using an optimization routine on a quadratic cost function of the states and control signals together with weight matrices. The MPC-problem can be formulated as an optimization problem together with constraints J = min u(k) N −1 X ||x(k + i)||2Q1 + ||u(k + i)||2Q2 i=0 subject to (5.7) x(k + i + 1) = F x(k + i) + gu(k + i), i = 0, ..., N − 1 N ∈ Z x(k + i) ∈ X , i = 0, ..., N − 1 u(k + i) ∈ U, i = 0, ..., N − 1 where the constrains here come from the limitations on the states, control signal and the linear model used in the MPC. The control signal, which is the steering wheel angle, has a maximum where it cannot be bigger. Therefore, a limitation on how many radians a driver can steer the steering wheel was defined. The MPC uses the linear vehicle model described in Section 5.1 for finding the optimal control signal. Algorithm 1 describes the procedure for determine the control signal for the MPC problem. Algorithm 1 The Algorithm for MPC Measure or estimate the state-signals x(k) Calculate the sequence of control signals by solving the problem in (5.7). Apply only the first element in the sequence of control signals calculated in step 2. 4: Do a time update, k:=k+1 5: Repeat from step 1. 1: 2: 3: The cost function in (5.7) was not sufficient for the purpose and must therefore be extended with a part for the reference tracking and another part for penalizing rapid changes of the control signal [5]. With these changes, (5.7) can be rewritten as J = min u(k) N −1 X i=0 ||x(k + i) − r(k + i)||2Q1 + ||u(k + i) − u(k + i − 1)||2Q2 (5.8) 5.2 Model Predictive Control 37 with the same constrains as in (5.7). By including the reference tracking part, the optimization routine is told to minimize the differences between the measured/predicted state signals and the reference signal. The state used in the minimization was only the lateral placement for the vehicle. In order to get smooth control the optimization routine is told to minimize the difference between two consecutive control signals. This makes sure the steering wheel angle has an appearance which human drivers could have accomplished and not an appearance with rapid changes only a robot could manage. Equation (5.8) can be rewritten on a compact form with matrices. By doing so, it is possible to write the problem as a quadratic programming problem with constraints and thereafter solve this formulation for finding the optimal control signal for each sample. The formulation for the optimal control signal for reference tracking and integral action is U ∗ = min u(k) 1 T T U (G Q1 G + ΩT Q1 Ω)U + (G T Q1 Fx − G T Q1 R − δ T Q3 Ω)U (5.9) 2 where the first element in the U ∗ will be used for the current sample. The total derivation for the MPC can be found in Appendix E. The total overview of the system with the MPC as a driver can be seen in Figure 5.2. The reference trajectory block will provide the MPC with the reference trajectory for which to track. This reference trajectory is calculated by giving a driver type (experienced, moderately experienced and inexperienced) and at which velocity the vehicle will have when it starts the manoeuvre. Driver Driver Type Velocity Reference Trajectory MPC u-Steering Wheel Angle Vehicle y-Lateral Placement Figure 5.2: The block diagram for the MPC as a driver. The reference trajectory block contains a trajectory for the MPC to follow. This reference trajectory is determined by giving a driver type together with a velocity. 38 MPC as a Driver 5.3 Results for the MPC as a Driver The MPC was implemented as an S-function in Simulink where the solver Quadprog was used for calculating the optimal solution given the constraints. The software used the quadratic programming formulation in (5.9) together with constraints to find the optimal control signal. The limitation of the steering wheel angle is 8 radians. The test was performed at the velocities 45, 50, 55 and 60 km/h for the three driver types. The results are seen in the Figures 5.3 - 5.14 where every figure contains six plots. The two first plots are in the first row, plot 3 and 4 are in the middle row while the two last plots, 5 and 6, are in the bottom row. The plots show: • Plot 1: The mean of the lateral position for all drives from the driver type at the velocity. • Plot 2: The mean of the steering wheel angle for all drives from the driver type at the velocity. • Plot 3: Trajectories of the lateral position which will be used as references in the simulations. • Plot 4: The steering wheel angle for the reference trajectories in plot 3. • Plot 5: The results from simulating the driver model by using the references in plot 3. This plot will also show the worst case position of the drivers as two dashed curves. • Plot 6: The resulting steering wheel angles for each curve in plot 5. The curves representing the worst case position are the most extreme position for the vehicle’s right and left hand sides during the manoeuvre. Because this collision check with the cones is done, the cones will have their original dimensions, which is 0.2 meters in diameter. The reference trajectories in plot 3 are created by using the trajectories from the test drives, which have been filtered from the test runs where cones were hit, mentioned in Section 3.3. The worst case scenario lines will therefore not be shown in these plots. The result performed by the implemented driver types will be mentioned as artificial drivers. 5.3.1 MPC Drivers at 45 km/h 45 km/h is the lowest velocity for the driver model. The variance for vehicle position was biggest here only because of the low velocity. The reason was the test drivers had no bigger problems on manoeuvring the vehicle at this velocity. It was therefore possible for the drivers to position the car more freely because they got enough time for steering the vehicle through the last passage. The Figures 5.3 - 5.5 show how the MPC managed the DLC manoeuvres for the different driver types. One thing the artificial drivers had in common was when they did the first turn after the first passage. The velocity was low, which made it easy to do the first turn without hitting any cones. The figures show how 5.3 Results for the MPC as a Driver 39 the experienced and moderately experienced artificial drivers were consistent on positioning the vehicle throughout the manoeuvre. The inexperienced artificial driver tried to navigate the vehicle throughout the path while avoiding the cones, instead of planning the position of the vehicle. Therefore the inexperienced artificial driver had bigger variance in vehicle position and steering wheel angle, which can be seen in Plots 3 and 4 in Figure 5.3. −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Inexperienced drivers 45km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.3: The inexperienced artificial drivers waited a little longer with the right turn through the last passage than the other two artificial driver types. The variance for the vehicle position was bigger than for the other two artificial driver types. 40 MPC as a Driver −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Moderate drivers 45km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.4: The moderately experienced artificial drivers waited a little longer than the experienced artificial drivers when they manoeuvred the car, but the resulting vehicle position was almost the same as for the experienced artificial drivers. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 45km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.5: It was hard to see any difference between the moderately experienced and experienced artificial drivers when the velocity was this low. 5.3 Results for the MPC as a Driver 5.3.2 41 MPC Drivers at 50 km/h The results at 50 km/h are almost the same as the results for 45 km/h. The biggest difference between the inexperienced artificial drivers compared to the other two was the inexperienced artificial drivers’ more intensive steering of the vehicle. It is clearer now in the figures at this velocity than for the case with 45 km/h how the experienced artificial driver steer the vehicle earlier than the other two artificial driver types. This can be seen for the vehicle’s position in plot 5 in Figure 5.8, where the curves are little more to the left compared to the same plots in Figures 5.6 and 5.7. Some steering wheel compensation can be seen for the artificial drivers for the steering wheel angle in the Figures 5.6 - 5.8, which means they started to steer the vehicle a little rougher in order to pass the last cone passage. −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Inexperienced drivers 50km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.6: The inexperienced artificial drivers had some more difficulties at this velocity than at 45 km/h, which can be seen on the more varying steering wheel angle. Some artificial drivers were early with the steering while others waited a little longer. This results in great variances, which can be seen in plot 5 and 6. Two drivers had to steer so intense the limit of 8 radians for the control signal was reached. No cones were hit even if the variance is big in plot 5. 42 MPC as a Driver −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Moderate drivers 50km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.7: The moderately experienced artificial drivers performed almost as good as the experienced artificial drivers, but they waited a little longer when they steer through the middle passage. −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Experienced drivers 50km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.8: 50 km/h was not a difficult velocity for the experienced artificial drivers to successfully do a DLC manoeuvre, but they were forced to steer a little bit harder than they did at 45 km/h. 5.3 Results for the MPC as a Driver 5.3.3 43 MPC Drivers at 55 km/h The artificial drivers started to have a hard time to manage the DLC manoeuvre at 55 km/h. The variances for the vehicle position and steering wheel angle were generally higher than for the previous velocities. The vehicle position in the Figures 5.9 - 5.11 look almost the same. This is because the driver has to be skilful to successfully complete a manoeuvre at this velocity. Another reason is the fewer rooms for mistakes the drivers have when the velocity gets higher, which leads to almost identical trajectories. The difference between the curves shows again the more experience the driver had, the earlier he/she steered through the cone passages. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Inexperienced drivers 55km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.9: The inexperienced artificial drivers still had problems at 55 km/h, but they did actually never hit any cones. 44 MPC as a Driver 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Moderate drivers 55km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.10: The steering wheel angle for the moderately experienced artificial drivers had the lowest variance compared to the other drivers at 55 km/h. This may be a reason why two cones were hit during the simulations of the moderately experienced artificial drivers. The cones hit were the lowest located cone in the middle passage and the cone to the upper left in the last passage. 5.3 Results for the MPC as a Driver 45 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 55km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.11: The experienced artificial drivers did put more action on the steering wheel than during the earlier manoeuvres at lower velocities. However, the experienced artificial drivers had no problems to successfully complete the manoeuvre without any cone hits. 46 5.3.4 MPC as a Driver MPC Drivers at 60 km/h 60 km/h is the highest velocity the three driver types will have through the cone track. This is because there were only three successful manoeuvres recorded with the test drivers from Chapter 3 who did successful manoeuvres above 60 km/h, which means a driver is really skilful if he/she managed a manoeuvre at 60 km/h. 60 km/h is a tough velocity and the Figures 5.12 - 5.14 show how all artificial drivers had to put much more action on the steering wheel compared to lower velocities. The steering wheel angles for the drivers show they needed to compensate the yaw angle when they arrived to the last cone passage, which lead to oscillations in the vehicle position. −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Inexperienced drivers 60km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.12: The inexperienced artificial drivers do drive through the middle passage without any cone hits, but still had no chance to avoid the cones in the last passage. Due to the high velocity, most of the artificial drivers did not have the time to steer the vehicle hard enough to avoid some cones, this can be seen by the big steering wheel angle in plot 6. Plot 5 shows the first cone in the upper left is inside the dashed line, which means this artificial driver was not even close to do a successful manoeuvre. Based on the results in plot 6, where several drivers had high steering wheel angle through the last passage, there were probably several artificial drivers who hit the same cone. 5.3 Results for the MPC as a Driver 47 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Moderate drivers 60km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.13: The moderately experienced artificial drivers show how they can manage the DLC manoeuvre at 60 km/h. The moderately experienced artificial driver put more action on the steering wheel compared to the experienced artificial driver at the same velocity, in order to complete manoeuvre. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 MPC−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 60km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 MPC−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 5.14: Based on the result of the steering wheel angle in plot 6, the experienced artificial driver did not have the same struggle getting through the last passage without any cone hits compared to the other two driver types at the same velocity. 48 5.4 MPC as a Driver Discussion of the MPC as a Driver The results in the previous section showed how the MPC managed the reference tracking well. The characteristics between the driver types discussed in Section 4.1 could be seen in the car’s lateral position in the Figures 5.3 - 5.14. The idea with the MPC came early due to its reference tracking ability. One thing to have in mind when modeling a driver is the model cannot be perfect, there have to be some errors in the driving when the velocity of the vehicle increases during a manoeuvre. This is one drawback by using MPC in a problem like this; to use a controller, which finds a control signal by optimization and drives like an inexperienced driver. It is better to give the MPC different curves for varying manoeuvre results instead of giving the MPC the same curve (a mean curve for a driver at a given velocity) and hope the result differs for each case by rearrange the MPC’s setting for every simulation. The results in Section 5.3 showed how the MPC driver managed to almost recreate the reference trajectories during the simulations. It is doubtful whether it would have been possible to see the different drivers’ characteristics by using one single curve to simulate the three driver types. One approach with the MPC was to use the variance of each driver type from the DLC manoeuvres at a specific velocity and correlate this variance as an uncertainty on the vehicle’s parameters in the linear model used by the MPC. The variances were calculated from the clustered curves in Section 4.2. This variance was then used to add an uncertainty by using, e.g., a normal distribution on the parameters in the vehicle model equations in (5.2)-(5.3). The inexperienced drivers who had higher variance in their results therefore got more uncertainty on the vehicle parameters. The performance by the MPC reduces the worse the model it uses becomes. The idea with this method was to define a more inexperienced driver as a person with bad knowledge over the vehicle’s dynamics. The calculated variance was used together with a scaling factor in the vehicle model in the MPC depending on the affected quantity. The scaling factor for the distance to the centre of gravity was much lower than the scaling factor for the cornering stiffness because these quantities differ with a factor 1000. This method was not satisfactory due to the ad-hoc implementation. The three drivers had different scaling factors at each velocity, all determined by simulating the model until the artificial driver performed well. This was however no assurance for a good result due to the different variances given from the created trajectories. The result was a driver who completed the manoeuvre in one simulation, but could fail in the next. The same scaling factors, but a slightly different variance, resulted with a driver who drove with a much more oscillatory behaviour. This led to some cone hits due to the bad steering by the driver, who lost control of the vehicle. A solution which cannot guarantee certain control of the vehicle without any accidents is clearly not a solution which can be used for vehicle testing. The reason why an advanced controller as the MPC was used is due to the relatively easy algorithm, which can be understood with some basic knowledge in linear algebra and control theory. There are different software which can be used 5.4 Discussion of the MPC as a Driver 49 for solving these problems. This solution is based on Matlab’s quadprog-function. An alternative is qpOASES, which is an open-source C++ implementation. It has an interface which makes it possible to use together with a third-party software, e.g., Matlab/Simulink. The main reason why quadprog was used is because it is quite easy to use and allows the user to stay in the Matlab environment. An interesting aspect which could be tested is to compare the simulation speed between other solvers and the quadprog function. However, it was unnecessary to question which solver to use when the simulated manoeuvres approximately takes 3-5 seconds with the hardware described in Appendix A. Figure 5.15 shows the computational time during a simulation. The total computational time in the figure is 0.0023 seconds with the hardware described in Appendix A. The choice of solver might get more crucial for bigger path planning problems where a big prediction horizon has to be used. The bigger the prediction horizon is, the more iterations have to be done by the optimization routine, which will increase the computational time. The real-time feasibility for MPC is not certain if the computational time gets too big. Methods for increasing the computational speed are discussed in many articles, e.g., in Axehill and Hansson [1] where the authors have derived a high-performance tailored MPC algorithm. −5 9 Calculation time for a simulation with the MPC as a driver x 10 8 MPC calculation time [s] 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 Time [s] Figure 5.15: Calculation time through a simulation with the MPC as a driver As discussed in Section 1.5, where literature related to reference tracking problems were studied, there are many alternative methods which can be implemented. Most of the algorithms used in the studied literature are simpler than the MPC approach done in this thesis. Only one article from the prestudy was using the MPC 50 MPC as a Driver for reference tracking. One thing most of the works in the literature study had in common was to come up with an algorithm which creates the optimal driver. The objective for this optimal driver is to; given a predefined trajectory, have as low deviation as possible when driving a manoeuvre. This was one part of this thesis for creating a driver; the other part completed the driver was the prework with creating trajectories. The machine learning (k means clustering) kept this thesis in the control perspective without any time spent in studying and modeling the human behaviour. Another advantage with this method is no changes have to be made if the user wants to cluster new data. Chapter 6 FIR-Filter as a Driver This chapter presents the driver model implemented as a FIR-filter. A FIR-filter was used together with one reference curve made by the gathered data from the simulations described in Section 4. The reference was used together with a dataset for the steering wheel angle and the vehicle’s lateral position in order to estimate the coefficients in the FIR-filter. 6.1 FIR-Filter as a Driver A FIR-filter is a digital filter which in contrast to an Infinite Impulse Response filter (IIR filter) has a finite impulse response. The FIR-filter of order N can be described as the sum y(n) = N −1 X h(k)x(n − k) (6.1) k=0 where h(k) is the impulse response for the sample k [10]. The idea is to use gathered data from the simulations to build a filter which is able to redo the DLC manoeuvre. The data used for the FIR-filter are the vehicle lateral position y and the steering wheel angle u. Another data set used is a reference trajectory r, which is a vector containing the vehicle position created according to Section 4.2. The idea with the reference trajectory is the same as the one used in the approach with the MPC in Section 5.2. By using the already gathered vehicle position together with the reference trajectory, good tracking performance can be achieved by using iterative refinement. The least square method is used for calculating the steering wheel angle. The filter is trained to mimic the driver by estimating the vectors Fy and Fr in the control law u = Fr r + Fy y (6.2) where the vectors are described in Tables 6.1 and 6.2. The filter is using two constants to create the filter order. These two constants are n1 and n2 , which are the look back horizon and the look ahead horizon in the 51 52 FIR-Filter as a Driver Table 6.1: The data used in the FIR-filter algorithm Vector u r y Information Steering wheel angles from a test run Reference of the lateral position Lateral position from a test run Table 6.2: The vectors containing the FIR-filter parameters Vector Fr Fy Information Coefficients for the reference vector Coefficients for the lateral position vector Size R(n1 +n2 +1)×1 R(n1 +1)×1 filter. The filter order for Fr is n1 + n2 and the order for Fy is n1 which brings the total filter order in (6.2) to 2n1 + n2 . The vectors are estimated by using a window, with the size of the filter order, which slides through the data points, see Figure 6.1. Filter window n Reference Vehicle pos. Current position n1 n2 Figure 6.1: The figure shows the sliding window where the filter is working. The two curves are the reference trajectory of the vehicle position (solid line) and a trajectory for the vehicle position from a simulation (dashed line). The zoomed in rectangle shows how the filter window is build up with n2 and n1 , and were the current position of the windows is. By sliding, it means when the filter is done collecting info for one sample, an update is done and the filter can now collect info for the new sample within the window size n = n1 + n2 + 1. The filter sets up the equation for the coefficients in 6.2 Results for the FIR-filter as a Driver 53 the vectors Fr and Fy in (6.2) as u(k) = a1 r(k + n2 ) + a2 r(k + n2 − 1) + ...+ + an2 +1 r(k) + ... + an1 +n2 +1 r(k − n1 )+ (6.3) + b1 y(k) + b2 y(k − 1) + ... + bn1 +1 y(k − n1 ) for the sample k. This can be written as u(k) = n1 X ai+1+n2 r(k − i) + i=−n2 n1 X bi+1 y(k − i) (6.4) i=0 The FIR-filter only looks ahead in the predefined reference trajectory, since the lateral placement y is only known from the current position and back in time. If (6.3) is used on a dataset containing N data points, it can be written using vector notation F U =M r (6.5) Fy where r(1 + n2 ) . . . r(1 − n1 ) y(1) . . . .. .. .. .. .. . . . . . M = r(N + n2 ) . . . r(N − n1 ) y(N ) . . . a1 .. . y(1 − n1 ) , (6.6) y(N − n1 ) u(1) u(2) an1 +n2 +1 Fr and U = = .. Fy b 1 . .. u(N ) . bn1 +1 (6.7) The vector U in (6.7) is a subvector to u in Table 6.1. The coefficients in the right hand side in (6.5) can now be estimated by using least squares method [16] Fr = (M T M )−1 M T U = M T U (6.8) Fy Modeling the driver as a FIR-filter is described as a block diagram in Figure 6.2. The Fr and Fy in the figure come from the solution in (6.8). Algorithm 2 shows how the FIR-filter is implemented. 6.2 Results for the FIR-filter as a Driver The FIR-filter was implemented in Matlab for the calculations of the feedforward Fr and feedback Fy and a Matlab function block was used in Simulink in order 54 FIR-Filter as a Driver Algorithm 2 The Algorithm for Creating the FIR-filter Gather data for the input (steering wheel angle) and output (vehicle position) together with a reference trajectory. 2: Use a sliding window method to gather the impulse response for the samples k = n1 , n1 + 1, ..., n − n2 . 3: Form the matrices U and M in (6.6). 4: Calculate the impulse responses Fr and Fy matrices by solving (6.8) 1: Driver Driver Type Velocity Reference Trajectory Fr + S + S u-Steering Wheel Angle Vehicle y-Lateral Placement Fy Figure 6.2: The block diagram for the FIR-filter as a driver. The Fr and Fy blocks are calculated with (6.6) where the a parameters are in the Fr block and the b parameters are in the Fy block. to do the online simulations. Figure 6.3 shows the steering wheel angle from a test drive (thin line) and the result taking Fr r + Fy y (thick line) with the reference and vehicle position curve from the same test drive. The values for n1 and n2 for this simulation were 2 respectively 20. Figures 6.4 and 6.5 show the coefficients from the result in (6.8) for an experienced driver at 50 km/h. The figures show how the coefficients near the current sample have bigger impact than the ones late in the feedforward. It can also be seen how the impact on indexes 14-15 (sample 6 and 7 in the feedforward) have big impact on the result as well. This shows how both the feedback and feedforward have impact on the steering wheel angle. The simulations are done in the velocities 45, 50, 55 and 60 km/h for the three driver types. The Figures 6.6 - 6.17 have the same appearances as the result plots for the MPC approach presented in Section 5.3. The result performed by the implemented driver types is here be mentioned as artificial drivers. 6.2 Results for the FIR-filter as a Driver 55 Steering wheel angle from the simulator test and from the FIR−filter 3 FIR−filtered steering wheel angle Measured steering wheel angle 2 Steering wheel angle [rad] 1 0 −1 −2 −3 5300 5350 5400 5450 5500 5550 Number of sample 5600 5650 5700 Figure 6.3: The figure shows a comparison between a steering wheel angle from a test drive and the computed one by the FIR-filter. This result is one manoeuvre from one great batch containing many manoeuvres. Another DLC manoeuvre begins as soon as this one ends, which results in a discontinuity between two measured steering wheel angles (because the distance between the manoeuvres never was logged). The look-ahead horizon reaches the first turn in the next DLC manoeuvre when the FIR-filter calculates the coefficients in the end for the feedforward. This is why there is a jump in the end of this manoeuvre for the steering wheel angle calculated by the FIR-filter. Parameter values for Fy 4000 2000 Parameter value 0 −2000 −4000 −6000 −8000 −2 −1 Parameter index 0 Figure 6.4: The parameters for the feedback vector Fy for an experienced driver at 50 km/h. Index 0 is the coefficient for the current sample while index -2 and -1 are the coefficients for the past samples. 56 FIR-Filter as a Driver Parameter values for Fr 6000 4000 Parameter value 2000 0 −2000 −4000 −6000 −2 −1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Parameter index Figure 6.5: The parameters for the feedforward vector Fr for an experienced driver at 50 km/h. Index 1-20 are the coefficients for future samples, index 0 is the coefficient for the current sample and index -2 and -1 are the coefficients for the past samples. 6.2.1 FIR-Filters Drivers at 45 km/h The Figures 6.6 - 6.8 show the results by the three artificial driver types at 45 km/h. The inexperienced artificial driver had severe problems even though the velocity was at 45 km/h. The first turn was made too late and the artificial driver was not able to finish the manoeuvre. The steering wheel angle is higher for the inexperienced artificial drivers than for the moderately experienced and experienced artificial drivers, but the reason why some of the inexperienced artificial drivers hit cones were because they were late with the steering. The two more experienced artificial drivers turn earlier after the first passage which helps them to successfully complete the manoeuvre. 6.2 Results for the FIR-filter as a Driver 57 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Inexperienced drivers 45km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.6: The inexperienced artificial drivers were, as discussed earlier, way too late with the steering which gave them problem when they were trying to go through the last passage. The majority of the artificial drivers hit several cones in the last passage. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Moderate drivers 45km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.7: The moderately experienced artificial drivers had almost the same vehicle position throughout the manoeuvre and showed no tendencies to lose control of the vehicle. The moderately experienced artificial drivers were a little late compared to the experienced artificial drivers when steering the vehicle from the middle passage to the last passage. 58 FIR-Filter as a Driver 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 45km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.8: The experienced drivers had, like the moderately experienced artificial drivers, no problems with the manoeuvre at this low velocity. 6.2 Results for the FIR-filter as a Driver 6.2.2 59 FIR-Filters Drivers at 50 km/h The Figures 6.9 - 6.11 show how the velocity 50 km/h put the artificial drivers to the test and the only group of artificial drivers to complete the manoeuvre without any cones hit were the moderately experienced artificial drivers. The inexperienced artificial drivers had problems to locate the car in the first passage, which resulted in a too early turn and a cone hit in the upper right. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Inexperienced drivers 50km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.9: Some of the inexperienced artificial drivers had some difficulties with this velocity which resulted in cone hits in the first and last passage. However, two of the artificial drivers managed to steer the car early through the middle passage, which made it easy for them to go through the last passage without hitting any cones. 60 FIR-Filter as a Driver 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Moderate drivers 50km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.10: The moderately experienced artificial drivers started to have some difficulties at 50 km/h. This resulted in some oscillations in the vehicle position when they went through the last passage. However, none of the artificial drivers hit any cones. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 50km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.11: It can be seen in plot 6 for the steering how one artificial driver was responsible for the cone hit for this velocity. This driver turned too early in the first passage and turned left too early before entering the last passage. The rest of the artificial drivers did complete the manoeuvre. 6.2 Results for the FIR-filter as a Driver 6.2.3 61 FIR-Filters Drivers at 55 km/h The Figures 6.12 - 6.14 show how the artificial drivers had a difficult time at 55 km/h. The oscillations in plot 5 in the figures are bigger than earlier and the steering wheel angle has increased as well. The experienced artificial drivers did not, compared to the others artificial drivers, hit any cones in the final passage because of the early turns through the middle passage. However, this resulted instead in cone hits in the first passage because they started steering too early. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Inexperienced drivers 55km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.12: It looks like the cone in the upper right is hit during these simulations. The velocity is too high for the inexperienced artificial drivers, which made it difficult for them to go steer through the last passage in time. This resulted in cone hits in the right row of the last passage. 62 FIR-Filter as a Driver Steering wheel angle [rad] Moderate drivers 55km/h 4 2 0 −2 −4 0 10 20 30 40 50 Longitudinal position [m] 60 Steering wheel angle [rad] Lateral position [m] Mean position for the test drivers 2 0 −2 −4 0 10 20 30 40 50 Longitudinal position [m] 60 Steering wheel angle [rad] Lateral position [m] Vehicle position for the references 4 Lateral position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 10 20 30 40 50 Longitudinal position [m] 60 Mean steering wheel angle for the test drivers 5 0 −5 0 10 20 30 40 50 Longitudinal position [m] 60 Steering wheel angle for the references 5 0 −5 0 10 20 30 40 50 Longitudinal position [m] 60 Steering wheel angle for 10 FIR−simulations 5 0 −5 0 10 20 30 40 50 Longitudinal position [m] 60 Figure 6.13: Similar with the inexperienced artificial drivers, the moderately experienced artificial drivers have much more oscillations in the vehicle position than for the previous velocity. The higher velocity requires more from the drivers and some of them hit the cones in the right row in the last passage. −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Experienced drivers 55km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.14: The oscillations are starting to grow bigger even for the experienced artificial drivers. The experienced artificial drivers are too early with the turn in the first passage. Some of the artificial drivers were too early with the turn in the middle passage. However, none of the cones in the last passage were hit. 6.2 Results for the FIR-filter as a Driver 6.2.4 63 FIR-Filters Drivers at 60 km/h The artificial drivers clearly show they have some difficulties with controlling the vehicle when driving at the highest velocity in these tests, which resulted in many cone hits. The Figures 6.15 - 6.17 show an increase in the steering wheel action from the artificial drivers compared to the result at lower velocities. The difference between the inexperienced artificial drivers and the others is seen in plot 5. The result in plot 5 in Figure 6.15 shows how the inexperienced artificial drivers were not even close to do a successful manoeuvre. The other two driver types had a difficult time as well, but performed much better. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Inexperienced drivers 60km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.15: The inexperienced artificial drivers are chanceless at 60 km/h. There were no drivers who avoided the cones and from plot 5 in the figure, it looks like half the amount of cones got hit. The artificial drivers were not able to steer through the middle passage to the final passage in time. 64 FIR-Filter as a Driver −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 0 −2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 2 Steering wheel angle [rad] Moderate drivers 60km/h Mean position for the test drivers 4 Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.16: The moderately experienced drivers did perform quite well at this high velocity, but were too early when steering through the middle passage. 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for the references 4 2 0 −2 −4 0 20 40 60 Longitudinal position [m] Vehicle position for 10 FIR−simulations 4 2 0 −2 −4 0 20 40 Longitudinal position [m] 60 Steering wheel angle [rad] 2 Steering wheel angle [rad] Lateral position [m] Lateral position [m] Lateral position [m] 4 Steering wheel angle [rad] Experienced drivers 60km/h Mean position for the test drivers Mean steering wheel angle for the test drivers 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for the references 5 0 −5 0 20 40 60 Longitudinal position [m] Steering wheel angle for 10 FIR−simulations 5 0 −5 0 20 40 Longitudinal position [m] 60 Figure 6.17: The steering wheel angle for the artificial experienced drivers are very high, which mean they really put an effort to steer from the middle passage to the final passage. However, they did not steer hard enough and it resulted in some cone hits in the right row in the last passage. The artificial drivers were also too early with the first turn from the first passage. 6.3 Discussion of the FIR-filter as a Driver 6.3 65 Discussion of the FIR-filter as a Driver The results from the Figures 6.6 - 6.17 in Section 6.2 show the FIR-filter’s reference tracking ability. However, the results are poor and the FIR-filter could not mimic the drivers in a satisfactory manner. The fact the moderately experienced artificial driver at 50 km/h performed better than the experienced artificial driver is a contradiction and makes the categorization of drivers made in Chapter 4 unnecessary. Another undesired result is how the inexperienced artificial driver performed better at 50 km/h than at 45 km/h. The driver implemented as a FIRfilter showed more uncertainty than the MPC driver, with much more oscillations in the vehicle position and many more cone hits. A solution which results in an oscillative behaviour is undesired if the approach is meant to be used in vehicle testing. The FIR-filter algorithm is, compared to the MPC, easy to implement. The algorithm was implemented in Matlab. The implementation, which consists of two for loops, would probably almost look the same if it was done in another language. A Problem has been observed related to how the FIR-filter parameters are determined. The parameters can only be applied with the curves which were used when they were estimated. The FIR-parameters vary significantly for the different curves even though the difference between the curves is small. However, the calculations for the FIR-parameters are not computationally heavy. One drawback is the initialization of the filter order, how should n1 and n2 be set in order to get the best reference tracking result? No optimal values on these parameters were found for the simulations with different driver types and velocities. The setup for the FIR-filter makes it independent from the driver’s velocity, which probably must be taken into consideration for better tracking results. However, the FIR-filter showed its potential for reference tracking and it has low computational requirements and is an easy algorithm. If some improvements are done in order to make the algorithm more robust, e.g., take the velocity into consideration, the FIR-filter is a plausible method for reference tracking within the scenario. Chapter 7 Summary This chapter contains a summary of the thesis work, where a brief conclusion is presented before some comments on how this thesis can be used for future works and projects. 7.1 Conclusion A driver model for three different driver types has been implemented as a controller with two different approaches. The three different driver types were an experienced driver, a moderately experienced driver and an inexperienced driver. The two approaches chosen were MPC and a FIR-filter. The manoeuvre studied was the DLC manoeuvre and the goal with the thesis was for the driver model to successfully manage this manoeuvre in a simulation environment. One disadvantage with MPC in a problem with different driver types is how MPC tends to make the planned inexperienced driver better than originally was intended. This problem was solved by using worse reference trajectories for more inexperienced drivers. It may be better to use a simpler controller for a problem like this because of the sometimes heavy computer calculations for finding the optimal control signal. However, the computational requirements for MPC can be significantly reduced using a high-performance algorithm like the one in [1]. The computational time for the MPC in the DLC manoeuvre was low enough for it to be used in online calculations. The advantage with the FIR-filter is the, compared to MPC, simple algorithm and low computational time. The disadvantage is the unpredicted results, where it sometimes was difficult to see the predicted driver’s characteristics, discussed in Section 4.1. The FIR-filter could not fully mimic the driver from the data set, which makes it less robust than the MPC. The standalone FIR-filter used was not enough to get satisfactory results when it came to mimic the different driver types. However, the algorithm showed it can be used in reference tracking if some improvements are made. An example is to make sure the algorithm takes the velocity into consideration. 67 68 Summary The ideal solution is a driver somewhere between the two presented, with an algorithm easy enough to implement with low computational time but on the same time robust against variances and disturbances when it is implemented in hardware. 7.2 Future Work The artificial driver never got implemented in the hardware due to the lack of time and the robot was on the same time occupied by other projects. The next step is of course to investigate the possibilities for an implementation of the driver to the hardware. The steering action of the driver has been studied, but the robot also has the ability to brake and give throttle to the vehicle. This option is maybe not necessary to study for the DLC manoeuvre, but there are other manoeuvres which can occur in a normal traffic situation. One test could be a left turn from a bigger road, where the robot has to decrease the vehicle’s velocity before making the turn. The drivers knew when they had to do the DLC manoeuvre and could therefore plan how they would steer before entering the cone passage. A different test would be to surprise the driver with the manoeuvre, e.g., letting a bigger animal cross the road. This would require sensors in order to make the robot aware of the danger and avoid a collision. This test can be extended to include the pedals as control signals. As discussed in Section 4.4 the method used for creating the reference trajectories is quite simple. Because of the large amount of data from the simulation tests, this method was sufficient. The collection of data however took some time and required lots of volunteers. An alternative would therefore be to only do a few tests and thereafter generate new references. This can be done by using, e.g., Gaussian Processing or Monte Carlo simulation. The approaches for the driver models (MPC and FIR filter) are just two of many approaches which can be used for a DLC manoeuvre. Other approaches could, e.g., be using a PID-controller or using a LQ-controller. The DLC manoeuvre only lasted for around 3-5 seconds depending on the vehicle’s velocity, which does not require too much computational power to simulate because of the small prediction horizon needed. A more interesting approach with a driver model would be to let it drive a longer path and make it more demanding by including unknown obstacles, which can be detected with sensors as discussed above. The vehicle model used by the MPC represents the vehicle’s dynamics in a simple way which can be understood by a driver. An interesting development option would be to include a capability which varies between the drivers’ skills in a manner discussed in Keen and Cole [7]. This would give the more experienced drivers an advantage during a manoeuvre. The FIR filter showed its potential for reference tracking for these short manoeuvres, but the drawback is the output tracking error. For preventing some of the output error, an adaptive least square (LMS) controller can be used for adjusting the FIR filter coefficients based on the output tracking error [16]. Another 7.2 Future Work 69 feature which can be added to the FIR-filter is gain scheduling in order to adjust the filter coefficients depending on the driver’s velocity. The idea of choosing the the backward and forward horizon can also be extended to the nonlinear case from the linear FIR case. 70 Summary Bibliography [1] Daniel Axehill and Anders Hansson. A dual gradient projection quadratic programming algorithm tailored for model predictive control. In Proceedings of the 47th IEEE Conference on Decision and Control, pages 3057–3064, Fiesta Americana Grand Coral Beach, Cancun, Mexico, dec 2008. [2] Ola Benderius. Driver modelling: Data collection, Model Analysis, and Optimization. Department of Applied Mechanics, Chalmers University of Technology, 2012. [3] Eduardo F. Camacho and Carlos Bordons. Springer, 2nd edition, 2004. Model Predictive Control. [4] David J. Cole. A path-following driver-vehicle model with neuromuscular dynamics, including measured and simulated responses to a step in steering angle overlay. Vehicle System Dynamics, 50(4):573–596, 2012. doi: 10.1080/ 00423114.2011.606370. [5] M. Enqvist, T. Glad, S. Gunnarsson, P. Lindskog, L. Ljung, J. Löfberg, T. McKelvey, A. Stenman, and J-E. Strömberg. Industriell reglerteknik Kurskompendium. Reglerteknik, Institutionen för systemteknik, Linköpings universitet, December 2010. [6] Scott Gaffney. The curve clustering toolbox (cctoolbox). 2005. URL http: //www.datalab.uci.edu/resources/CCT/. [7] Steven D. Keen and David J. Cole. Application of time-variant predictive control to modelling driver steering skill. Vehicle System Dynamics, 49(4): 527–559, 2011. doi: 10.1080/00423110903551626. [8] Namho Kim and David J. Cole. A model of driver steering control incorporating the driver’s sensing of steering torque. Vehicle System Dynamics, 49 (10):1575–1596, 2011. doi: 10.1080/00423114.2010.533777. [9] Zhonghai Li and Paul Milgram. An empirical investigation of the influence of perception of time-to-collision on gap control in automobile driving. In Proceedings of the Human Factors and Ergonomics Society Annual Meeting, volume 48, pages 2271–2275. SAGE Publications, 2004. [10] N.J. Loy. An engineer’s guide to FIR digital filters. Prentice-Hall, 1988. ISBN 9780132780117. URL http://books.google.se/books?id=WxxTAAAAMAAJ. [11] Charles C. MacAdam. Optimal preview control for linear systems. Journal of Dynamic Systems, Measurements and Control, 102:188–190, 1980. [12] Charles C. MacAdam. Application of an optimal preview control for simulation of closed-loop automobile driving. Transactions on Systems, Man, and Cybernetics, 11:393–399, 1981. BIBLIOGRAPHY 71 [13] Charles C. MacAdam. Understanding and modelling the human driver. Vehicle System Dynamics, 40(1-3):101–134, 2003. doi: 10.1076/vesd.40.1.101. 15875. [14] HB Pacejka and Igo Besselink. Magic formula tyre model with transient properties. Vehicle System Dynamics, 27(S1):234–249, 1997. [15] Manfred Plöchl and Johannes Edelmann. Driver models in automobile dynamics application. Vehicle System Dynamics, 45(7-8):699–741, 2007. doi: 10.1080/00423110701432482. [16] Benjamin Potsaid and John T Wen. High performance motion tracking control. In Control Applications, 2004. Proceedings of the 2004 IEEE International Conference on, volume 1, pages 718–723. IEEE, 2004. [17] Günther Prokop. Modelling human vehicle driving by model predictive online optimization. Vehicle System Dynamics, 35(1):19–53, 2001. doi: 10.1076/ vesd.35.1.19.5614. [18] Carl Edward Rasmussen. Gaussian Processes for Machine Learning. MIT Press, 2006. ISBN 0-262-18253-X. [19] Andrzej Renski. Identification of driver model parameters. International Journal of occupational safety and ergonomics, 7(1):79–92, 2001. [20] R.S. Sharp, D. Casanova, and P. Symonds. A mathematical model for driver steering control, with design, tuning and performance results. Vehicle System Dynamics, 33(5):289–326, 2000. doi: 10.1076/0042-3114(200005)33:5;1-Q; FT289. [21] A.Y Ungoren and H Peng. An adaptive lateral preview driver model. Vehicle System Dynamics, 43(4):245–259, 2005. doi: 10.1080/00423110412331290419. [22] VTI. VTI’s simulator facilities. URL http://www.vti.se/en/ research-areas/vehicle-technology/vtis-driving-simulators/. [23] John P Wann and Richard M Wilkie. How do we control high speed steering? Optic flow and beyond, 324:401, 2004. [24] J.Y. Wong. Theory of Ground Vehicles. John Wiley & Sons, 2008. ISBN 9780470170380. Appendix A Hardware Table A.1 and A.2 show the specification of the hardware that were used during the thesis. Table A.1: HP xw4600 Hardware Specification Processor Ram OS Matlab Intel Core 2 Duo E8400, 3 GHz 2 GB Windows 7 Enterprise R2011b (7.13.0.564) Table A.2: HP EliteBook 8730w Hardware Specification Processor Ram OS Matlab Intel Core 2 Extreme QX9300, 2.53GHz 4 GB Windows 7 Enterprise R2011b (7.13.0.564) 73 Appendix B The Vehicle Model The vehicle model consists of the steering and tyre dynamics mentioned in Chapter 2 and is obtained from Sharp et al. [20]. Equation (B.1) shows the state space equations for the steering dynamics. Table B.1 shows a list of all the variables used in the steering dynamics. ẋ1 = x2 ẋ2 = [(Ff y cos(δ) + Ff x sin(δ))lf − Fry lr ] 1 Iz ẋ3 = [(Ff x cos(δ) − Ff y sin(δ))lf + Frx − Fax lr ] ẋ4 = [(Ff y cos(δ) + Ff x sin(δ))lf + Fry ] ẋ5 = x3 cos(x1 ) − x4 sin(x1 ) ẋ6 = x3 sin(x1 ) + x4 cos(x1 ) ẋ7 = x8 ẋ8 = (Tr − Frx Rr ) 1 Jr + Jm G2r ẋ9 = x10 ẋ10 = (Tf − Ff x Rf ) 1 Jf 74 1 + x2 x4 M 1 − x2 x3 M (B.1) 75 The aerodynamic drag force in (B.1) and the downforce are calculated as: 1 ρSCx x23 2 1 = ρSCz x23 2 Fax = Faz (B.2) The static distribution of the vehicle weight and the aerodynamic downforce on the front and rear axles can be calculated with the following equation. Ff z_static = (M glr + Faz dr )/Wb Frz_static = (M glf + Faz df )/Wb (B.3) A longitudinal load transfer occurs when the driver accelerates and brakes the car. By considering the equilibrium of the car’s location to be its centre of mass and the aerodynamic drag acts at the height of the centre of gravity, following equation is used for the longitudinal force: ∆Ff z_long = (Ff x + Frx ) hg Wb (B.4) The lateral load transfer is estimated by assuming a fixed roll axis position and a constant roll stiffness distribution [7]. The lateral load transfer for the front and rear axles can be calculated by using following equation: x2 x3 M [(lr hrf )/Wb + Rsf (hg − hrc )] tf x2 x3 M = [(lf hrr )/Wb + Rsr (hg − hrc )] tr ∆Ff z_lat = ∆Ff z_lat (B.5) The vertical load on each wheel can now be calculated by using (B.3) - (B.5): 1 1 Fz1 = −[ Ff z_static − ∆Ff z_long + ∆Ff z_lat ] 2 2 1 1 Fz2 = −[ Ff z_static − ∆Ff z_long − ∆Ff z_lat ] 2 2 1 1 Fz3 = −[ Frz_static + ∆Ff z_long + ∆Frz_lat ] 2 2 1 1 Fz4 = −[ Frz_static − ∆Ff z_long − ∆Frz_lat ] 2 2 (B.6) The tyre forces can be calculated by using the Magic Formula Tyre Model, which is a way to determine the forces by using the combined slip. The lateral and longitudinal forces are calculated with: Fyi(combined) = Fyi(f ree rolling) (αi , γi , Fzi ) · Gy (αi , ki , γi , Fzi ) Fxi(combined) = Fxi(pure slip) (ki , Fzi ) · Gx (αi , ki ) (B.7) Where γ is the camber for the wheels, which is an angle telling us how much the wheels are tilted in the vertical and lateral plane. This angle is set equal to zero in this thesis. 76 The Vehicle Model Table B.1: Variable and Parameter list Vehicle Model state variables Yaw angle Yaw rate Longitudinal velocity (local reference system) Lateral velocity (local reference system) Longitudinal position (global reference system) Lateral position (global reference system) Rear wheels angular position Rear wheels angular velocity Front wheels angular position Front wheels angular velocity Vehicle Model Parameters Vehicle mass Vehicle yaw inertia Front axle polar moment of inertia Rear axle polar moment of inertia Engine moment of inertia Wheel base Centre of gravity height Distance of the CGa from the front and rear axles Distance of the CG of application of the aerodynamic down-force from the front and rear axles Front and rear roll centre heights Front and rear stiffness proportions Front and rear wheel radii Front and rear tracks Frontal area Aerodynamic drag coefficient Aerodynamic lift coefficient Gear ratio Vehicle Model Forces And Torque Front axle lateral force Front axle longitudinal force Rear axle lateral force Rear axle longitudinal force Aerodynamic drag Aerodynamic down force Vehicle weight Vehicle Model Control Variables Steer angle Front axle torque Rear axle torque Constants Gravitational constant Air density a Centre of gravity. x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 [rad] [rad/s] [m/s] [m/s] [m] [m] [rad] [rad/s] [rad] [rad/s] M Iz Jf Jr Jm Wb hg lf , lr df , dr [kg] [kgm2 ] [gm2 ] [kgm2 ] [kgm2 ] [m] [m] [m] [m] hrf , hrr Rsf , Rsr Rf , Rr tf , tr S Cx Cz Gr [m] [%] [m] [m] [m2 ] [-] [-] [-] Ff y Ff x Fry Frx Fax Faz Mg [N] [N] [N] [N] [N] [N] [N] δ Tf Tr [deg] [Nm] [Nm] g ρ [m/s2 ] [kg/m3 ] 77 The slip angles for the rear and front wheels can be calculated with the following equation. x4 + lf x2 180 x3 π x4 − lr x2 180 = x3 π α1,2 = −δ + α3,4 (B.8) The longitudinal slip in percent for the rear and front wheels is calculated with the following equation x10 κ1,2 = −(1 − Rf ) x3 (B.9) x8 κ3,4 = −(1 − Rf ) xr By using (B.6), (B.8) and (B.9) in (B.7), the axle forces can be calculated by adding together the tyre forces: Ff y = Fy1 + Fy2 Ff x = Fx1 + Fx2 (B.10) Fry = Fy3 + Fy4 Frx = Fx3 + Fx4 Parameter Values The values used for the vehicle dynamics can be seen in Table B.2. The values used have been taken from the Simulink model of the vehicle model at VTI. Table B.2: The Parameters’ Values For the Vehicle Dynamics M = 1383 Jr = 2 × 0.82 hg = 0.51 df = 0.8 hrr = 0.073 Rf = 3 tr = 1.454 Cz = 0.25 Vehicle Model Parameters Iz = 2374 Jm = 0.2 lf = 1.06 dr = 1.7 Rsf = 0.0683 Rr = 0.3 S=2 Gr = 3 g = 9.82 Constants ρ = 1.225 Jf = 2 × 0.82 Wb = 2.55 lr = 1.49 hrf = 0.065 Rst = 5 tf = 0.3 Cx = 0.32 Appendix C Tyre Dynamics The tyre dynamics are modelled according to Pacejka’s Magic Formula Pacejka and Besselink [14]. Pure longitudinal slip (α = 0) The longitudinal force can be calculated as Fx = Fx0 (κ, γ, Fz ) (C.1) where κ is the longitudinal slip and γ is the camber angle of the tyre. Fx0 = Dx sin{Cx arctan[Bx κx − Ex (Bx κx − arctan(Bx κx ))]} + SV x (C.2) Where Bx is a stiffness factor, Cx is a shape factor, Dx is the peak value, Ex is a curvature factor and SV x is vertical shift. κx = κ + SHx γx = γλγx Cx = pCx1 λCx Dx = µx Fz µx = (pDx1 + pDx2 dfz )(1 − pDx3 γx2 )λµx Ex = (pEx1 + pEx2 dfz + pEx3 dfz2 )(1 − pEx4 sgn(κx ))λEx Kx = Fz (pKx1 + pKx2 dfz ) exp(pKx3 dfz )λKx Bx = Kx /(Cx Dx ) SHx = (pEx1 + pEx2 dfz )λHx SV x = (pV x1 + pV x2 dfz )λHx λµx dfz = 0 (Fz − Fz0 ) 0 Fz0 0 Fz0 = Fz0 λFz0 78 Ex ≥ 0 (C.3) 79 Where SHx is a horizontal shift, µx is a friction coefficient, Kx is the cornering stiffness, dfz is the normalised change in vertical load, Fz0 is the nominal load and 0 Fz0 is the adapted nominal load. Pure lateral slip (κ = 0) The lateral force can be calculated as Fy = Fy0 (α, γ, Fz ) (C.4) where α is the lateral slip and γ is the camber angle of the tyre. Fy0 = Dy sin{Cy arctan[By αy − Ey (By αy − arctan(By αy ))]} + SV y (C.5) Where By is a stiffness factor, Cy is a shape factor, Dy is the peak value, Ey is a curvature factor and SV y is a vertical shift. αy = α + SHy γy = γλγy Cy = pCy1 λCy Dy = µy Fz µy = (pDy1 + pDy2 dfz )(1 − pDy3 γy2 )λµy Ey = (pEy1 + pEy2 dfz )(1 − (pEy3 + pEy4 γy ) sgn(αy ))λEy Ey ≥ 0 (C.6) Ky = pKy1 Fz0 sin{2 arctan[Fz /(pKy2 Fz0 λFz0 )]}(1 − pKy3 |γy |)λFz0 λKy By = Ky /(Cy Dy ) SHy = (pHy1 + pHy2 dfz )λHy + pHy3 γy SV y = Fz [(pV y1 + pV y2 dfz )λV y + (pV y3 + pV y4 dfz )γy ]λµy Where SHy is a horizontal shift, µy is a friction coefficient and Ky is the cornering stiffness. 80 Tyre Dynamics Combined Slip (κ 6= 0, α 6= 0) The longitudinal force can be calculated as Fx = Fx0 Gxα (α, κ, Fz ) (C.7) where α is the lateral slip and κ is the longitudinal slip. Gxα = cos{Cxα arctan[Bxα αs − Exα (Bxα αs − arctan(Bxα αs ))]} cos{Cxα arctan[Bxα Shxα − Exα (Bxα Shxα − arctan(Bxα Shxα ))]} (C.8) Where Bxα is a stiffness factor, Cxα is a shape factor, Dxα is the peak value, Exα is a curvature factor and SHxα is a horizontal shift. αs = α + SHxα Bxα = rBx1 cos[arctan(rBx1 κ)]λxα Cx = rCx1 Exα = rEx1 + rEx2 dfz (C.9) Exα ≤ 0 SHxα = rHx1 The lateral force can be calculated as Fy = Fy0 Gyκ (α, κ, γFz ) + SV yκ (C.10) where α is the lateral slip, κ is the longitudinal slip, γ is the camber angle of the tyre and SV yκ is a vertical shift. Gyκ = cos{Cyκ arctan[Byκ κs − Eyα (Byκ κs − arctan(Byκ κs ))]} cos{Cyκ arctan[Byκ Shyκ − Eyκ (Byκ Shyκ − arctan(Byκ SHyκ ))]} (C.11) Where Byκ is a stiffness factor, Cyκ is a shape factor, Dyκ is the peak value, Eyκ is a curvature factor and SHyκ is a horizontal shift. κs = κ + SHyκ Byκ = rBy1 cos[arctan(rBy2 (α − rBy3 )]λyκ Cyκ = rCy1 Eyκ = rEy1 + rEy2 dfz Eyκ ≤ 0 (C.12) SHyκ = rHy1 + rHy2 dfz SV yκ = DV yκ sin[rV y5 arctan(rV y6κ)]λV yκ DV yκ = µy Fz (rV y1 + rV y2 dfz + rV y3 γ) cos[arctan(rV y4α)] Parameter Values The values of all the parameters in the tyre dynamics used in (C.1) - (C.12) are described bellow. Most of the values are tuning parameters. The values in the table have been taken from the Simulink model of the vehicle model at VTI. 81 Table C.1: The parameters’ values for the Tyre dynamics λFz0 =1 λLex = 1 λV x = 1 λEy = 1 λV y = 1 λRes = 1 λY k = 1 λLskp = 1 Scaling Factors λCx = 1 λKx = 1 λCy = 1 λKy = 1 λGay = 1 λRes = 1 λV yk = 1 λLsgal = 1 pCx1 = 2.082190037 pEx1 = 0.805024444 pEx4 = 0 pKx3 = 0.611526151 pV x1 = 0 pT x2 = 0 pT x5 = 0 pT x8 = 0 Longitudinal Force Coefficients pDx1 = 0.982464 pEx2 = −0.072006268 pKx1 = 18.50329999 pHx1 = 0 pV x2 = 0 pT x3 = 0 pT x6 = 0 pT x6 = 0 pDx2 = 0 pEx3 = 0.027847309 pKx2 = −0.036367406 pHx2 = 0 pT x1 = 1 pT x4 = 0 pT x7 = 0 rBx2 = 0 rCx1 = 0 pCy1 = 1.3 pDy3 = −0.0360678 pEy3 = 0.039050 pKy2 = 1.0026 pHy2 = −0.00341892 pV y2 = 0.00136620 pT y1 = 1.77839 pT y4 = 0 pT y7 = 0 Lateral Force Coefficients pDy1 = −98.2464 pEy1 = −0.2.30109 pEy4 = −0.0169179 pKy3 = 0.0172904 pHy3 = 0.0153717 pV y3 = −1.03010 pT y2 = 1.10183 pT y5 = 1 pT y8 = 0 pDy2 = 0.0809256 pEy2 = −0.0363273 pKy1 = −12.1984 pHy1 = −7.21875 × 10−5 pV y1 = −0.00817285 pV y4 = −1.01536 pT y3 = 0 pT y6 = 0 pT y9 = 0 rBy1 = 2.6982 rCy1 = 1.2587 rV y2 = 0 rV y5 = 0 rBy2 = 3.1705 rHy1 = 0 rV y3 = 0 rV y6 = 0 rBx1 = 0 rBx1 = 0 λM ux = 1 λHx = 1 λM uy = 1 λHy = 1 λT r = 1 λXal = 1 λLs = 1 λGyr = 1 rBy3 = 0 rV y1 = 0 rV y4 = 0 82 Tyre Dynamics Table C.2: The Parameters’ Values For the Tyre Dynamics R0 = 0.31 Basic Tyre Parameters Fz0 =560 qBz1 = 9.766240 qBz4 = 1.241790 × 10−4 qCz1 = 1.119150 qDz3 = 0.006040630 qDz7 = −3.57636 × 10−5 qEz1 = −3.19518 qEz4 = 0.003.641890 qHz2 = −0.0134599 Aligning Torque Coefficients qBz2 = −3.47674 qBz5 = −0.422159 qDz1 = 0.1744410 qDz4 = 0.01516600 qDz8 = −0.178907 qEz2 = −0.08779900 qEz5 = 0.002273830 qHz3 = 0.01788520 SSz1 = 0 SSz4 = 0 SSz2 = 0 QT z1 = 4 qBz3 = 6.536020 qBz9 = 2.253510 qDz2 = 0.05468860 qDz6 = −4.92544 × 10−5 qDz9 = −0.0130321 qEz3 = 4.686530 qHz1 = −0.00357914 qHz4 = 0.09154150 SSz3 = 0 Appendix D The Driver’s Vehicle Model This linear model for the vehicle is obtained from MacAdam [12]. The linear dynamic equations for the driver model used in the driver model have the four states: Table D.1: List of states for the driver’s vehicle model The Driver’s Vehicle Model States Lateral Velocity Yaw Rate Lateral Placement Vehicle yaw inertia x1 x2 x3 x4 [m/s] [rad/s] [m] [rad] and can be written: ẋ = F x + gu (D.1) y = mT x where 2Cαf +2Cαf ) U 2lf CαrM−2l r Cαr −( ) Iz U F = −( 2lf Cαr −2lr Cαr ) MU 2lf2 Cαr +2lr2 Cαr −( ) Iz U −(U + 1 0 g= 2Cαf M Gr 2lf Cαf Iz G r 0 0 0 1 0 0 0 0 0 U 0 0 (D.2) m= 0 0 1 0 (D.3) The parameters in matrix F and g can be seen in Table D.2. The values of the 83 84 The Driver’s Vehicle Model Table D.2: Parameter list The Driver’s Vehicle Model Parameters Front and rear cornering coefficients Forward vehicle velocity Vehicle mass Vehicle yaw inertia Distance of the CG from the front and rear axles Steering ratio CαF ,CαR U M Iz lf , lr Gr [N/rad] [m/s] [kg] [kgm2 ] [m] [-] parameters in Table D.2 are described in Table D.3. The vehicle velocity U used in the driver’s vehicle model depends on which velocity the driver has when he/she is doing the DLC manoeuvre. Table D.3: Parameter list CαF = 4000 M = 1200 lr = 1.5 Driver’s Vehicle Model’s Parameters CαR = 2000 Iz = 2000 Gr = 16.4 U = x3 lf = 1 Appendix E MPC The theory behind the MPC is taken from [5, 3] MPC can be formulated as an optimization problem with a cost function J = min ∞ X ||x(k + i)||2Q1 + ||u(k + i)||2Q2 (E.1) i=0 where x is the states, u is the control signals and Q1 and Q2 are positive definite weight matrices which have to be selected by the user. This minimization problem is solved off-line with the Riccati equation which gives the solution of this problem as a linear feedback u(k) = −Lx(k). The MPC-problem can be formulated by using (E.1) together with extra constraints: J = min N −1 X ||x(k + i)||2Q1 + ||u(k + i)||2Q2 i=0 subject to (E.2) x(k + i + 1) = F x(k + i) + gu(k + i), i = 0, ..., N − 1 N ∈ Z x(k + i) ∈ X , i = 0, ..., N − 1 u(k + i) ∈ U, i = 0, ..., N − 1 The sum in the MPC problem is truncated to a finite sum compared to the LQ problem in E.1 which has a infinite horizon. A prediction horizon, here labelled N, is set and can be seen as how far the MPC can see in the future to be able to chose an optimal signal. X and U represent the constraints on the states and control signals. The algorithm for finding the optimal control signal is described in Algorithm 3: In (E.2), the optimization problem is solved by taking the internal dynamic model of the process in consideration: x(k + 1) = F x(k) + gu(k) By using this model recursively, the two-step prediction will be: 85 (E.3) 86 MPC Algorithm 3 The Algorithm for MPC Measure or predict the state-signals x(k) Calculate the sequence of control signals by solving the problem in (E.2) for i = 1,...,N-1 3: Use the first element in the sequence of control signals calculated in step 2. 4: Do a time update, k:=k+1 5: Repeat from step 1. 1: 2: x(k + 2) = F x(k + 1) + gu(k + 1) (E.4) = F 2 x(k) + F gu(k) + gu(k + 1) To get a more easy notation for the predictions, all the calculations are vectorized by doing the same recursive calculations as in (E.4). This gives the following expression in a compact form X = F T x(k) + GU (E.5) where x(k) x(k + 1) .. . X= U = F = I F .. . F N −1 (E.6) u(k + N − 1) x(k + N − 1) and u(k) u(k + 1) .. . 0 G FG .. . 0 0 G .. . G= F N −2 G · · · 0 0 0 .. . ··· ··· ··· .. . FG G 0 0 0 .. . 0 (E.7) With these matrices, the sum in the problem formulation in (E.2) can be written: J = min N −1 X ||x(k + i)||2Q1 + ||u(k + i)||2Q2 = X T Q1 X + U T Q2 U (E.8) i=0 By using the formulation in (E.5), the optimization equation in (E.8) can be written as J = min (Fx(k) + GU )T Q1 (Fx(k) + GU ) + U T Q2 U where the weight matrices Q1 and Q2 are written as Q11 Q21 Q Q22 12 Q1 = Q2 = . . . Q1N (E.9) .. . Q2N (E.10) 87 where Q1 and Q2 are the weight matrices from (E.2). In order for the MPC to be able to follow a predefined trajectory, this MPC will be extended with a reference tracking part. The cost function from (E.2) can therefore be formulated as J = min N −1 X ||x(k + i) − r(k + i)||2Q1 + ||u(k + i)||2Q2 (E.11) i=0 This can be described on the compact form as in (E.9): J = min (Fx(k) + GU − R)T Q1 (Fx(k) + GU − R) + U T Q2 U where R is a vector containing data of the reference trajectory: r(k) r(k + 1) R= .. . r(k + N − 1) (E.12) (E.13) In order to prevent sharp changes on the control signal, a penalty on the difference of two consecutive control signals is made. This will make the controller penalize rapid changes of the control signal, while having a constant control signal does not cost anything. This will make the control signal smoother which will make it look like something a human driver could accomplish. This can be done by modifying (E.11) a bit further, where a subtraction between two consecutive control signals is made: J = min N −1 X ||x(k + i) − r(k + i)||2Q1 + ||u(k + i) − u(k + i − 1)||2Q2 (E.14) i=0 In order to write (E.14) on the compact form as in (E.12), following matrices are used u(k) − u(k − 1) u(k − 1) − u(k − 2) .. . u(k + N − 1) − u(k + N − 1) I −I = I .. . U = ΩU − δ (E.15) .. . −I I The cost function can now be written as J = min (Fx(k) + GU − R)T Q1 (Fx(k) + GU − R)+ + (ΩU − δ)T Q3 (ΩU − δ) (E.16) where Q3 is defined in accordance to (E.10). Equation (E.16) shows the vectorized form of the cost function with reference tracking and integral action. The cost 88 MPC function can be rewritten so it is formulated as a quadratic programming problem. The cost function in (E.16) can be rewritten into the quadratic programming formulation: 1 T (E.17) w Hw + f T w 2 By excluding the terms in (E.16) not depending on U , the quadratic programming formulation for the cost function will be min w 1 T T U (G Q1 G + ΩT Q1 Ω)U + (G T Q1 Fx − G T Q1 R − δ T Q3 Ω)U u(k) 2 (E.18) Every time this problem is solved, the first element in the U ∗ will be used for the current sample. U ∗ = min Weight Matrices The values used in Q1 and Q2 during the mented by testing different values: 10 0 0 0 10 0 Q1 = 0 0 106 0 0 0 simulations in Section 5.3 were imple 0 0 0 10 Q2 = 104 (E.19) Appendix F The Simulator The simulator used for this thesis is the Simulator III at VTI. The simulator has both linear and tilt motion. The simulator is attached to a platform which can be swivelled 90 degrees, which makes it possible to perform both testes with lateral forces and testes with braking and acceleration. Six SXRD-projectors are used to create the visualisation together with 3 LCD-displays used for rear view mirrors. The cabin in the simulator can be switched for a different cabin. This makes it possible for doing tests on both cars and trucks. The tests done in this thesis used a cabin for Saab 9-3. The technical specification for Simulator III can be seen in Table F.1. [22] Table F.1: Technical Specification for Simulator III Motion System Pitch (degrees) Roll (degrees) Linear System Amplitude (m) Velocity (m/s) Acceleration m/s2 Vibration Table Vertical motion (cm) Longitudinal movement (cm) Roll (degrees) Pitch (degrees) Visual System Forward view (degrees) Rear view mirrors (LCD screens) Average resolution on screen (arc minute per line pair) 89 −9 to + 14 ±24 ±3.75 ±3.75 ±8 ±6 ±6 ±6 ±3 115 3 2.8 (horizontal) 2.7 (vertical) 90 The Simulator Upphovsrätt Detta dokument hȧlls tillgängligt pȧ Internet — eller dess framtida ersättare — under 25 ȧr frȧn publiceringsdatum under förutsättning att inga extraordinära omständigheter uppstȧr. Tillgȧng till dokumentet innebär tillstȧnd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstȧnd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet pȧ ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sȧdan form eller i sȧdant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ Copyright The publishers will keep this document online on the Internet — or its possible replacement — for a period of 25 years from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for his/her own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its www home page: http://www.ep.liu.se/ c Andreas Jansson & Erik Olsson

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement