CSE 535 Project 2: Context-Aware Adaptation**Note: The provided content, along with any associated project materials, is exclusively intended forclassroom use. Any form of sharing, posting, orredistribution, even after the completion of this course, isstrictly prohibited in accordance with ASU regulations. Suchactionsare considered violations of the FSEcode of conduct and may result in severe academic consequences.In Project 1 you learnt about developing a monitoring application using on-board sensors in a smartphone. In this project, we will design a context awareadaptation strategy for the development ofautonomous braking system for Level 3 autonomous cars which assumes an underlying distributedmonitoring and actuation cyber-physical system specifically human-in-the-loop andhuman-in-the plant.Before we delve into the details let usunderstand some basic definitions.Level 3 autonomy: The vehicle operates autonomously, however, requires the driver to beattentive at all times for potential switch to manual mode.Controller: It is a software that takes sensor data from the vehicle such as speed, distancebetween cars and acceleration or deceleration and outputs the braking pressure to applydeceleration to stop the car.Controller gain: It is a property of the controller that determines how aggressively a controllerwill apply brakes and stop the car.Deceleration Limit: This is the maximum limit on the deceleration applied by the controller.High deceleration can lead to unwanted harm to the driver behind the wheel. The controller cannever apply deceleration that is higher than the maximum limit.Controller frequency: It is the number of times the controller needs to computea new brakinginput per second.Reaction time: It is the time taken for the human to decide on an action after a switch tomanual modeAction time: Time taken to execute the action decided by the humanand stop the car.Autonomous vehicle braking system exampleFigure 1: Autonomous Driving exampleConsider a user driving a Level 3 autonomous car (Fig. 1). We are specifically focusing on theautonomous braking system. As a part of the autonomous braking system, there is an advisory control that:
a) processes a driving scenario, by sensing environmental conditions
b) Predicts if the autonomous braking system will be able to stop the car
c) Determines if the control should be transferred to the human behind the wheel

Autonomous braking system has a feed-back loop controller that senses the distance between theautonomous car and the car in front , and computes a braking force as a function of the ’s initialspeed !, and distance between and . The braking force applied is also a function of the controllergain , which is a design parameter that you will have to tune.The braking force is constrained by the maximum deceleration limit "#$, which is dependent on theroad condition. For example, on dry road you can apply more deceleration than on wet road in rainyseason. The braking force is thus given by the following equation:

            = min ( ( !,  !%,  ),  "#$).

Once the braking force is applied, the vehicle kinematics show how the vehicle behaves in the realworld. Given the initial speed ! and initial distance between and , !%, the vehicle kinematics gives
the stopping distance &'(), and stopping time &'() for the vehicle. This you can obtain using thevehicle kinematics Simulink model ( *+,-./+) provided to you.If &'() ≥ !% then the autonomous vehicle fails, and the cars collide, else there is no collision. Ifcarscollide, then stopping time &'() is same as collision time ..In this example, we will fix the distance between cars and , !%.However, changing initial velocity !,controller gain , and deceleration limit "#$, can change the stopping distance andstopping timeresulting in potential collisions.Human driver modelThe human driver is assumed to be alert all the time to take overcontrol.However, we have to accountfor the reaction time 0 of thehuman driver after a switching signal is sent through the dashboardcontrols. In addition to the reaction time the human action also takes some time to execute.In this example, we assume that the human provides a deceleration that is 10% higher than thedeceleration limit "#$, i.e. ℎ# = 1.1 "#$. The action time # can be obtained by removing the brakingcontroller from the Simulink model and applying a static deceleration of ℎ# into the vehicle kinematicsmodel. After simulation the action time can be obtained as the stopping timereported in the Simulinkmodel.The total time taken by the human to completely stop the car is ℎ&'() = 0 + #.We are now in a position to define a basic logic for the advisory control. The advisory control uses thefollowing algorithm to decide if it wants to switch:SWITCH = ADVISORY CONTROL ( !, , "#$, 0)

Step 1: Predict if autonomous braking control collides or not using  !,  ,      "#$.
Step 2: If no collision then
Step 3: Do not switch to manual control
Step 4: Else
Step 5: Collision time  .= predicted stopping time from Step 1
Step 6: Predict action time  #, using  !, remove controller, and constant
deceleration 1.1 "#$.
Step 7: Predict reaction time  0
Step 8: Compute ℎ&'() =  0 +  #
Step 9: if       <   
Step 10: Switch to human
Step 11: Else
Step 12: Do not switch.
Driving Context Changes

Road conditions depend on several factors including:

a) User mobility patterns
b) Traffic conditions
c) Weather patterns

