{'fraction_non_alphanumeric': 0.04523616186222763, 'fraction_numerical': 0.0126201109757748, 'mean_word_length': 4.579950915612611, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Maintaining driver attentiveness in shared-control autonomous driving

We present a work-in-progress approach to improving driver attentiveness in cars provided with automated driving systems. The approach is based on a control loop that monitors the driver's biometrics (eye movement, heart rate, etc.) and the state of the car; analyses the driver's attentiveness level using a deep neural network; plans driver alerts and changes in the speed of the car using a formally verified controller; and executes this plan using actuators ranging from acoustic and visual to haptic devices. The paper presents (i) the self-adaptive system formed by this monitor-analyse-plan-execute (MAPE) control loop, the car and the monitored driver, and (ii) the use of probabilistic model checking to synthesise the controller for the planning step of the MAPE loop.


I. INTRODUCTION
The J3016 standard [1] classifies automated driving systems (ADSs) on a six-level scale, from no automation at Level 0 to full automation at Level 5. Despite huge R&D budgets and much hype over the past decade, fully autonomous (Level 5) cars are unlikely to become available to the general public any time soon. In contrast, cars providing Level 2 (i.e., partial) automation can be purchased from manufacturers including Tesla, Nissan and BMW; and the approval of Level 3 (i.e., conditional automation) and 4 (i.e., high automation) cars is considered by regulators worldwide [2], [3], [4], [5], [6].
A critical requirement for vehicles operating at autonomy Levels 2 and 3 is that a user resides in the driver's seat and is sufficiently attentive to be able to share the control of the car with the ADS. At Level 2, this human in the loop is expected to 'complete the object and event detection and response subtask and [to] supervise the driving automation system', while at Level 3 the user is expected to be 'receptive to ADS-issued requests to intervene [. . . ] and [to] respond appropriately' [1]. Although Level 4 ADSs do not rely on human support, they may still issue timely requests for human intervention (e.g., when they approach roads or traffic situations they were not designed to handle), performing a minimum-risk manoeuvre (e.g., stopping the car safely) if their user does not respond.
In all these scenarios, accidents with potentially fatal consequences (for Levels 2 and 3) and frequent emergency stops (for Level 4) can only be avoided if the drivers are sufficiently attentive to be able to take over the control of their vehicles [7]. However, humans find it extremely difficult to remain attentive when overseeing the operation of automated and autonomous systems [8], [9], [10]. In the automotive domain, this is amply demonstrated by accidents involving both cars with Level 2 ADS used by regular drivers [11], [12] and cars with higher autonomy levels tested by professional safety drivers [13].
Our paper proposes an approach that mitigates this problem by using a monitor-analyse-plan-execute (MAPE) control loop to improve driver attentiveness in shared-control autonomous driving. The monitoring component of this MAPE loop uses an array of sensors to collect driver biometrics and vehicle data. The analysis component uses these data and a deep neural network [14] developed by a complementary research strand of our Safe-SCAD project 1 to predict the driver response time and response quality to a potential ADS intervention request. These predictions are processed based on a simple driver attentiveness model that factors in the speed of the car, and the resulting classification of the driver as attentive, semi-attentive or inattentive guides the planning of driver alerts and car speed changes by a formally verified discrete-event controller. This controller achieves Pareto-optimal trade-offs between risk level, driver nuisance, and progress with the journey.
The first version of our Safe-SCAD approach is aimed at Level 3/4 ADSs, with a particular focus on the Automated Lane Keeping System (ALKS) for which the United Nations World Forum for Harmonization of Vehicle Regulations adopted a new UN regulation [6] in June 2020, and that the UK Department for Transport plans to implement on UK motorways [2]. For these advanced ADSs, the Safe-SCAD improvement in driver attentiveness can lead to fewer minimum-risk manoeuvres and better progress with the car journey, and with minimal risk of accidents. Future enhancements (summarised later in the paper) will mitigate additional uncertainties associated with the challenging problem tackled by our approach, extending its applicability to Level 2 ADSs, and to autonomous car testing by professional test drivers.
The key contributions of the paper are the presentation of the driver attentiveness management problem in ALKS (as a motivating example, in Sect. II), the Safe-SCAD approach to improving driver attentiveness in shared-control autonomous driving (Sect. III), and the probabilistic model checking method for synthesising the Safe-SCAD planning component (Sect. IV). The paper also discusses related work (Sect. V) and summarises our plans for future work (Sect. VI).

II. DRIVER ATTENTIVENESS MANAGEMENT PROBLEM A. Background
We consider an ADS with the characteristics stipulated in the United Nations' ALKS regulation [6]. The ALKS can be activated by a driver (who must be available in the driving seat, with the seatbelt fastened) when all its components are fully operational, and the vehicle is on roads and in environment (e.g., weather) conditions within its operational design domain (ODD). When activated, the system keeps the vehicle inside its lane, controlling the vehicle speed (within the range 0 to 60 km/h) to adapt to the surrounding road traffic. Additionally, the ALKS can detect the risk of collision (e.g., due to a stationary vehicle) and can stop to avoid the collision, e.g., by performing an emergency manoeuvre.
In certain situations, all of which it must recognise, the ALKS issues a transition demand, i.e., a request for the driver to take over the control of the vehicle. The regulation allows these situations to differ across manufacturers. However, they must include the situations in which the ALKS activation conditions are not met (e.g., the vehicle approaches a road outside its ODD), and those in which the driver is unavailable (i.e., not in the driving seat or inattentive) and not responding to ALKS alerts aimed at restoring the driver's availability. Transition demands are issued timely, allowing (i) an attentive driver to resume the manual driving safely, or (ii) the ALKS to perform a minimum-risk manoeuvre (MRM), e.g., to bring the vehicle to a standstill, if the driver is inattentive. The ALKS may reduce the vehicle speed to ensure safety, e.g., by allowing the driver additional time for the control takeover.
It follows from the summary so far that the ALKS must be capable of assessing the driver's availability, including their position in the car (in the driving seat, wearing the seatbelt) and their attentiveness. For the latter, the regulation proposes the use of driver biometrics such as 'eye blinking, eye closure, conscious head or body movement' [6], but allows manufacturers to select their own methods for assessing driver attentiveness. Likewise, the regulation and UK's ALKS plan [2] recommend the use of optical, acoustic and haptic warning signals (i) to announce transition demands to the driver, and (ii) to improve driver attentiveness, but are not prescriptive about how these alerts should be used. In the next section, we use these recommendations to define the driver attentiveness management problem for ALKS-like ADsS.

B. Problem definition
Given an ALKS, we assume that its driver can have one of n ≥ 2 attentiveness levels. The highest level ('attentive') corresponds to the situation in which the driver can respond timely to a transition demand, even at the maximum speed permitted for the vehicle. The lowest level ('inattentive') corresponds to the situation where the ALKS needs to execute an MRM unless the driver improves their level of attentiveness within a mandated time period τ > 0. 2 If present, any intermediate levels (e.g., 'semi-attentive' for n = 3) correspond to diminished driver attentiveness that does not require an MRM. However, they provide an opportunity for issuing alerts to improve the driver's attentiveness level before it drops further, and drastic action is required: MRMs involve stopping the vehicle in a motorway lane [2], [6], and should only be used as a last resort.
We assume that the ADS has two mechanisms it can use when the driver is not 'attentive'. First, it can activate one or several of m ≥ 1 alerts (e.g., optical, acoustic and haptic) as needed to improve the driver's attentiveness. Second, it can reduce the car speed to one of q ≥ 1 speed levels, where we allow q = 1 for the case when this feature is not available. As such, the ALKS state at any point in time is characterised by: 1) the driver attentiveness level l ∈ {0, 1, . . . , n−1}, where l = 0 and l = n − 1 correspond to the driver being 'attentive' and 'inattentive', respectively; 2) the set of active alerts a ∈ {0, 1} m , where a = (a 1 , a 2 , . . . , a m ) indicates that the i-th alert is inactive when a i = 0, and active when a i = 1; 3) the vehicle speed level v ∈ {0, 1, . . . , q − 1}. Using the notation L = {0, 1, . . . , n − 1}, A = {0, 1} m and V = {0, 1, . . . , q − 1} to denote the range for the three components of the ALKS state, we further assume that the following measures are defined over the state space L×A×V : 1) nuisance : A → R ≥0 , where nuisance(a) represents the nuisance experienced by the driver when the alerts a ∈ A are in use, with nuisance(0, 0, . . . , 0) = 0; 2) progress : V → R ≥0 , where progress(v) reflects the progress with the journey made when the vehicle travels at speed v ∈ V (e.g., the distance travelled in one hour); 3) risk : L × V → R ≥0 , where risk (l, v) provides a measure of the risk associated with travelling at speed v ∈ V when the driver attentiveness level is l ∈ L, and that risk MRM > 0 denotes the risk associated with performing an MRM.
Finally, we assume that timing data are available about the drivers' transition between the attentiveness levels L, when different alert combinations are active, and at different vehicle speeds. These data may be available from studies of driver behaviour [15], [16], experiments carried out by ALKS manufacturers, observations of drivers who are using the deployed ADS, or a combination thereof. Given such data, the driver attentiveness management problem is to find a combination of alerts a(s) ∈ A to use in each ALKS state s ∈ L×A×V , such that the ALKS achieves Pareto optimality between minimising the driver nuisance, maximising the progress with the journey, and minimising the risk over a period of T hours of driving.

III. THE SAFE-SCAD APPROACH
Our Safe-SCAD approach addresses the driver attentiveness management problem from Section II-B by using a MAPE control loop with the components shown in Figure 1. These components and the four stages of the MAPE loop are described in the following sections. We provide only a brief summary for the components used in the first two MAPE stages (monitoring and analysis), as their technical details are available in [14], [17], and we focus instead on their integration into a MAPE loop and on the planning MAPE stage, which represent the two key theoretical contributions of this paper.

A. Monitoring
In this MAPE stage, data are collected from a combination of driver-biometrics sensors and vehicle sensors. In our project, driver biometrics are obtained [14] using: (i) eyetracking glasses to monitor eye movement data (e.g., gaze position and fixation time); (ii) smartwatch photoplethysmographic sensors to monitor heart rate; and (iii) smartwatch galvanic skin response sensors to monitor hand sweating. A broad range of vehicle data streams are already collected and used by ADSs, and can easily be exploited within our MAPE loop. These range from vehicle velocity and steering wheel angle to lane position and throttle/brake pedal angles.

B. Analysis
This MAPE stage ( Figure 2) uses the DeepTake predictor of driver takeover behaviour [14] developed by another Safe-SCAD research strand. DeepTake is a deep neural network (DNN) that uses the driver-biometrics and vehicle data from the monitoring stage to predict the driver's control takeover: 1) intention, i.e., whether the driver would react to an ADS control-transition demand or not; 2) time elapsed from the transition demand until the driver assumes manual control of the vehicle, as defined by the ISO 21959 standard [18]; 3) quality of the driver's manoeuvring of the vehicle after manual control is resumed. DeepTake was shown [14] to predict these driver takeover metrics with an accuracy of 96%, 93% and 83%, respectively. We emphasise that these accuracy levels are sufficient for the Safe-SCAD driver attentiveness management because our solution is intended for use with ALKS that can ensure safety at all times, e.g., by performing an MRM if necessary.  Additionally, our DNN-based analysis module operates conservatively by also exploiting the results from the designtime robustness verification of DeepTake [17]. Figure 3 shows how we intend to use these verification results in the postprocessing of the DeepTake predictions, such that the computed driver attention level is lowered when the sensor data belongs to regions of the DeepTake input space that were not identified as robust by the DNN verification. This part of our Safe-SCAD approach is under development.

C. Planning
In this MAPE stage, a discrete-event controller plans the set of active alerts a ∈ A and the speed level v ∈ V that the vehicle should employ. This controller is activated by the occurrence of two types of events: • changes in the attentiveness level of the driver; • the expiry of a timer that is used to activate the controller periodically at all times when the driver attentiveness level is not 'attentive'. The timer enables the controller to periodically "try" new or additional alerts and/or speed adjustments when the driver attentiveness level was not improved by the execution of the plan devised by the previous controller activation. The synthesis of the Safe-SCAD controller is detailed in Section IV.  Fig. 3. The driver attention level (A=attentive, S=semi-attentive, I=inattentive) depends on the predicted driver takeover time and quality, on the speed of the vehicle, and on the verified robustness of the DeepTake input region that the sensor data belongs to. The diagram applies to a positive takeover intention (i.e., driver responsive to a control-transition demand); when DeepTake predicts a negative intention, the driver state is deemed inattentive.

D. Execution
In this MAPE stage, the alert and speed effectors of the vehicle are used to implement the alerts and speed plan provided by the Safe-SCAD controller.

IV. SAFE-SCAD CONTROLLER SYNTHESIS
To synthesise the Safe-SCAD controller used in the planning MAPE stage, we model the relevant behaviour of the self-adaptive system from Figure 1 as a parametric continuoustime Markov chain (CTMC). The parameters of this CTMC are chosen such that the (non-parametric) CTMC induced by each combination of parameter values corresponds to a different feasible controller, and the CTMCs obtained by considering all valid combinations of parameter values define the set of feasible Safe-SCAD controllers, i.e., the controller design space. Given this design space, we synthesise formally verified controllers by using (i) probabilistic model checking to determine the nuisance, progress and risk associated with any specific controller; and (ii) multi-objective genetic algorithms to find controllers that achieve Pareto-optimal tradeoffs between these three measures. We detail the steps of our controller synthesis process in Sections IV-B and IV-C, after a brief introduction to continuous-time Markov chains and their probabilistic model checking in Section IV-A.

A. Continuous-time Markov chains
A CTMC is a finite state-transition model M = (S, s 0 , R), where S is a finite set of states, s 0 ∈ S is the initial state, and R : S × S → [0, ∞) is a transition rate matrix such that for any state s i ∈ S, the probability that the CTMC will transition from state s i to another state within t > 0 time units is 1−e −t· s k ∈S R(si,s k ) , and the probability that the new state is s j ∈ S is given by R(s i , s j )/ s k ∈S R(s i , s k ).
To enable the analysis of a broader range of CTMC properties, the states and transitions of a CTMC are often annotated with rewards. A reward structure over a CTMC with state set S is a pair of functions r X = (r 1 , r 2 ), where r 1 : S → R ≥0 is a state reward function that defines the rate r 1 (s) at which the reward is obtained while the Markov chain is in state s; and r 2 :S ×S → R ≥0 is a transition reward function that defines the reward obtained each time a transition occurs.
Probabilistic model checkers such as PRISM [19] and Storm [20] use efficient symbolic model checking techniques to analyse a wide range of CTMC properties expressed in continuous stochastic logic (CSL) augmented with rewards [21]. These properties include bounded and unbounded probabilistic reachability, and several types of reward properties. For our Safe-SCAD controller synthesis, we are interested in cumulative reward properties. These properties are expressed using the CSL formula R X =? [C ≤T ], which denotes the expected value of the reward X accrued within the time interval [0, T ].

B. Safe-SCAD controller design space
We model the driver attentiveness management problem using a family of CTMCs to define the design space (i.e., the possible variants) of the Safe-SCAD controller. Each CTMC in the family has the state set S = L×A×V ×{c, c}, where L, A and V are defined in Section II-B, and c is a Boolean state variable that indicates whether the discrete-event controller is active or not. As shown in Figure 4, which depicts the controller design space for a specific instance of the problem, the model has three types of state transitions: 1) Transitions corresponding to changes in driver attentiveness.
These transitions occur from states (l, a, v, c), in which the controller is inactive, to states (l , a, v, c) with a different driver attentiveness level (i.e., l = l), no changes in the alerts a and speed v, and the controller activated. 2) Transitions corresponding to fixed controller actions. There are two classes of such actions. In the first, the CTMC transitions from states ( A , a, v, c), in which the driver is attentive and the controller activated, to the initial state ( A , (0, 0), 0, c); this happens whenever the controller is activated by a change in driver attentiveness level, finds the driver fully attentive, and therefore switches off any activated alerts, and selects the nominal driving speed. In the second, the controller is activated by a timer whenever the driver has not become fully attentive after a period of time since a previous controller action. In this situation, the

