## 2 Materials and Methods
### Adaptive Co-Pilot--Shared Controller  
This section describes the design of the shared controller of the adaptive co-pilot, which is in essence a trajectory tracking controller. Nonetheless, on the basis that the driver will interact with the controller through the steering wheel, it needs to meet a series of requirements that are not considered in conventional autopilots (designed to perform the lateral driving task, but without considering humans as a collaborative agent). In this sense, the controller needs to cover the following design aspects. * The control signal (controller output) is the steering wheel torque, whereas conventional autopilots use the steering wheel angle [25] or even the angular velocity [26]. However, drivers control the steering wheel by applying torque with the arms-hands mechanism, and it has been shown that steering angle control decreases the ease of driver intervention (as it has to deal with the low lever position controller) [27]. Therefore, to couple the control signals of both agents, a torque-based lateral controller is designed, similar to previous works in lateral shared control that have followed the same approach [28]. * The authority of the controller is adaptative to the ever-changing environment and context, whereas conventional autopilots assign a single authority value to the controller, being either activated (authority = 1, or maximum torque applied) or deactivated (authority = 0). In autopilots, the context may change the behavioral planner, but the core controller remains with the same authority, whereas for the driver-automation \"team\", the automation support can adapt its intensity according to the conditions of each scenario (changes in driver fit-to-drive conditions, unsafe driver actions, automation failures, and others). This means automation can assist the driver with different levels of intensity (authority), covering the continuous spectrum from \"no assistance\" to \"maximum allowed assistance\". In the literature, this intensity is known as the level of haptic authority [22,29]. * The control method is able to perform optimization of multiple objectives, as the complex interaction between driver and automation creates a series of goals such as tracking performance, driver comfort, driving efforts, and safety, which cannot always be achieved at the same time. Therefore, a controller capable of balancing those objectives efficiently is ideal for the adaptive co-pilot. Whereas classical controllers such as PIDs have been widely used for autopilots, shared control applications are more benefited by optimal control algorithms that allow minimizing functions with multiple objectives, with the additional benefit of managing constraints of vehicle dynamic states and control signals [8]. Figure 1: Adaptive co-pilot framework. Based on these design aspects, and within different methods of optimal control, recent works in shared control have promoted the use of nonlinear model predictive control (NMPC), demonstrating positive results in their implementations [30; 31; 32; 33]. These works motivated the use of this control strategy for the adaptive co-pilot, also due to the following benefits offered by this technique: (1) it is a powerful approach for the optimal control of multivariable systems with constraints on the inputs and states, (2) it allows easy integration of predicted information, as well as constraints resulting from traffic predictions or road geometry, (3) it works both as controller and as a trajectory planner because of the ability to predict its states over a future horizon, (4) it is feasible for non-linear systems and can manage complex constraints, and (5) there are microsecond solvers available, making this technique suitable for having a control loop of 1 to 10 ms, as is usual in automated driving controllers. For deep technical background on MPC, the authors refer readers to [34].