Roll Angle Estimation of a Motorcycle through Inertial Measurements

Currently, the interest in creating autonomous driving vehicles and progressively more sophisticated active safety systems is growing enormously, being a prevailing importance factor for the end user when choosing between either one or another commercial vehicle model. While four-wheelers are ahead in the adoption of these systems, the development for two-wheelers is beginning to gain importance within the sector. This makes sense, since the vulnerability for the driver is much higher in these vehicles compared to traditional four-wheelers. The particular dynamics and stability that govern the behavior of single-track vehicles (STVs) make the task of designing active control systems, such as Anti-lock Braking System (ABS) systems or active or semi-active suspension systems, particularly challenging. The roll angle can achieve high values, which greatly affects the general behavior of the vehicle. Therefore, it is a magnitude of the utmost importance; however, its accurate measurement or estimation is far from trivial. This work is based on a previous paper, in which a roll angle estimator based on the Kalman filter was presented and tested on an instrumented bicycle. In this work, a further refinement of the method is proposed, and it is tested in more challenging situations using the multibody model of a motorcycle. Moreover, an extension of the method is also presented to improve the way noise is modeled within this Kalman filter.


Introduction
Single track vehicles (STVs) present some intrinsic advantages as a mobility solution: they are lighter, use less space, and have better fuel economy, particularly at low speeds. These advantages make them great candidates for urban mobility. However, due to their lack of static stability, they also present some intrinsic challenges regarding safety and autonomous driving.
One magnitude that is of particular interest is the roll angle with respect to gravity (i.e., with respect to the vertical), since it is the magnitude used to keep the balance of the vehicle when it is in motion. Therefore, any control system that aims at controlling the balance of a STV, or any advanced driving aid for human-driven vehicles, has to take the roll angle into account. The roll angle determination has other potential applications.
For example, it is required in scientific experiments, such as those performed for the rider control parameter identification [1] or to evaluate the maneuverability of a motorcycle [2]. Unfortunately, there is not any means of measuring the roll angle of a STV in an economic and reliable way. Usually, the practical approach is measuring this magnitude indirectly through state observers, which combines the information provided by some sensors with a mathematical model to estimate the variable of interest. Consequently, this problem has been studied for several years, trying to improve the estimation algorithms.
There are some works using video-based approaches or distance sensors. The roll angle measurements using these types of devices are not reliable enough to be installed on commercial vehicles, since they are sensitive to the dirt. Moreover, they provide roll

Methods
This work is focused on the estimation of the roll angle of a motorcycle. In order to achieve this, a multibody motorcycle model is developed. Sensor models are implemented on the multibody model, and these data are used to run a state observer that estimates the roll angle of the multibody model. Since the sensors of the multibody model are "perfect", a sequence of pseudorandom numbers is added to mimic the noise of a realistic signal.
This section deals with the description of the multibody model, including its kinematics and the main force models, namely, tire forces, suspensions, drive and brake forces, etc.
Since the motorcycle is an intrinsically unstable system, a controller is required to maintain the balance and follow the prescribed trajectory, which is also described in this section. There are two more controllers: a longitudinal controller, which adapts the speed of the motorcycle depending on the curvature of the upcoming path, and a rider controller, which is used to control the position of the rider's torso, which can be in a neutral position, tilting inside the curve, or tilting outside the curve. Finally, this section describes the sensor data obtained from the multibody model and the designed tracks where it is simulated.

Multibody Model
The model used is a seven-element assembly without closed kinematic loops, where six elements belong to motorcycle parts, and one of them represents the driver's torso. As a result, a 12 Degrees of Freedom (DOF) model is obtained: six DOF from the chassis rigid body condition, five revolute joints from the two wheels, swingarm, steer and torso roll movement, and one prismatic joint between the fork bars and the fork bottles. All the motorcycle elements and DOFs are represented in Figure 1. Mass and inertia properties for each element of the model are shown in Table 1. Some of them are taken from the bibliography [12] and other are obtained from a CAD tool. A relative coordinates formulation was used, which is a well suited option to take advantage of the topology of the mechanism. Each solid in the chain is defined relative to the previous one, using algorithms to calculate kinematics and dynamics terms by means of recursive methods. An in-depth description of this formulations is covered in [13]. The trapezoidal rule was chosen as the integrator, with a 1 millisecond fixed time step to solve the dynamics.