Each context can be modeled using stochastic modeling techniques such as Markov chains. In thisassignment you are given a composite model of driving context that has two states: a) normal withdeceleration limit -200 "&+.! and b) poor road conditions with deceleration limit -150 "678! .The prior probabilities of each stat

1. Human Reaction time model

The cognitive workload of a human changes based on driving context. We will assume that normaldriving conditions have low workload, and poor driving conditions require high workload.Consider Table 1 in https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6338053/pdf/fnhu... heart rate and respiratory rate is provided for single task under low cognitive workload (LCW) andhigh cognitive workload (HCW) tasks. Use the mean and standard deviation to create a gaussian modelof heart rate and respiratory rate. For each driving condition, the heart rate and respiratory rate is sampled from the gaussian model. The respiratory quotient can be computed as = 90:0. The humanreaction time 0 can be computed using the following equation: 0 = 0.01 ∗

2. Project Tasks

The project has three specific tasks as shown in Fig 2.Fig 2: Project tasksIn this project, we will first attempt to design the advisory control for an average user. Then choose aspecific user and modify the advisory control design at deployment. Finally, after deployment revertback to the design phase to change the advisory control and personalize it for the specific user.This mimics the standard context aware application development workflow. Here themanufacturerinitially designs a system to be used for a large set of users.Afterdeployment, a specific user can makesome limited configurationchanges to the system. The data is collected during deployment. This data isthen used to redesign the system to personalize for specific userprofiles.
Task 1: Controller designGiven:

1. A set of initial speeds, 20 kmph to 40 kmph
2. Deceleration limits of normal (-200  /  ) and poor (-150  /  )
3. User profiles

User LCW HCWHR RR HR RR1 80 (± ) 16 (±6) 95 (± ) 21 (± )
2 65 (± ) 13 (± ) 71 (± ) 14 (±5)3 61 (± ) 17 (± ) 92 (± ) 26 (± )To do:

1: Create an average user profile
2. Determine reaction time model
3. Determine controller gain for each road condition such that collision is minimized for the giveninitial speed range
4. Determine the number of switches necessary to avoid collision for your design

Task 2: Reaction time update in advisory controlGiven:

1. User 3 as the actual user of the system
2. Initial speed range 20 kmph to 60 kmph
3. Fix the gains for Normal and Poor road condition from Task 1.
4. Markov chain model for road condition generationTo do:
1. Using the monte Carlo Markov chain simulation method generate a sequence of length100 of normal and poor road conditions
2. For each road condition in the sequence, sample the initial speed range uniformly to getone initial speed
3. For each road condition in the sequence, sample the HR and RR models of User 3 to obtainone HR, one RR and consequently one reaction time for the user.
4. Evaluate collision status for each road condition in the sequence.
5. Evaluate the number of switches in each road condition in the sequence.
6. Determine the reaction time setting in the advisory control that gives the least number ofcollisions with the least number of switches.Note here that the reaction time of the human user is independent of the reaction time setting ofthe controller.

So there will be scenarios where even if you decide toswitchaccording to the current reactiontime of the human driver it is not feasible for the user to stop the car and as a result there is acollision.
Task 3: Gain personalizationGiven:

1. User 3 as the actual user of the system
2. Fixed reaction time setting of advisory control
3. Initial speed range of 20 to 60 kmphTo do:
1. Update the gains for each road condition such that the number of collisions and numberof switches are both reduced.

DETAILS FOR PROJECT SUBMISSION:Software required: MATLAB
To get Started with MATLAB:Refer to the documentation uploaded on Canvas – ‘Software Requirements and Guidelines for Project 2’
Provided Files:You have been provided with some files in the Github repository:https://github.com/ImpactLabASU/MC535Project2
These files contain components related to the project or task you areworking on.Deliverables:
1.Kindly submit three separate MATLAB files for Task 1, 2, and 3, along with an output CSV file.2.The MATLAB submission files should follow the naming convention:<FirstName_LastName_TaskNo>.m
3.All output data should be saved in a CSV file containingtwocolumns: 'Tasks' and 'Output.' The taskname should adhere to this format: Task<TaskNo>.<ToDoNo>:<yourOutput>. For instance, if Task 1involves 2 switches, it should be displayed as follows in the CSV:Tasks OutputTask1.4 2Append all outputs of Task 1, 2 and 3 to the same csv file. The naming convention for the CSV file shouldbe <FirstName_LastName>.csv
WX:codehelp


闷骚的单杠
1 声望0 粉丝