\chapter{Results}

\section{Overview}

This chapter describes the sensor network tests and results.
For testing purposes, two sensors were fixed to the pedal setup from a standard game controller with thermal glue. One was fixed to the frame and the other to the accelerator pedal. The cable connections were also glued to prevent the detachment from the sensors.
The system was tested in two different situations. Static situations, which mean that the only acceleration experienced by the setup in gravity, and movement situations where the setup experiences other accelerations due to its motion.

\section{Static tests}

For the initial tests, data was collected independently from each sensor in static horizontal position fig(\ref{fig:setup_hor}) and processed by a MATLAB\textsuperscript{\scriptsize{\textregistered}} script that receives the data and displays it without scale conversion . The test results are shown in fig(\ref{fig:raw_static} \& \ref{fig:raw_static_gyro}).

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Static}\\
  \caption{Three axis raw data from accelerometer}\label{fig:raw_static}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Static_gyro}\\
  \caption{Two axis raw data from gyroscope}\label{fig:raw_static_gyro}
\end{figure}

For differential measurement tests the MATLAB\textsuperscript{\scriptsize{\textregistered}} script was adapted to receive data from two modules and the compute the angle between two 3D acceleration vectors as explained in section \ref{sec:math}. The results are shown in fig(\ref{fig:angle_static_horizontal}).

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{static_angle_hor}\\
  \caption{Differential angle measurement with the setup in horizontal position}\label{fig:angle_static_horizontal}
\end{figure}

Then, the accelerator pedal was pressed as shown in fig(\ref{fig:acc_pressed}) and the data from fig(\ref{fig:acc_pressed_data}) was collected.

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Setup_Hor_acc_pressed}\\
  \caption{Setup in horizontal position with accelerator pedal pressed}\label{fig:acc_pressed}
\end{figure}


\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{static_angle_hor_down}\\
  \caption{Differential angle measurement with the setup in horizontal position with accelerator pedal pressed}\label{fig:acc_pressed_data}
\end{figure}

To validate the differential approach to the problem, the setup was then positioned staticaly once again, but now in vertical position fig(\ref{fig:setup_vert}) and data shown in fig(\ref{fig:angle_static_Vertical}) was recorded.

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{static_angle_vert}\\
  \caption{Differential angle measurement with the setup in vertical position}\label{fig:angle_static_Vertical}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \subfloat[]{
    \includegraphics[width=0.4\textwidth]{Setup_hor}
    \label{fig:setup_hor}}
  \hfill
  \subfloat[]{
    \includegraphics[width=0.5\textwidth]{Setup_vert}
    \label{fig:setup_vert}}
  \caption{Setup in horizontal (a) and vertical(b) static test position}
\end{figure}

%don't forget to white the rotation speed given by the FANUC!!!! (see fanuc manual!)
To understand how the setup roll angle affects the measurement, the setup was attached to the FANUC M-6iB industrial robotic manipulator and rolled slowly to avoid other accelerations than the gravity. Both the roll and the measurement were registered as shown in fig(\ref{fig:angle_roll}). The gyroscope data collected during this experience is shown in figure \ref{fig:angle_roll_gyro}.

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.8\textwidth]{angle_roll}\\
  \caption{Pedal angle measurement versus setup roll}\label{fig:angle_roll}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.8\textwidth]{angle_roll_gyro}\\
  \caption{Gyroscope data for the slow setup roll test}\label{fig:angle_roll_gyro}
\end{figure}

\clearpage

\section{Movement tests}

For motion tests the setup was secured to one FANUC M-6iB industrial robotic manipulator to preform repeated movements capable of being executed afterwards when necessary fig(\ref{fig:Fanuc1} \& \ref{fig:Fanuc2}).
Several different movements were preformed at a linear speed of $250 mm/S$.