Force Models
Some forces are taken into account to achieve a realistic behavior of the motorcycle and its dynamics, such as gravity influence, forces from the motorcycle subsystems, such as brakes, tires and suspensions, and different torques applied to rear wheel, to steer mechanism and to the driver's torso. Rear wheel torque represents power transmission as an in-wheel hub motor would produce, steer torque represents the rider input to control the vehicle, and torso torque aims to represent the influence of the rider's movements in the roll angle estimation.

Brake Models
The brake model employed in this research is based on the tangential force model developed in [14], which takes into account sliding and stiction phenomena, with original contributions from [15]. In essence, a dry friction model is used in series with a springdamper model. When the spring force exceeds the maximum achievable braking torque for a given braking pressure, one of the ends of the spring is allowed to slide so that the maximum braking force is not exceeded.
The front wheel has more braking capabilities than the rear one, as in a conventional motorcycle, but both brakes act together when braking. The maximum brake torque applied to each wheel is obtained by estimating the longitudinal force that the tires can perform according to Equation (1).
where µ is the tire-friction road considered, and N is the vertical force supported by the wheel. In case of the front wheel, this force is considered to be the whole weight of the vehicle and the driver, since in an emergency braking situation, almost all the weight rests on the front wheel. The normal force considered for the rear wheel is the weight that it supports when going straight and without any longitudinal acceleration.

Tire Models
Tire behavior and properties play a crucial role in the evaluation of the motorcycle dynamics. In this work, toroidal tires are used, since it is a good approximation to the behavior of motorcycle tires. They are defined with an outer radius, R, which represents the undeformed tire outer radius, and the torus tube radius, r, which should be selected to represent, in the most accurate way, the tire curvature near the contact patch.
Tire force models are divided between the normal force model and tangential force model. Normal forces calculation is closely related with the contact routine used to detect the intersection between the tire and the floor. In this research, a triangle mesh was used to characterize the floor, and thus the first step to calculate normal forces is to solve the contact problem between the torus and the triangle mesh. The contact algorithm between analytic torus and the triangle mesh used in this work is described in [16]. After a wheel contact is detected, the normal force is modeled as a spring-damper force. However, the force of the spring-damper element is limited such that it can produce compression forces over the road, but traction forces are not allowed.
Related to the tangential force model, part of the TMeasy tire model was applied [17], using the same simplifications as in [18]. This is an empirical and physical tire model, in the sense that first, curve fitting using few parameters is necessary to adjust the tire characteristic curves, and then dynamic behaviors of the tire are considered. The model takes into account both the longitudinal and lateral forces experienced by the tires, and these forces are slip-dependent in both directions.
As a consequence, the effects of tire deflection affect the tire behavior when the forces vary. This phenomenon is specially important when the vehicle moves at very low speed, because small displacements can produce high slips. If tire deflection is not considered, these high slips introduce unrealistic high forces. What actually happens is that the forces acting in the contact patch deflect longitudinally and laterally the tire as shown in Figure 2. The motorcycle has traditional suspension systems for this kind of vehicles. Thus, for the front assembly, an inverted telescopic fork was chosen. For the rear frame, a monoshock absorber links the swingarm and the chassis. In both cases, a linear spring-damper model is used.

Drive Torque
The model simulates power transmission from an electric motor by introducing a torque in the rear wheel. Torque values have a dependency with angular rate, hence tabulated values with realistic properties are used. This torque value will be calculated by the longitudinal motorcycle controller, which will be described in depth in Section 2.3.2.

Steer Torque
Steer torque is the only input used to control the lateral dynamics of the motorcycle. It is used to control both the lateral equilibrium and to follow the prescribed trajectory. It highly affects the forces experienced by the tires, modifying completely the whole vehicle dynamics. This variable is managed by the lateral motorcycle controller, which will be covered in Section 2.3.3.

Torso Torque
This work aims at analyzing the rider's influence on the estimation of the vehicle roll angle. For this purpose, a torque between the torso and chassis elements is introduced in order to verify if the estimation is influenced by these movements. There is a specific controller managing this torque value, and it will be explained in Section 2.3.4. In this work, the torso controller is not used as a tool for motorcycle stabilization.