4
CTMC transitions from each state (l, a, v, c) with l = A to the counterpart state (l, a, v, c) in which the activated controller has the opportunity to switch on new alerts and/or to select a new speed level. 3) Transitions corresponding to controller options. When the controller is activated (by a change in driver attentiveness level or by the timer) and finds the driver to not be fully attentive, it has a choice of using any available combination of alerts and any speed level in order to make the driver attentive and to reduce risk. Thus, from each state (l, a, v, c) ∈ S with l = A , the CTMC can transition to any state (l, a , v , c) ∈ S. These controller options are indicated by dashed transitions in Figure 4. In the general case from Section II-B, there are n driver attentiveness levels, m alerts and q speed levels, giving the controller 2 m q combinations of alerts and speed level options to choose from in each of the (n − 1)2 m q CTMC states in which l = A . We encode the controller option for each of the n − 1 driver attentiveness levels l ∈ L \ { A } and each of the 2 m q combinations of alerts and speed level a v ∈ A × V using a design-space parameter We have (n − 1)2 m q such parameters, and each assignment of values to these parameters defines a candidate deterministic controller 3 solution for the driver attentiveness management problem. There are (2 m q) (n−1)2 m q candidate solutions in total, and thus (2 2 2) (3−1)2 2 2 = 8 16 ≈ 10 14 candidate solutions for the problem instance encoded by the parametric CTMC from Figure 4.
To complete the definition of the controller design space, we also need to specify its CTMC transition rates. The last two types of transitions described above correspond to controller actions. Therefore, their rates must reflect the mean operation time that the controller requires: (i) to plan the new alerts and speed level when it is activated, and (ii) to be activated by its timer. For instance, a controller operation time of 500ms gives a rate of 2s −1 . These rates are easy to determine, e.g., by worst-case execution time analysis of the controller code. In contrast, the rates for the first type of transition are much more difficult to determine because they encode the mean time taken by the driver to transition between attentiveness levels, for each combination of active alerts and speed levels. These rates must be estimated, e.g., by using data sources such as: 1) the numerous available studies and surveys of driver attentiveness, e.g. [22], [15], [16], [23]; 2) additional data from controlled experiments with drivers of ALKS vehicles; 3) driver data collected during the actual driving of ALKS vehicles, e.g., by using a black-box solution similar to that already employed by many insurers of new drivers [24], [25], either across a fleet of vehicles or for a specific driver.
We note that using the last data source enables both (i) the definition of personalised controller design spaces for each driver, and (ii) the continual updating of these design spaces to support the runtime synthesis of new Safe-SCAD controllers when the transition rates for a driver change significantly [26].

