1. Introduction
In recent years, there have been many advances in vehicle technologies based on the efficient use of real-time data provided by embedded sensors. Some of these technologies can help you avoid or reduce the severity of a crash such as the Roll Stability Control (RSC) systems for commercial vehicles [
1,
2,
3]. These systems contribute to monitor and improve the vehicle stability, comfort and handling. This control functionality requires knowing relevant information of the vehicle dynamics, such as angular rates, angular positions, lateral and longitudinal acceleration [
4,
5,
6],
Several related measures (lateral and longitudinal acceleration, yaw rate or roll rate) can be measured using low cost sensors, but others (i.e., sideslip or roll angle) need to be obtained using very expensive equipment such as Global Positioning System (GPS) dual antenna; they cannot be measured using other sensors [
7]. These kind of GPS devices would increase the price of commercial vehicles.
Nevertheless, sideslip or roll angles can be estimated using data provided by low-cost devices to solve the price problem in an efficient way. Several studies estimate sideslip applying data fusion techniques using low-cost GPS, inertial navigation systems, yaw rate and lateral acceleration [
4,
5].
In a similar way, roll angle can be estimated by the fusion of wheel angular speed, yaw rate, steering angle as proposed in [
8] or fusing yaw rate, roll rate, lateral and longitudinal acceleration as in discussed in [
7]. In most cases, the data required for this kind of proposals is obtained using a six-dimensional IMU [
9]. The data fusion algorithms considered to estimate roll angle are based on different techniques implemented separately or jointly: Bayesian Filters [
8], Kalman Filters [
3,
9,
10], robust observers [
6,
11,
12] and neural networks [
3,
7].
The Internet of Things (IoT) refers to the interconnection of uniquely-identifiable embedded devices within the Internet infrastructure [
13]. IoT technologies are able to contribute to the effective implementation of real-time RSC systems embedded in commercial vehicles providing added value services, integrating a large amount of sensors, actuators, and communication devices (mobile devices, GPS devices, and embedded computers [
14,
15,
16]) into vehicles.
The main elements to consider in a IoT architecture to implement embedded RSC systems for vehicles are [
17]:
The first architectural component of IoT is the perception layer. It collects data using sensors, which are the most important drivers of the Internet of Things [
18].
The next architectural component that we shall discuss is communication. The most common communication technologies for vehicular communications are Bluetooth, Zigbee, and WiFi [
19].
The last architectural component integrates two kinds of software elements: middleware and applications. Middleware enhances interoperability of smart things and makes it easy to offer different kinds of services [
15,
16,
20,
21,
22,
23]. The applications include all the services notifying drivers roll risks situations and sending the appropriate orders to the vehicle active safety systems.
Nevertheless, it is necessary to consider specific requirements that IoT solution must satisfy to provide actual operational systems for RSC. These requirements include: (a) the data from the sensors in a high frequency sampling bases, at least at 50 Hz [
14]; (b) in order to keep reasonable costs of commercial vehicles, it is necessary to obtain this information from low-cost sensors; (c) the data that cannot be provided directly by low-cost sensors, such as roll angle or side slip, must be estimated in a hard real time basis; (d) reduce the energy consumption to monitor the vehicle dynamics while the vehicle is running; and (e) the middleware must integrate in a synchronized, fault tolerant and reliable way the information coming from sensors and estimators.
Intel Edison and Raspberry Pi are examples of low-cost devices used to deploy IoT architectures in automotive research area [
24,
25]. These kinds of devices are widely used to implement IoT architectures due to their low price, flexibility and the knowledge available in the Internet to solve implementation problems [
26,
27,
28,
29]. These devices can be enriched with MEMS sensors (i.e., accelerometers and gyroscopes) to obtain the raw data required to properly estimate roll angle in real time [
14,
18].
As stated before, there are several types of roll angle estimators. In this research work, the estimators considered are based on Kalman techniques. A Linear Kalman filter can be used in applications that require real-time data fusion approaches because it is simple to implement, can be tailored to different sensor configurations, and provides accurate estimations in environments where the sensors provide raw data with noise [
3]. Several practical applications of Kalman filters in research works in the automotive area are related to the estimation of vehicle roll angle [
3,
30,
31], localization [
32,
33] and sideslip [
10]. The Kalman filter is not able to handle curves as input. The Unscented Kalman filter introduces a workaround that transforms the curve to a bunch of points before executing the Kalman filter [
34]. The difference between Linear and Unscented Kalman Filters is relatively small, but in the cases when the cumulative effect of small errors can lead to relevant errors in the estimations provided (such as vehicle roll angle estimation), the use of an Unscented Kalman Filter can be appropriate [
35].
When embedding roll angle estimators in commercial vehicles implementing IoT principles, it is essential to take into account that these software components must fulfill strong, real time processing restrictions. Previous research works [
14] suggest that effective implementations of neural networks implemented in high-performance programming languages such as C++ are able to fulfill hard real-time restrictions. Even more so, the performance levels achieved indicate the possibility to embed, in the low-cost experimental kits, more complex estimators using a sensor fusion approach to obtain roll angle estimations closer to the actual values based on Kalman filters or combining neural networks and Kalman filters.
According to previous discussion, the objectives stated for this research work consist of integrating roll angle estimators based on Linear and Unscented Kalman filters to evaluate the precision of the results obtained and determining the fulfillment of the hard real-time processing constraints to embed this kind of estimators in IoT architectures based on low-cost equipment able to be deployed in commercial vehicles and enrich the current roll stability control systems deployed in actual vehicles. In this sense, the novelty of this research is related to the evaluation of roll angle estimation using Kalman Filters embedded in an IoT architecture using low-cost sensors and devices in real time conditions. Raspberry Pi and Intel Edison low-cost systems were considered. The performance and accuracy of the estimations obtained in these two low-cost kits are compared. Even more, practical considerations and lessons learnt implementing these kinds of architectures are provided.
The sections in this article are organized as follows.
Section 2 presents the testbed designed for this research work, the hypothesis definition, the experiments specification including data gathering and analysis approach. This section also includes a discussion of the threats to validity associated to the experimental approach stated.
Section 3 presents the results regarding the precision and performance of the estimators provided. Finally,
Section 4, the discussion and conclusion of the results and the method are exposed.
2. Methodology
This section describes the experimental approach adopted to achieve the goals stated for this research work.
Section 2.1 describes the IoT testbed for roll angle estimation based on the application of Kalman Filter.
Section 2.2 enumerates the hypothesis to evaluate and the experiments defined for this purpose.
Section 2.3 introduces the data gathered during the experiments execution and the data analysis methods proposed to analyze the results obtained. Finally,
Section 4 summarizes the threats to validity related to this research work.
2.1. IoT Testbed for Roll Angle Estimation Based in Kalman Filter
The testbed designed for this research work was designed to be installed in any vehicle, but in the case of this research work, it was deployed in a Mercedes Sprinter van. This vehicle was considered because it is necessary to evaluate the accuracy of the estimations provided by the Kalman filters with the results presented in [
3].
The considered testbed was composed of three experimental kits:
A ground truth kit using a VBOX 3i GPS dual antenna data logger with an IMU (Inertial Measurement Unit) from Racelogic. This sensors provide the reference measurements (roll angle roll and yaw, longitudinal and lateral acceleration).
A first low-cost experimental kit based on an Intel Edison chipset having connected a SparkFun “9 Degrees of Freedom” module.
A second low-cost kit using a Raspberry Pi 3 Model B with a Inertial Measurement Unit Shield. The technical specifications of this hardware elements are shown in
Figure 1.
The testbed kit was deployed in a Mercedes Sprinter van. This deployment is shown in
Figure 2.
The considered testbed can be described using the levels of a typical IoT architecture [
17]: application, middleware, communication and perception layers. These layers are presented in the following sections and summarized in
Figure 3. The software components stated for each level are developed in C++ to optimize the performance as stated in [
14].
2.1.1. Application Layer
The application layer of this experimental kit is composed of a user interface that enables the experiments’ launch and finalization. This application uses the middleware functionality to send the requests to the kits integrated to execute the experiments with a full synchronization. Even more, it is in charge of storing the data sent from the ground truth and low-cost experimental kits in files in the CSV format.
2.1.2. Middleware Layer
The software components considered in this layer provide the functionality required to execute the experiment and obtain the resulting data in a synchronized way. It is essential to obtain the raw data required to analyze the performance and accuracy regarding the roll-angle estimations using different types of Kalman filters.
The middleware components are organized in different devices:
There is an Ecosystem Bus in charge of coordinating the experiments among all the experimental kits connected to the testbed. This Ecosystem Manager is deployed in a small computer able to be located in the experimental vehicle. This component provides the functionalities to connect and disconnect the experimental kits. Even more, it is in charge of sending requests to the low-cost kits to: (a) start an experiment; (b) continue running an experiment; (c) stop an experiment; and (d) shutdown an experimental kit. Finally, the ecosystem manager sends the data to the application layer in order to proceed to its storage.
The low cost experimental kits have their own middleware layer composed of two components:
- (a)
The Unit Bus is in charge of coordinating each experimental kits with the Ecosystem Manager that is in charge of coordinating the whole testbed. The functionalities provided by the Unit Bus are: (a) publish the experimental kit in the testbed; (b) receive the requests from the Ecosystem Bus; (c) send the data obtained by the kit sensors to the Ecosystem Bus; and (d) send to the sensors synchronizer the experiments start and stop signals for gathering appropriately the data from the sensors and roll angle estimators.
- (b)
The Sensors/Estimators Synchronizer obtains the data from the sensors and estimators with the required synchronization as it is shown in
Figure 4. This component sends to the Unit Bus the data structure with the information gathered during the experiment when it receives the stop signal.
The middleware considered for the ground truth kit (VBOX based) consists of a software component (named VBOX Manager) that provides the functionality to manage the start/stop signals received from the Ecosystem Manager. This component also sends the data gathered from during the experiment execution. Due to the restrictions introduced by VBOX and Racelogic IMU manufacturers, the middleware component for the ground truth experimental kit is implemented in C#.
2.1.3. Communication Layer
The communications layer has the responsibility to ensure homogeneous and synchronous communication among the kits included in the experimental testbed when the experiments are executed. This layer is implemented as follows:
Ground truth kit communications. The connection of the sensors and the laptop where the ground truth middleware is installed are connected using a cable due to the communication interfaces provided by the Racelogic IMU and VBOX Dual Antenna. The VBOX Manager and the Ecosystem manager are deployed in the same laptop.
Low-cost experimental kit communications. The low-cost experimental kits (based on Intel Edison and Raspberry Pi 3) are connected to the Ecosystem Manager using a WiFi connection through a wireless (802.11 g) access point. The connection between the sensors and the Sensors/Estimators Managers is implemented using the GPIO ports provided by the Intel Edison and Raspberry Pi development boards.
At logic level, the communications between the low-cost experimental kits and the laptop where the Ecosystem Manager is deployed are managed using TCP sockets.
2.1.4. Perception Layer
This level is composed of the sensors and estimators connected to each experimental kit in the testbed:
The sensors considered in each experimental kit are implemented in a different way. As mentioned before the ground truth kit uses a Racelogic IMU and VBOX Dual Antenna. The drivers are provided by the manufacturers and used by the middleware element implemented in the VBOX Manager component. In the case of the low-cost experimental kits, each sensor (accelerometer and gyroscope) is managed through a driver implemented in C++ and used by the component that is deployed in the Intel Edison and Raspberry Pi development boards. These drivers gather the information from the sensors hardware using 50 Hz sampling rate.
The Roll Angle Estimator implements Linear and Unscented Kalman Filters to estimate roll angle in real time using a two Degree of Freedom (DoF) which represents the vehicle roll motion. A description of this model is presented in [
35] and summarized in
Section 2.1.5. As observation measurements required for both Kalman filters, lateral acceleration, roll rate and time are considered.
Section 2.1.6 provides a more detailed description of this software component.
Finally, the NTP Client to assure the appropriate synchronization of the data gathered in the experimental kits included in the testbed, registers the actual date-time obtained from the GPS sensor in the hardware controller.
2.1.5. Vehicle Model
For a better understanding of this section and
Section 2.1.6,
Table 1 shows all the variables for the model and estimators presented in this work.
The model used in this research is presented in [
35]. This model describes the roll vehicle motion in a discrete-time system (see
Figure 5)
where:
The vehicle model constant values are presented in
Table 2.
2.1.6. Roll Angle Estimators based on Kalman Filters
Two different roll angle estimators based on Kalman filters were developed to achieve the research work defined:
First, a linear Kalman estimator was developed. This estimator has as inputs the actual roll rate, time and lateral acceleration. As result, the software component provides an estimated value of the current roll angle. The formulas implemented for the calculations are presented below [
10]:
- (a)
- (b)
Prediction of error covariance:
- (c)
- (d)
- (e)
Error covariance estimation:
In order to increase the performance required to fulfill hard real-time constraints, the software components embedded in low-cost devices have been optimized in the following way: (a) use temporary variables to store complex calculations that are used multiple times along the code without changing the values; (b) reduce the number of calculations when handling matrices by expanding and analyzing the values prone to change; and (c) optimize the memory and instantiation time by passing function arguments as reference instead of value copies.
Second, an Unscented Kalman estimator was designed. Similarly to the previous estimator the inputs are the actual roll rate, time and lateral acceleration. The formulas implemented for the calculations are shown below [
10]:
- (a)
Calculate weights:
where
is the distribution of the sampling points around the state mean,
,
is used to incorporate prior knowledge of the distribution of
,
n is the dimension of
, and
k is a scaling parameter:
is usually set to 0.
- (b)
- (c)
- (d)
Prediction of error covariance:
- (e)
Prediction of observations:
- (f)
- (g)
Cross correlation matrix:
- (h)
- (i)
Error covariance estimation:
- (j)
In this case, the Cholesky transform was implemented in a separate component due to enhance the reuse of this calculation in further research works. This estimated includes the same optimizations as the previous case, being more relevant due to the increased complexity of the calculations stated for Unscented Kalman Filters.
In this case, the values of Q and R are:
2.2. Experiments Specification
In order to evaluate the accuracy and performance of roll angle estimations provided by low-cost experimental kits, the following hypothesis were defined:
H1: The roll angle estimation based on linear and unscented Kalman filters are similar than the actual roll angle values directly measured from the ground kit.
H2: The performance of the roll angle estimation based on linear and unscented Kalman filters fulfills the constraints of hard real time processing providing, at least, results at a sampling rate of 50 Hz.
It was necessary to consider maneuvers such as regular driving situations, J-Turn and lane change to evaluate properly the previously stated hypothesis.
Figure 6 summarizes the experiments defined.
2.3. Data Processing
As defined in the experimental testbed, when the Stop experiment signal is invoked, the Ecosystem Manager stores the information gathered by each kit in a CSV file having a name that includes the execution date and time and experimental kit identifier. The information included in each file depends on the considered kit.
The ground truth provides the GPS coordinates where the measure is obtained, the measure time stamp, roll and yaw rate, longitudinal and lateral acceleration and the actual roll angle obtained from the VBOX dual antenna.
The low-cost experimental kits provide exactly the same value but the roll angle value corresponds to the data generated by the estimators based on linear and unscented Kalman filters.
The actual roll angle obtained from the ground truth kit was compared with the values calculated by the roll angle estimation based on linear and unscented Kalman filters to determine the accuracy of the values obtained from the estimators. The results obtained during the experiments execution are presented in
Section 3.
2.4. Threats to Validity
Several threats must be considered in order to determine the validity of the results obtained in this research work.
Regarding the experiments definition, it is necessary to consider all the issues preventing the experiments replication and the results generalization. The considered issues were related to:
The road conditions. The road considered in this research work has not slope or gradient. Nevertheless the maneuvers were repeated in different directions at the speed specified for each experiment.
The vehicle conditions. The threat in this category is related to the equipment conditions. Considering the recommendations provided in [
14], the Racelogic IMU and the low-cost sensors were located in the vehicle’s center of mass.
The type of sensors and controllers considered. The threat in this category is related to the representativeness of the sensors embedded in the low-cost experimental kits. Nevertheless, it is important to remark that all the sensors considered are available on the market and they have an average price and quality. It can be foreseen that the sensors performance will improve in the coming years, so the results from the experiments execution can be better in the short term.
Regarding the experiments implementation, it is necessary to consider the relevant issues to prevent the errors introduction due to incorrect experiments execution. The considered issues in this area were:
The lack of precision in the measures obtained from the low-cost kits. As indicated in [
14], the low-cost experimental kits provides data with the required precision. This precision is obtained when the corresponding calibrations are carried out in static conditions. Even more, to prevent errors from the specific sensors, two different units of each low-cost experimental kit type (Raspberry Pi and Intel Edison) were used.
The possible errors introduced by the sensor drivers and the middleware components considered in the IoT architecture designed to implement the experimental testbed. This threat was mitigated designing and implementing an automated unit testing plan to assure before the experiments execution, that these software components are free from critical bugs. The testing plan is automated executed before the deployment of the software components in the controller hardware in each low-cost experimental kit.
The possible errors in the execution of the maneuvers considered in each experiment. The mitigation of this threat consisted on the repetition of each experiment. Each maneuver was repeated, at least, three times.
4. Discussion
The results discussion is focused on the performance of the low-cost devices and the accuracy of the estimations obtained.
4.1. Accuracy
As expected, the roll angle estimations provided by the Unscented Kalman are better than the ones obtained using Linear Kalman. The RMS error for all the tests obtained by both estimators in comparison with the ground truth values are between 0.1 and 2.2 degrees. So, it can be concluded that the estimations are accurate enough for the expected use in RSC.
Nevertheless, it is necessary to remark that the results calculated by these estimators are less precise than the provided by Neural Network based estimators. However, Kalman based estimators do not need a previous training and are tight to an specific model allowing its direct usage in a variety of vehicles.
Also, it can be indicated that Kalman Filters based estimators are less sensitive to noise than Neural Networks based ones.
Finally, as future work, it is planned to create more complex estimators based on a combination of Neural Networks and Kalman Filters because the performance of software components implementing these techniques in low-cost devices seems to be high enough to support both of them respecting hard real time constraints.
4.2. Processing Capability
The temporal performance and real time constraints are main aspects to consider in order to integrate estimators and controllers in embedded low-cost devices. The results show that the processing time to get the data, execute its normalization, perform the roll angle estimation via ANN and the denormalization of the outcome, is four orders of magnitude lower than the required sample rate threshold of 20 ms.
The average processing times are 5.16 s (KF) and 51.83 s (UKF) for Intel Edison and 1.82 s (KF) and 28.64 s (UKF) for Raspberry Pi 3 Model B.
This performance will permit the integration of Neural Networks and Kalman filters to reduce the noise present in data gathered from low cost sensors.
Several optimizations were carried out to enhance this performance, essentially:
Usage of standard libraries from C++, which allow a straightforward compilation in almost any development board.
Reduction of the number of operations when handling matrices by expanding and analyzing the specific resulting values prone to change (algorithmic optimization).
Optimization of memory usage and instantiation time by passing function arguments as reference instead of value copies, and by multiple revisions of source code to keep it clean and simple.