Controller Models
Since the aim of this work is to test the roll angle estimation in different conditions and scenarios, the motorcycle model has to be able to perform in a wide variety of circumstances. To achieve that, several controllers were implemented. First, longitudinal control manages accelerating and braking phases. Secondly, lateral control guarantees the lateral dynamic equilibrium while following the specified trajectories. The longitudinal controller has to be able to keep the velocity, which allows the lateral controller to perform the desired maneuver.
Lastly, a torso controller is used to perform maneuvers with a lean relative angle between torso and motorcycle, inside and outside the turns, as an option.

Path Tracking
In order to follow a predetermined path, it is necessary to use a curve definition system that can encode the trajectory that the motorcycle has to follow. In this work, splines are employed. Each scenario has a finite number of splines. They are drawn using the Blender software (Blender Foundation, Amsterdam, The Netherlands), and then their parameters are exported to a text file to be read by the simulation program.
Then, a point referred to the chassis frame is defined, and its position is compared to the path previously defined. This point is not necessarily coincident with the chassis. In this work, it is ahead of the chassis position to evaluate the deviation with respect to the trajectory in advance, as a human driver would do. This reference point position is speed-dependent: the faster the motorcycle goes, the farther and higher the point is found, as shown in Equations (2) and (3), where v ch,x and v ch,y stand for chassis velocity components, and rp x and rp z are the coordinates of the reference point expressed in the local reference system of the chassis (in SI units). In this work, the position of this reference point has an important effect on the overall behavior of the controller.
The constants were adjusted by trial and error. The height of the reference point is also variable with speed. This height is relevant in tilting vehicles, since it produces a lateral displacement of the reference point when the vehicle is tilted. Once this point is defined, it is necessary to calculate the distance between the point and the nearest spline of the track. In this work, we calculate the distance to the spline perpendicular to the longitudinal axis of the motorcycle model.
With this information, the position, velocity, and orientation errors can be calculated, in order to correct the motorcycle position with respect to the desired path. These error values are the data that the lateral controller needs to calculate the roll angle target required to correct the motorcycle trajectory respect to the desired path. This will be addressed in Section 2.3.3.

Longitudinal Controller
This controller manages the acceleration and braking phases. The longitudinal control is designed to perform the maneuver as fast as possible, taking into account the curvature of the trajectory and the power limits of the motorcycle. The controller evaluates the path ahead the motorcycle 10 s in advance with respect to the reference point described on the previous section, and thus there is enough time to start braking before arriving too fast at a turn. This value is translated into a distance variable by means the Equation (4), which means the position in advance is calculated taking into account the current speed of the motorcycle.
x i+t preview = t preview v i Once the position in the spline is known, the maximum speed is obtained in relation to the curvature of the path (κ), by means of the steady-state cornering equilibrium equation [19], expressed in Equation (5), where φ max stands for the maximum roll angle the motorcycle can achieve, which is a configuration parameter for the controller.
The value of V max cannot achieve infinite values and is limited to a max value, which is a configuration parameter. Once known, the current speed is evaluated against it, and the controller will accelerate if the current speed value is lower than V max , or will brake if the motorcycle speed is too high. Both of the actions are managed by proportional controllers, as shown in Equations (6) and (7).
When accelerating, the value of accel is translated into a rear wheel torque, taking into account tabulated torque values and the wheel angular rate. When braking, the value of brak is transformed into brake torque in both wheels, but with different values, since the brake power capabilities are different, as mentioned before.