C. Synthesis of Pareto-optimal Safe-SCAD controllers
The synthesis of Safe-SCAD controllers solves the driver attentiveness management problem. For this purpose, we define the reward structures r nuisance , r progress and r risk over the CTMCs from our controller design space. The definitions of these reward structures are directly based on the definitions of the three measures with the same names from Section II-B. For instance, the state and transition reward functions for the first reward structure are given by r nuisance .r 1 (l, a, v, c?) = nuisance(a) for any CTMC state (l, a, v, c?) ∈ S, and r nuisance .r 2 (s 1 , s 2 ) = 0 for any CTMC transition (s 1 , s 2 ) ∈ S × S, respectively. Given these reward structures, the driver attentiveness management problem for a journey of duration T > 0 can be formalised as: Find the set of controller options (1) whose associated CTMCs from the controller design space achieve Paretooptimal trade-offs between minimising R nuisance =?
where the three CSL cumulative reward properties represent the overall nuisance, overall progress with the journey, and overall risk accrued over a journey of duration T , respectively.
We solve this problem using the search-based software engineering tool EvoChecker [27], [28], which: 1) obtains the precise values of the three reward properties for any given CTMC from the controller design space using a probabilistic model checker (the tool can be configured to use PRISM [19] or Storm [20]); 2) synthesises a close approximation of the Pareto-optimal set of controller options (1) by using multi-objective genetic algorithm (MOGA) optimisation (the tool can be configured to work with any of the NGSA-II [29], SPEA2 [30] or MOCell [31] MOGAs).
To this end, we supply EvoChecker with: (i) our controller design space from Section IV-B, encoded in the high-level PRISM modelling language [19] extended with EvoChecker constructs that we use to specify the possible values for the parameters (1); and (ii) the three CSL reward properties specifying the optimisation objectives from our problem. Figure 5 shows how the controller design space from Figure 4 is expressed in this encoding. Due to space constraints, only a fragment of the encoding is shown, but we made the entire encoding (and the other artifacts from this section) available for inspection at https://cutt.ly/SafeSCAD-SEAMS21. Given the controller design space and the optimisation objectives, EvoChecker synthesises a close approximation of the Paretooptimal set of Safe-SCAD controllers, and the Pareto front associated with this set. Figure 6 shows the Pareto front obtained for the instance of the driver attentiveness management // Controller options specifying the next a v ∈ {000 (2) , 001 (2) , . . . , 111 (2) } value evolve int option S,0 [0..7]; // when driver is semi-attentive and a v = 000 (2) . . . evolve int option S,7 [0..7]; // when driver is semi-attentive and a v = 111 (2) evolve int option I,0 [0..7]; // when driver is inattentive and a v = 000 (2) . . . evolve int option I,7 [0..7]; // when driver is inattentive and a v = 111 (2) Figure 4 and a driving time of T = 4 hours. Each element of this Pareto front corresponds to a controller variant whose nuisance, risk and progress values from Figure 6 were obtained by EvoChecker through formal verification using the Storm model checker.