\begin{figure}[!h]
  % Requires \usepackage{graphicx}
  \centering
  \subfloat[]{
    \includegraphics[width=0.4\textwidth]{Fanuc1}
    \label{fig:Fanuc1}}
  \hfill
  \subfloat[]{
    \includegraphics[width=0.4\textwidth]{Fanuc2}
    \label{fig:Fanuc2}}
  \caption{Setup attached to FANUC M-6iB robot}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{fanuc1_data}\\
  \caption{Horizontal plane elliptical movement}\label{fig:fanuc1_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{fanuc1_data_gyro}\\
  \caption{Horizontal plane elliptical movement gyro data}\label{fig:fanuc1_data_gyro}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc2_data}\\
  \caption{Horizontal plane elliptical with setup roll movement}\label{fig:fanuc2_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc2_data_gyro}\\
  \caption{Horizontal plane elliptical with setup roll movement gyro data}\label{fig:fanuc2_data_gyro}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc3_data}\\
  \caption{Horizontal plane linear with setup roll movement}\label{fig:fanuc3_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc3_data_gyro}\\
  \caption{Horizontal plane linear with setup roll movement gyro data}\label{fig:fanuc3_data_gyro}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc4_data}\\
  \caption{X axis rotation movement}\label{fig:fanuc4_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc4_data_gyro}\\
  \caption{X axis rotation movement gyro data}\label{fig:fanuc4_data_gyro}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc5_data}\\
  \caption{X axis rotation and vertical translation movement}\label{fig:fanuc5_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc5_data_gyro}\\
  \caption{X axis rotation and vertical translation movement gyro data}\label{fig:fanuc5_data_gyro}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc7_data}\\
  \caption{Fast roll movement}\label{fig:fanuc7_data}
\end{figure}

\begin{figure}
  % Requires \usepackage{graphicx}
  \centering
  \includegraphics[width=0.7\textwidth]{Fanuc7_data_gyro}\\
  \caption{Fast roll movement gyro data}\label{fig:fanuc7_data_gyro}
\end{figure}

\clearpage

\section{Analysis of results}

From the data analysis the system accuracy while static is about 0.25° corresponding to 0.8\% of measuring range.
In static situations the difference between mean values are within standard deviation values so the differential measurement approach is validated.
Due to the actual angle computing method, the system is very sensitive to the setup roll angle as seen in figure \ref{fig:angle_roll}. If the setup is submitted to roll positions over $\pm$25° from gravity vector line the measured angle accuracy lowers to 10\%. 
When the setup is submitted to global movement, the standard deviation values increase significantly and minor changes are also noted in the mean value. This happens because the acceleration vector module is not the same to all the sensors, this fact voids the simplification used to obtain this differential measures.

After motion tests it became clear that such simplification was not valid and more complex dynamic laws have to be considered. The general movement law is complex to compute\cite{1033718} , however if the units share one parallel axis, which is also parallel to the pedal rotation axis, there may be the possibility to keep some simplifications on the system. As the geometry of the system is known and a reference unit can be used to compute the differences in the acceleration applied to the other sensors\cite{foxlin2000head}.
Having one parallel axis between units, rotation movements are most likely to cause different modules in the acceleration applied to each unit. Knowing the vector that links each unit origin with the reference, the angular velocity data from the gyroscopes $\omega$ can be used in equation \ref{eq:ac} to compute the expected difference in the acceleration between sensors, which will be used to correct the previous method.

\begin{equation}
    \label{eq:ac}
    a_{c}=\omega^{2}r
\end{equation}

After computing the difference in the centripetal acceleration between the reference and the sensor it will be subtracted to the sensor global acceleration and the result should have approximately the same modulus as the reference unit. If this method is successfully applied for global dynamics, but still fail if the pedal in in motion relative to the vehicle, which happens when the angular velocity measured by the reference is different from the one measured by the pedal sensor, more variable have to be considered. For this situation, the difference between angular velocities can be used with the vector that links the pedal rotation axis to the pedal sensor origin, to compute the acceleration caused by the relative movement, that will also be subtracted from the global acceleration measured by the pedal sensor.
This methods only consider centripetal acceleration. If after testing, this is not enough, the angular velocity measured by the gyroscopes can be derived to obtain the angular acceleration and compute the tangential acceleration, and therefore the global acceleration eq(\ref{eq:at2}) caused by the rotation movement.
With this updates, the system should be able to preform in most real situations experienced by any urban cruising car.

\begin{equation}
    \label{eq:atan1}
    a_{t}=\frac{\Delta v_{t}}{\Delta t}
\end{equation}

\begin{equation}
    \label{eq:atan2}
   a_{t}=r\frac{\Delta \omega_{t}}{\Delta t}=r\alpha
\end{equation}

\begin{equation}
    \label{eq:at}
    a_{total}=\sqrt{a_{c}^{2}+a_{t}^{2}}
\end{equation}

\begin{equation}
    \label{eq:at2}
   a_{total}=\sqrt{\omega^{4}r^{2}+\alpha^{2}r^{2}}
\end{equation}