Lateral Controller
In order to obtain full stability during maneuvers, a lateral controller was implemented. For this purpose, a Linear Quadratic Regulator (LQR) controller [20] was used, and a good behavior was achieved. Since the LQR controller requires a dynamic model in state-space form, the motorcycle multibody model was adapted into a Whipple model, and thus the initial seven-solid model is transformed into a four-solid model, as described in [21]. Model adaptation is shown in Figure 3. From the Whipple model, only the lateral dynamics are used.  (8), where M, C 1 , K 0 and K 2 are obtained from a set of 25 parameters of the motorcycle (see Table 2), q = [φ δ] is a vector that contains roll (φ) and steer (δ) angles, f = [T φ T δ ] is a vector that contains roll and steer torques (the roll torque is considered to be null in this work), and g and v stand for gravity acceleration and forward velocity, respectively. The employed values are shown in Table 2.
Equation (8) can be expressed in state-space form as shown in Equations (9) and (10), where u is the input vector, x is the state vector and y is the system output. As Equation (8) is second order with respect to time and Equation (9) is first order, some changes are necessary. Taking f = [0 T δ ] , x = [qq] and its derivative asẋ = [qq] , Equation (11) is obtained.
Once the parameters of Table 2 To ensure system stability, state feedback is used, defining the system input as a negative feedback of the state, as in Equation (14), finding a K matrix that stabilizes the system.
Stabilization is achieved if the real parts of all eigenvalues of the system matrix are negative. Thus, Equation (9) can be combined with Equation (14), obtaining: Now, system stability is determined by the eigenvalues of A − BK, and thus a K matrix can be calculated with the values that ensure stability, since A and B are constants. In LQR controllers, the value of K is the one that minimizes the following cost function: The function combines the quadratic values, integrated over time, of the magnitudes that should be minimized: the states and the control inputs. Each of them is weighted by a term, Q for the states and R for the input. The values of this terms can be adjusted in order to assign more weight to the control effort (increasing R value), or penalizing more the state errors by increasing the values of Q.
The trajectory of the motorcycle can be controlled through its roll angle φ, and thus we need to set it to a certain value at every time step. However, the LQR controller defined thus far is only a regulator, i.e., it drives the states to zero. Since the resulting system is of type 0 [20], we need to transform it into a type 1 system, in order to make it capable to track a reference value of the roll angle. This can be achieved by adding an integrator at the input. Therefore, the system size increases, as a new state is added, ξ, which is the integral of the tracking error, which means the integral of the difference between the controller target (r) and its output (φ). The input u changes its value to: and the value of ξ should be calculated during the runtime as shown in Equation (18), where dt is the simulation time step.
Hence, the system turns into Equation (19): where x is the augmented state vector, andẋ is its derivative: We can now define K = K −k I . Therefore, we can rewrite Equation (17) as follows: The values of Q and R used in this work for Equation (16) are: These values were adjusted by trial and error to obtain a realistic behavior.
The K values obtained for a 20 m/s forward velocity can be seen in Equation (23). It was not necessary to calculate K values for different velocities, as could be expected, since the controller works fine with the values obtained for the forementioned velocity for all the speed range used in this work.
Now, the controller target, which represents the control input (u), should be assigned. Hence, some terms are calculated, such as position (u i ), velocity (v i ), and angular errors (α i ) between the motorcycle position and the spline curve: where ψ stands for the yaw motorcycle angle, x sp and y sp are the spline coordinates, x sp and y sp are the reference point coordinates mentioned in Equations (2) and (3), sp n is the spline normal vector, rp vel is the reference point velocity, and α is the angle of the spline tangent vector. With these values, Finally, the roll target expression is obtained: The steer torque expression becomes: The second term in Equation (31) acts as a steer damper, in order to minimize all the small instabilities coming from different sources (contact forces, tire forces, controller, etc.), achieving a better performance without becoming slow on response. The variable v steer refers to the steer velocity, while k d is a damping coefficient, which, in our case, takes a value of 10 Ns/rad.

Torso Controller
Torso roll movement has a capital influence on the motorcycle dynamics, since it changes the center of mass of the vehicle. If the torso goes inside a turn, the motorcycle lean angle can be reduced, whereas going outside instead forces the motorcycle to increase its roll angle to tackle the same turn at the same speed. In order to analyze this effect in the estimator, a torso controller was implemented. The controller allows to configure three different positions as seen in Figure 4: inside position, neutral position, and outside position.  In the neutral position, the torso has no influence in the maneuver, since it stays aligned with the motorcycle. On the other hand, the inside and outside positions modify the relative angle between the torso and the motorcycle, changing the center of mass position. The input angle for the controller is defined by Equation (32).
where φ is the vehicle roll angle, F is a factor that can take three values: 0 for a neutral position, 1 for an inside position, and −1 for an outside position. The 0.5 was used in this work, but other values could be used if more or less rider lean is desired. Once obtained, a PD controller can be defined as: Proportional (K) and derivative (C) term values used in this work are 1.5 × 10 3 and 1 × 10 3 .