V. RELATED WORK
Human-machine interaction in driving automation includes the identification and handling of control transitions between the driver and the vehicle [32], [18] and, in support of that, managing the driver's attentiveness and involvement necessary for such transitions, taking into account the current traffic situation with its potential adversity.
Recent research deals with managing such control transitions [18], [33] or continuous shared control [32], and includes inventions about control transitions that require but do not manage driver attentiveness [33], [34], [35]. Similarly, an earlier invention [36] focuses on classifying the driver state and on technologies for situation-adapted collision avoidance by combining braking and driver warnings. A range of experiments [37], [38], [39] investigate parameters of the driver state and behaviour (e.g. response times, drowsiness, influence of traffic density and driver workload), however, with little data about the time it takes drivers to become inattentive.
Overall, none of the works we found discusses how attentiveness monitoring and control software can be automatically designed and adapted for optimal safety and performance, and how such software can be confidently assured to fulfil regulatory requirements [40]. In contrast, our Safe-SCAD approach focuses on the design and analysis of a MAPE control loop supported by such software, assuming the availability of specific sensor technology for estimating the driver state [37]. Moreover, we provide a generic method for defining the design space for this control software, and for its automated synthesis with probabilistic guarantees. Finally, our exhaustive formal Fig. 6. Pareto front associated with the set of Pareto-optimal Safe-SCAD controllers for the controller design space instance from Figure 4, as synthesised in 98.58s by EvoChecker configured to use Storm [20] and NSGA-II [29] (population size 7000 × 1000 iterations) and running on a 3.6GHz Intel Core i3 Mac OSX 10.14.6 Mac mini computer with 16 GB of memory verification approach based on probabilistic model checking is also an improvement over the purely testing-based approach that the safety of the intended functionality (SOTIF) standard recommends for the verification of automated driving systems [40, §10.3, Table 5-7].

VI. CONCLUSION
We introduced a MAPE control loop for improving driver attentiveness in ADS-enhanced cars, and we described a novel method for the rigorous synthesis of the controller used in the planning stage of this MAPE loop. In the next stage of our project, we will complete the development of the DNN-based analysis module from Figure 2 by integrating our project's DeepTake predictor of driver takeover behaviour [14] and its verification results [17] into the end-to-end solution presented in this paper. The complete solution will then be evaluated experimentally, in a study carried out using our driving simulator from [14].
Additionally, we will assess whether the good EvoChecker scalability reported in [28] extends to our controller synthesis problem with larger numbers of alerts m and speed levels q (cf. Section II-B). Finally, we plan to explore: (i) the use of personalised and adaptive controllers (as described in Section IV-B); (ii) the use of the CTMC-refinement technique from [41], [42] to improve the accuracy of the Safe-SCAD controller design space; (iii) the use of the robust synthesis techniques from [43], [44] to generate controllers tolerant to variations in driver behaviour; and (iv) the potential advantages of using probabilistic Safe-SCAD controllers, i.e., controllers for which the options (1) are discrete probability distributions over the set of actions available to the controller.