Sensor Models
As described in [11], it is assumed that wheel speed sensor and angular rate measurements are available. These sensors are already available in many commercial motorcycles. Sensor data is built from the values of the multibody simulation.
In order to obtain vehicle forward speed, a wheel speed sensor is employed. Through it, longitudinal speed can be easily estimated by Equation (35). Values from any wheel can be taken, since there is no significant difference between them, except during aggressive accelerating or braking phases. When the wheel slides, the speed estimation will not be correct. Moreover, when the vehicle is tilted, the effective radius of the wheel is reduced. The multibody simulation used in this work can represent these two situations.
v long = ω wheel r wheel An Inertial Measurement Unit (IMU) sensor was modeled in order to obtain angular rate measurements from the chassis element. The sensor is attached to the chassis reference frame, but in order to obtain the correct measurements, the IMU longitudinal axis should be aligned with the roll axis of the vehicle. This is particularly important since if this condition is not fulfilled, angular rate values will not be the correct ones. A rotation matrix can be applied to the sensor system reference in order to fix the possible wrong alignment between the IMU axis and the longitudinal axis of the motorcycle. This can be seen in Figure 5. Through Equation (36), the right angular rate values can be obtained.
where R IMU is the rotation matrix of the IMU relative to the chassis reference system, and R ch is the rotation matrix of the chassis reference system with respect to the global axes. Even if the IMU is perfectly aligned when the motorcycle goes at constant speed in straight line, there will be some situations in which the axis coincidence condition will not be fulfilled. Figure 5. IMU position adjust.
For example, during a turn, when the motorcycle leans, the wheel contact points change their position due to the width difference between the two tires (in this case, as usual, the rear tire is wider than the front one). When the steering is turned, the front wheel contact point changes due to the fork trail, which also leads to a misalignment. Suspension movements can also produce similar effects. In all of these situations, an error between the IMU longitudinal axis and the motorcycle roll axis is expected, but it is an unavoidable fact.
In the case of both sensors, in order to achieve a more realistic situation, some additive random noise is added to the data in order to mimic real sensor characteristics. The noise is modeled as additive Gaussian white noise. However, neither the plant nor the measurement white noise. Therefore, for both sensors, values employed in the estimator (obs) are obtained through the simulation ones (mb) as: ω obs ws = ω mb ws + N ws (38) where N IMU and N ws are pseudorandom numbers following a normal distribution with 0 mean, which simulate the noise of the IMU and the wheel speed sensor, respectively. In the case of the IMU, the standard deviation used for the simulated noise is 9.839 × 10 −4 rad/s (this value was obtained from a measurement taken with a low-cost IMU). For the wheel speed sensor, since no data was available, a conservative estimation of 1 m/s was taken for the standard deviation of the sensor noise.

Scenarios and Maneuvers
The results from the previous work shown in [11] were obtained for a bicycle with no suspensions. Therefore, the results were only verified for low speed, thin tires, and without suspensions. Moreover, due to the experimental setup, the motion of the rider was unknown, and the measurement of the roll angle for verification purposes could only be performed on flat surfaces. Since this work is based on a simulation, both the scenario slope and bank angle can be controlled, and every magnitude can be measured, including the motion of the rider, which is part of the model. Some scenarios were built in order to test the estimations. The goal is to check the behavior of the estimator in all kind of situations, such as level grounds, slopes or bends. With this in mind, six scenarios are proposed, as shown in Figure 6: three with level ground and another three with slopes and/or bank angles.  The level ground scenarios are the Straight track, Circular track, and DLC track scenarios, while the Slope track, the Car park track, and the Bend track are non-planar tracks.
The Straight track is actually an oval track with two 2 km long straights, intended to study high-speed maneuvers and the transition from straight to turn. The Circular track is almost circular (it was approximated by four splines, and thus it is not a perfect circumference) to verify the steady-state cornering behavior of the observer. In this case, it has a radius of 50 m. The DLC track is also an oval track, but it features a double lane change in one of its straights.
When considering the non-planar tracks, all of them are ovals. The Slope track has two large bumps on each straight. Each one reaches a height of 6.5 m over a length of 38.4 m, which gives an average slope of 17%. After they reach their maximum height, they go back to the base level. The Car park track has an ascending slope combined with a turn, with a trajectory resembling a screw thread. The slope of this part is 22%. After that, there is a straight descent with a slope of 18% until the initial level is achieved. Finally, the Bend track is a flat circuit, but with a bank angle of 15 • . The range of speeds used for the maneuvers reproduced in every scenario are shown in Table 3. The full data set obtained from the simulations is provided as supplementary material with this paper.

Roll Angle Estimator
The tool described in this section aims at estimating the roll angle of a STV with respect to gravity. To achieve that, it is assumed that the data from previously described sensors are available. Those sensors are affordable and easy to install on a vehicle, but they do not provide any direct measurement of the roll angle. To resolve this issue, information from both sensors and knowledge from the system has to be blended. In this work, a Kalman filter algorithm is employed to develop two variants of the roll angle estimator.

The Kalman Filter
The Kalman filter is a stochastic estimator that combines predictions from a model with measurements coming from sensors. The equations of the discrete version of Kalman filter are reproduced here. The reader interested in a deeper understanding of the Kalman filter is referred to any of the books on the topic, such as [22,23].
The filter runs in two stages: prediction and correction. During the prediction phase, the state x and the covariance matrix of its estimation error P are propagated by means of the model: where F stands for the transition model of the system, G is the input matrix,x − k is the estimation of the state vector in time step k before the measurement is applied,x + k−1 is the estimation of the state vector of the k−1 time step after the corresponding measurements were applied, and u k is the input of the system. If measurements from sensors are available, they are used at the correction phase to improve the estimation from the prediction stage.
First, innovationỹ is calculated as the difference between the measurements from sensors (o k ) and the expected sensor readings according to the model (Hx − k ). Kalman gain (K) and the innovation covariance matrix (S): The value of S represents the uncertainty in the system state projected via the sensor function (HP − K H ) plus an additional uncertainty, Σ S , due to the sensor noise. Finally, the estimation of the state and its covariance are updated by means of the Kalman gain: If measurements from sensors are not available, the correction stage is omitted.

Dynamical Model of the Filter
The model employed by the filter has two states: the roll angle and the bias of the angular rate sensor along the body fixed x-axis. The relationship among the angular rates measured by the body-mounted angular rate sensors (ω B b , ω B y , ω B z ) and the time derivative of the roll (φ), pitch (θ), and yaw (ψ) angles of the vehicle body follows from: and can be expressed as:φ Assuming a small pitch angle, |θ| ≈ 0, Equation (47) becomes: The bias (b x ) of the x angular rate sensor (ω B x ) can be modeled as a random walk, i.e., assuming that it is constant and that the variations are produced by the plant noise. Once b x is known, ω B x can be corrected. Therefore, after applying the forward Euler integration method, the dynamic model of the filter becomes: where the states at the present time step k are expressed as a function of the states and the inputs of the previous time step k − 1, being dt the integration time step. In the previous equation we can identify the system and input matrices (F and G) as follows:

Absolute Measurements of the Roll Angle
In the correction stage of this Kalman filter, absolute measurements of the roll angle are needed. None of the sensors considered in this work provides a roll angle measurement, therefore, a model was built from the sensor measurements, and employed as absolute roll angle measurement. This is the measurement employed at the Kalman filter correction stage, denoted as o k in Equation (41). The model is the same as described in [11], and is created by combining two ways of obtaining a roll angle estimation, coming from two different assumptions. The first one is obtaining from the steady-state cornering equilibrium, which will be referenced as φ d on this work: where v is the forward vehicle speed (obtaining from wheel speed sensor), g is the gravity acceleration, andψ is the yaw velocity, which is assumed that ω B z (obtaining from IMU) is an enough accurate estimation. This method works well for small roll angles on level roads, but it tends to underestimate the roll angle in more realistic conditions due to the gyroscopic effect and the thickness of the tires, which are not considered in this model.
On the other hand, roll angle can be obtained under a null pitch rate condition, which means the Equation (48) becomes: and then, the another estimation of the roll angle, referenced as φ ω in this case, can be calculated as: where sgn(ω B z ) is the sign of the z angular rate. This method is more convenient for greater roll angles because the predicted roll tends to oscillate around the true value, although is noisier than the steady-state based one. In order to take the best from both estimations, they are combined using a weighted mean. The weighing function changes its value depending on the last available estimation provided by the equations of the steady-state cornering equilibrium, φ d . This is the main difference with respect to the method employed in [11], where the last estimation provided by the Kalman filter (φ) was used instead. The change was motivated because it was seen that, in some cases, an instantaneous wrong angle estimation could lead to a inadequate weighting value, which could eventually make the estimation diverge definitively from the true value. In this work, the weighting function, which can be seen in Figure 7, is defined by: whereφ 2 is a constant value that can be used to adjust the behavior of the weighting function. In this work, a value ofφ 2 = 0.04 was used, with the dynamically estimated roll angle φ 2 d expressed in radians. Therefore, the roll angle measurement o k to be employed in Equation (41) is φ m , built as weighted combination of φ d and φ ω : Since this measurement is the same magnitude than the first component of the state vector, the output matrix H results as follows:

Adaptation of the Kalman Filter for Colored Noise
The Kalman filter was formulated assuming that the noise affecting both the plant and the measurements is additive white Gaussian noise. However, neither the plant nor the measurement noises are white for the models used in this work. Instead, the lower frequencies are predominant in both noises (for instance, if the measurement is overestimating the roll angle at a given moment, it is more probable than the next time step it will be also overestimating it). This kind of behavior, usually known as colored noise, can be modeled as follows [22]: where the subindex i represents the time step, Cn is the colored noise, Wn is the white noise, and W is a parameter that can take any value from 0 to 1 to modulate the influence of the previous value of the noise. If W = 0, the model would produce white noise. If W = 1, the noise would behave as a Markov model. If we introduce this noise model for the noise of the roll angle of the dynamic model of the Kalman filter, and also for the noise of the sensor, the resulting filter matrices will be as follows: where F , G , and H are the system, input, and output matrices of this augmented filter, respectively, W 1 is the weighting parameter of the measurement noise, and W 2 the weighting parameter of the plant noise (applied only to the first state of the filter). When this model is applied, the measurement noise is incorporated into the colored noise, and, therefore, the covariance matrix of the measurement noise should be set to zero. Other than that, the method is identical to the previous one.

Results and Discussion
One of the key aspects of the performance of a Kalman filter is a proper adjustment of the values of the plant and the measurement noise covariance matrices. In the algorithm presented in this work, the weighting parameter for the measurement estimation also has to be set. Moreover, in the filter adapted to deal with colored noise there are two additional parameters, i.e., the weights used to model low frequency component of the noise. In this work, this tuning process was made by trial and error, seeking the minimization of the Root Mean Square Estimation Error (RMSEE) of the worst maneuver. The parameters used in this work are shown in Table 4. Table 4. Values of the parameters used in this work (in SI units). In this work, both the simple Kalman filter presented here, and the previous version in [11] were used with the same parameters for a fair comparison. Note that the Σ S for the Kalman filter for colored noise is null. The reason is that the measurement noise is contained in the third row of the plant noise. The results obtained for all the six tests scenarios are shown in Figure 8. The numeric results of the RMSEE for both methods are shown in Table 5. The method as described in [11] is also added to the comparison. In all these tests, the rider kept a neutral position. The results are very good for all the maneuvers with flat floor, with a RMSEE below 1 • for all estimation methods. The maneuvers on inclined floors are a harder challenge for the estimator, mainly the Car park ramp track and the Bend track. In these maneuvers the RMSEE are around 2.5 • , with the Kalman filter for colored noise having slightly better estimations for both maneuvers.
With different parameters, the results of both maneuvers can be improved, but improving the results in one of the maneuvers would produce deterioration of the performance on the other. The estimation at the Car park ramp track is, in general, good, but the accuracy degrades after the turns. This might be because the bumps of this track start after the turns and the motorcycle goes over them when it is still leaned, thus degrading the performance of all the indicators, because neither the pitch nor the pitch rate are null. Figure 8. Estimated roll angle and roll angle error for the six different scenarios. All of these tests were performed with the rider in a neutral position. The reference is the black solid line, the red dash dotted line is the Kalman filter as presented in [11], the green dotted line is the variation of that Kalman filter presented here, and the blue dashed line represents the Kalman filter adapted for colored noise. The estimation method as presented in [11] provides good estimations in general, but it seems to be less robust than the new variations, as can be seen in the plots for the maneuvers in the Slope track and Bend track, where some short but important deviations can be appreciated. The risk with this method is that a temporal wrong estimation can lead to an inadequate weighting value to combine the two roll angle estimations used at the correction phase of the filter. This can potentially turn into a positive feedback that could make the estimation diverge from the true value.
The Kalman filter adapted for colored noise produces the best worst-case scenario estimations, but only by a narrow margin, and it is not the best in all the maneuvers. Moreover, it is more difficult to adjust because it has more parameters to tune, and thus it does not have any practical advantage in its current form.
Nevertheless, there is a potential benefit from using the colored noise adaptation for the filter, although it is not explored in this work. Since the characterization of the noise is improved, the statistical characteristics of the innovation sequence would be improved as well, thus allowing to use innovation-based adaptive Kalman filters, which should be able to improve the performance of the method for all the maneuvers that have now the worst estimation results. It was recently shown that innovation-based Kalman filters can work reasonably well even if the statistical properties of the noise are not perfect, and even with nonlinear models [24].
Another point that we wanted to address with this work was the influence of the rider position on the roll angle estimation error. For the sake of conciseness, only the Circular track was studied. Therefore, three simulations were run on this track, the only difference being the driver keeping its neutral position, leaning inwards, or leaning outwards. The results are shown in Figure 9, and the numerical results of the RMSEE are shown in Table  6. As expected, when the rider tilts inwards, the roll angle to perform a given maneuver is reduced, and the opposite happens when the rider leans outwards. Regarding the roll angle estimation accuracy, the difference between the different rider positions does not produce any significant perturbation. Table 6. Root mean square estimation errors for the three estimation algorithms on the Circular track with the rider in neutral position, leaning inwards, and leaning outwards (in degrees).

Maneuver Neutral Inwards Outwards
Kalman filter as in [11] 0.12 0.13 0.12 Kalman filter 0.27 0.28 0.28 Kalman filter for colored noise 0.11 0.10 0.17 Figure 9. Estimated roll angle and roll angle error for the Circular test track. The left plot represents the maneuver with the rider in a neutral position, the central plot represents the rider tilting inwards during the turn, and the right plot represents the rider tilting outwards during the turn.

Conclusions
This paper is based on the roll angle estimation algorithm presented in [11], where it was first presented and tested at low speed with an instrumented bicycle. However, due to technical limitations of the experimental setup, part of the validation could not be performed. This work aims at verifying the performance of the roll angle observer in more challenging conditions. In order to achieve this goal, a multibody model of a motorcycle was developed, including toroidal-shaped wheels to consider the displacement of the contact point with wide tires. The multibody model also considers the suspensions, whose movement produces misalignments that could potentially degrade the performance of the roll angle observer. In addition, non planar scenarios modeled as triangle meshes, and rider motion were also considered. Finally, higher speeds than those considered in [11] were tested here.
The multibody model, governed by a longitudinal controller in charge of keeping an adequate speed and by a lateral controller used to keep the balance of the motorcycle and follow the prescribed trajectories, performed maneuvers in six different scenarios. From these maneuvers, some measurements were obtained, mimicking the properties of actual sensors by adding some white Gaussian noise. These measurements were used to verify the performance of the state observer, which was slightly modified to improve the robustness.
Moreover, an augmented version of the observer was devised to deal with the colored noise present at the plant and measurements used at the Kalman filter. Although this last observer provided slightly better results than the simpler version assuming white noise, the improvement is so subtle that in its current state, it would not be justified its practical use, given the more difficult tuning process and the increase in the size of the problem.
However, this new observer should provide (with the proper parameter tuning) statistical properties more consistent with the theoretical assumptions made to develop the Kalman filter. Therefore, the innovation sequence of the Kalman filter could be used to implement an innovation-based adaptive Kalman filter, which, in turn, should provide better estimation results, specially for the maneuvers that have the worst results in the present paper. Funding: This research was partially financed by the Spanish Ministry of Science, Innovation and Universities and EU-EFRD funds under the project "Técnicas de co-simulación en tiempo real para bancos de ensayo en automoción" (TRA2017-86488-R).