\RequirePackage{flashmovie}
\documentclass[utf8x]{beamer}
%----------E-TEX PACKAGE TO SOLVE REGISTERS PROBLEMS:---------------
\usepackage{etex}
%-------------------------------------------------------------------
%----------TO THE VIDEOS:-------------------------------------------
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
%-------------------------------------------------------------------
%----------PRESENTATION COLOR SCHEME: ------------------------------
\mode<presentation>
{
  \usetheme{Antibes}
  \usecolortheme{beaver}
  \setbeamercovered{transparent}
}
%-------------------------------------------------------------------
%----------LANGUAGE AND FONT SPECIFICATIONS: -----------------------
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
%-------------------------------------------------------------------
%----------MULTIROW TABLE: -----------------------------------------
\usepackage{multirow}
%-------------------------------------------------------------------
%----------TIKZ PACKAGES: ------------------------------------------
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{scopes}
\usetikzlibrary{shapes,arrows}
%-------------------------------------------------------------------
%----------ENUMERATE PACKAGE: --------------------------------------
\usepackage{enumerate}
%-------------------------------------------------------------------
%----------TITLE OF THE PRESENTATION: ------------------------------
\title{Automatic Management System for the AtlasCar Gearbox}
%-------------------------------------------------------------------
%----------NAME OF THE AUTHOR: -------------------------------------
\author{Pedro Filipe Pinto Pinheiro}
%-------------------------------------------------------------------
%----------NAME OF THE INSTITUTION: --------------------------------
\institute[University]
{
  Department of Mechanical Engineering\\
  University of Aveiro
}
%-------------------------------------------------------------------
%----------SUBJECT (OPTIONAL): -------------------------------------
\subject{Electronic and Mechanical Engineering}
%-------------------------------------------------------------------
%----------LOGO DEFINITION: ----------------------------------------
\pgfdeclareimage[height=0.7cm]{university-logo}{uaLogoNew.pdf}
\logo{\pgfuseimage{university-logo}}
%-------------------------------------------------------------------
%----------TABLE OF CONTENTS DEFFINITION: --------------------------
% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%\AtBeginSubsection[]
%{
%  \begin{frame}<beamer>
%    \frametitle{Outline}
%    \tableofcontents[currentsection,currentsubsection]
%  \end{frame}
%}
%-------------------------------------------------------------------
%----------SETS TO THE BEAMER COLOR SCHEME: ------------------------
\definecolor{usedred}{RGB}{163,0,0}
\setbeamercolor{item projected}{fg=white}
\setbeamercolor*{item}{fg=usedred}
\setbeamercolor{title}{fg=usedred}
\setbeamercovered{invisible}
%-------------------------------------------------------------------
%----------SETS TO THE BEAMER TEMPLATE USED: -----------------------
\setbeamertemplate{itemize subitem}{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}
\setbeamertemplate{itemize subsubitem}{$\star$}
%-------------------------------------------------------------------
%----------START OF THE DOCUMENT: -----------------------
\begin{document}
% Title Page:
\begin{frame}
  \titlepage
\end{frame}
% Table of Contents:
%\begin{frame}
%  \frametitle{Outline}
%  \tableofcontents
%\end{frame}
%############
%           #
%  SECTION  #
%           #
%###############
% INTRODUCTION #
%###############
\section{Introduction}
%###############
%              #
%  SUBSECTION  #
%              #
%####################
% THE ATLAS PROJECT #
%####################
\subsection{The Atlas Project}
%##### FRAME 1 #####
\begin{frame}
  \frametitle{The Atlas Project (2003 - Present)}
  \begin{columns}
  \begin{column}[c]{5cm}
  \begin{itemize}
  	\item Advanced Driver Assistance Systems (ADAS);
  	\item Safety Systems Development;
  	\item Acquisition of sensory data;
  	\item Autonomous Navigation.
  \end{itemize}
  \end{column}
  \begin{column}[c]{5cm}
  	\begin{figure}
    \includegraphics[scale=0.21]{Images/atlascar1.pdf}
    \label{figurelabel}
    \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%###############
%              #
%  SUBSECTION  #
%              #
%#########################
% THE ATLASCAR ACTUATORS #
%#########################
\subsection{The AtlasCar Actuators}
%##### FRAME 2 #####
\begin{frame}
  \frametitle{The AtlasCar Actuators}
  \begin{itemize}
  	\item Throttle;
  	\item Brake pedal;
  	\item Clutch pedal;
  	\item Handbrake;
  	\item Ignition;
  	\item Steering;
  	\item Lights.
  \end{itemize}
\end{frame}
%###############
%              #
%  SUBSECTION  #
%              #
%###############
% THE PROBLEM #
%##############
\subsection{The Problem}
%##### FRAME 3 #####
\begin{frame}
  \frametitle{The Problem}
  \begin{center}
  	What about the gearbox?
  \end{center}
  \begin{figure}
  \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=8.7cm]{Images/MECHANISM_TOP_AND_BOTTOM.pdf}};
    \pause
    % Ring LEFT:
    \draw[red,ultra thick,rounded corners] (2.1,3.2) rectangle (2.8,3.95);
    % Ring RIGHT:
    \draw[red,ultra thick,rounded corners] (5.9,2.85) rectangle (6.8,3.7);
    \pause
    % Motor 1:
    \draw[green,ultra thick,rounded corners] (-0.07,1.75) rectangle (2,3.2);
    % Motor 2:
    \draw[green,ultra thick,rounded corners] (2.9,0) rectangle (4.6,2);
    % Potentiometer Y:
    \pause
    \draw[blue,ultra thick,rounded corners] (0.1,1.05) rectangle (0.9,1.65);
    % Potenciometer X:
    \draw[blue,ultra thick,rounded corners] (6.9,4.5) rectangle (7.9,5.3);
  \end{tikzpicture}
  \end{figure}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%#############
% OBJECTIVES #
%#############
\section{Objectives}
%##### FRAME 4 #####
\begin{frame}
  \frametitle{Objectives}
  \begin{itemize}
  	\item Slight changes on the mechanical system;
  	\item Development of a control PCB;
  	\item Controller firmware programming;
  	\item Robust communication messaging system;
  	\item System simulation and laboratory tests.
  \end{itemize}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%######################
% DC MOTOR CONTROLLER #
%######################
\section{DC Motor Controller}
%##### FRAME 5 #####
\begin{frame}
  \frametitle{The \textit{Arduino} UNO}
  \begin{columns}
  \begin{column}[c]{5cm}
  \begin{itemize}
    \item Open-source;
    \item Flexible and robust;
    \item C++ similar language;
    \item Modularity.
  \end{itemize}
  \end{column}
  \begin{column}[c]{5cm}
  \begin{figure}
    \includegraphics[scale=0.07]{Images/ArduinoUno_Front.pdf}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 6 #####
\begin{frame}
  \frametitle{\textit{Arduino} DC Motor Controller Tasks:}
  \begin{figure}
    \includegraphics[scale=0.2]{Images/system_diagram.pdf}
  \end{figure}
\end{frame}
%##### FRAME 7 #####
\begin{frame}
  \frametitle{The Power Controller}
  \begin{itemize}
	\item H-bridge IC VNH3SP30-E;
	\begin{itemize}
	  \item 12 V;
	  \item 20 A.
	\end{itemize}
	\item Coded Inputs.
  \end{itemize}
  \begin{columns}
  \begin{column}[c]{3cm}
  \begin{figure}
  \includegraphics[scale=0.15]{Images/VNH_TOP.pdf}\\
  Top View
  \end{figure}
  \end{column}
  \begin{column}[c]{3cm}
  \begin{figure}
  \includegraphics[scale=0.15]{Images/VNH_BOTTOM.pdf}\\
  Bottom View
  \end{figure}
  \end{column}
  \begin{column}[c]{3cm}
  \begin{figure}
  \includegraphics[scale=0.4]{Images/4555decoder.pdf}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 8 #####
\begin{frame}
  \frametitle{Multi-turn Potentiometers and MAN/AUTO Switches}
  \begin{columns}
  \begin{column}[l]{6.8cm}
  Multi-turn Potentiometers:
  \begin{itemize}
    \item 3 Turns;
    \item Mechanically coupled to the shafts;
    \item Analogue variable voltage output;
  \end{itemize}
  \end{column}
  \begin{column}[l]{3cm}
  \begin{figure}
  \includegraphics[scale=0.7]{Images/multiturn_pot.pdf}
  \end{figure}
  \end{column}
  \end{columns}
  \begin{columns}[l]
  \begin{column}[l]{6cm}
  MAN/AUTO Switch:
  \begin{itemize}
    \item 3 Buttons;
    \begin{itemize}
      \item Shift Up;
      \item Shift Down;
      \item Switch Mode.
    \end{itemize}
  \end{itemize}
  \end{column}
  \begin{column}[l]{3cm}
  \begin{figure}
  \includegraphics[scale=0.1]{Images/gear_pad_no_letters.pdf}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 9 #####
\begin{frame}
  \frametitle{Seven Segment Display}
  \begin{columns}
  \begin{column}[l]{6.3cm}
  \begin{itemize}
    \item BCD to 7-Segment Driver;
    \item Control 8 digits using only 3 bits;
  \end{itemize}
  \vspace{0.5cm}
  \begin{figure}
    \includegraphics[scale=0.17]{Images/7_seg.pdf}
  \end{figure}
  \end{column}
  \begin{column}[c]{5cm}
  \begin{figure}
  \includegraphics[scale=0.115]{Images/7_Segment_Display.pdf}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 10 #####
\begin{frame}
  \frametitle{PCB Development}
  \vspace{-0.5cm}
  \begin{figure}
  \includegraphics[scale=0.13]{Images/VNH_MOTOR_CONTROL.pdf}
  \end{figure}
  \vspace{-0.5cm}
  \begin{columns}
  \begin{column}[c]{.3\textwidth}
  \begin{figure}
  \includegraphics[scale=0.16]{Images/TOP_LAYER.pdf}\\
  \small{Top Layer}
  \end{figure}
  \end{column}
  \begin{column}[c]{.3\textwidth}
  \begin{figure}
  \includegraphics[scale=0.19]{Images/BOTTOM_LAYER.pdf}\\
  \small{Bottom Layer}
  \end{figure}
  \end{column}
  \begin{column}[c]{.3\textwidth}
  \begin{figure}
  \includegraphics[scale=0.14]{Images/PCB_3D_MODEL.pdf}\\
  \small{3D Model}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 11 #####
\begin{frame}
  \frametitle{Final Controller}
  \begin{figure}
  \includegraphics[scale=0.127]{Images/pcb_soldered.pdf}
  \end{figure}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%#######################
% FIRMWARE PROGRAMMING #
%#######################
\section{Firmware Programming}
%##### FRAME 12 #####
\begin{frame}
  \frametitle{Firmware Programming}
  Arduino's two main cycles:
  \begin{itemize}
    \item The Setup Cycle:
    \begin{itemize}
      \item Start communication settings;
      \item Define pin functions;
      \item Reset the mechanism.
    \end{itemize}
    \item The Loop Cycle:
    \begin{itemize}
      \item MAN/AUTO Modes;
      \item 7-Segment Control;
      \item DC Motor Management.
    \end{itemize}
  \end{itemize}
\end{frame}
%###############
%              #
%  SUBSECTION  #
%              #
%##################
% The Setup Cycle #
%##################
\subsection{The Setup Cycle}
%##### FRAME 13 #####
\begin{frame}
  \frametitle{The Setup Cycle}
  % Define block styles
  \tikzstyle{decision} = [diamond, draw, fill=white, text width=3.5em, text badly centered, node distance=2cm, inner sep=1pt]
  \tikzstyle{block} = [rectangle, draw, fill=white, text width=8em, text centered, minimum height=2em,node distance=2cm]
  \tikzstyle{line} = [draw, -latex']
  \begin{figure}
  \tiny
  \begin{tikzpicture}[scale=0.05]
    % Place nodes:
    \node [block,rounded corners=1mm] (init) {Arduino Reset};
    \node [block, right of=init, node distance=2.5cm] (pin_definition) {Pin Definition};
    \node [block, right of=pin_definition, node distance=2.5cm] (start_ethernet) {Start Ethernet};
    \node [block, below of=start_ethernet, node distance=1cm] (read_vertical) {Read Vertical Potentiometer Value};
    \node [block, below of=read_vertical, node distance=1cm] (move_vertical) {Move Vertical DC Motor};
    \node [decision, right of=move_vertical] (check_1) {Vert. Centered?};
    \node [block, below of=check_1, node distance=1.5cm] (read_horizontal) {Read Horizontal Potentiometer Value};
    \node [block, below of=read_horizontal, node distance=1cm] (move_horizontal) {Move Horizontal DC Motor};
    \node [decision, right of=move_horizontal] (check_2) {Horiz. Centered?};
    \node [block, rounded corners=1mm, below of=check_2, node distance=1.3cm] (loop) {Enter Loop};
    % Place Lines:
    \path [line] (init) -- (pin_definition);
    \path [line] (pin_definition) -- (start_ethernet);
    \path [line] (start_ethernet) -- (read_vertical);
    \path [line] (read_vertical) -- (move_vertical);
    \path [line] (move_vertical) -- (check_1);
    \path [line] (check_1) |- node [near start] {\ \ \ \ \ \ No} (read_vertical);
    \path [line] (check_1) -- node {\ \ \ \ \ \ \ Yes} (read_horizontal);
    \path [line] (read_horizontal) -- (move_horizontal);
    \path [line] (move_horizontal) -- (check_2);
    \path [line] (check_2) |- node [near start] {\ \ \ \ \ \ No} (read_horizontal);
    \path [line] (check_2) -- node {\ \ \ \ \ \ \ Yes} (loop);
  \end{tikzpicture}
  \end{figure}
\end{frame}
%###############
%              #
%  SUBSECTION  #
%              #
%#################
% The Loop Cycle #
%#################
\subsection{The Loop Cycle}
%##### FRAME 14 #####
\begin{frame}
  \frametitle{The Loop Cycle}
  \begin{columns}
  \begin{column}[c]{4cm}
  \begin{figure}
  \begin{tikzpicture}[scale=0.7,line width=3pt]]
  % Define the points:
  \path (0,0) node (P0_2) {$N$};
  \path (-2cm,0) node (P0_1) {$N$};
  \path (2cm,0) node (P0_3) {$N$};
  \path (-2cm,2cm) node (P1) {$1^{st}$};
  \path (-2cm,-2cm) node (P2) {$2^{nd}$};
  \path (0cm,2cm) node (P3) {$3^{rd}$};
  \path (0cm,-2cm) node (P4) {$4^{th}$};
  \path (2cm,2cm) node (P5) {$5^{th}$};
  \path (2cm,-2cm) node (PR) {$R$};
  % Draw the system
  \draw (P0_1) -- (P0_2) -- (P0_3);
  \draw (P1) -- (P0_1) -- (P2);
  \draw (P3) -- (P0_2) -- (P4);
  \draw (P5) -- (P0_3) -- (PR);
  \end{tikzpicture}
  \end{figure}
  \vspace{-0.3cm}
  \ \ \ Gearbox H-Pattern
  \end{column}
  \begin{column}[c]{6cm}
    \begin{itemize}
    \item Coexistence of Manual and Automatic modes;
    \item Sequential and non-sequential operation;
    \item Shortest path between two gear positions.
    \end{itemize}
  \end{column}
  \end{columns}
  \vspace{0.4cm}
  \begin{center}
  \pause
  {\huge Dijkstra's algorithm}
  \end{center}
\end{frame}  
%##### FRAME 15 #####
\begin{frame}
  \begin{columns}
  \begin{column}[c]{4cm}
  \begin{figure}
  \begin{tikzpicture}[scale=0.7,line width=3pt]
  %\tikzstyle{every node}=[shape=circle (1cm)]
  \path (0,0) node (P0_2) {$5$} ;
  \path (-2cm,0) node (P0_1) {$4$};
  \path (2cm,0) node (P0_3) {$6$};
  \path (-2cm,2cm) node (P1) {$1$};
  \path (-2cm,-2cm) node (P2) {$7$};
  \path (0cm,2cm) node (P3) {$2$};
  \path (0cm,-2cm) node (P4) {$8$};
  \path (2cm,2cm) node (P5) {$3$};
  \path (2cm,-2cm) node (PR) {$9$};
  % Draw the system
  \draw (P0_1) -- (P0_2) -- (P0_3);
  \draw (P1) -- (P0_1) -- (P2);
  \draw (P3) -- (P0_2) -- (P4);
  \draw (P5) -- (P0_3) -- (PR);
  \end{tikzpicture}
  Point Numbering
  \end{figure}
  \end{column}
  \begin{column}[c]{4cm}
  \begin{figure}
  \begin{tikzpicture}[scale=0.25]
  %\tikzstyle{every node}=[draw,shape=circle]
  \coordinate (c1) at (0:0cm);
  \coordinate (c4) at ($(c1)+(0:4cm)$);
  \coordinate (c5) at ($(c4)+(60:4cm)$);
  \coordinate (c7) at ($(c4)+(-60:4cm)$);
  \coordinate (c2) at ($(c5)+(60:4cm)$);
  \coordinate (c6) at ($(c5)+(0:4cm)$);
  \coordinate (c8) at ($(c5)+(-60:4cm)$);
  \coordinate (c3) at ($(c6)+(40:4cm)$);
  \coordinate (c9) at ($(c6)+(-40:4cm)$);
  % Nodos:
  \node[draw,shape=circle] (n1) at (c1) {1};
  \node[draw,shape=circle] (n4) at (c4) {4};
  \node[draw,shape=circle] (n5) at (c5) {5};
  \node[draw,shape=circle] (n7) at (c7) {7};
  \node[draw,shape=circle] (n2) at (c2) {2};
  \node[draw,shape=circle] (n6) at (c6) {6};
  \node[draw,shape=circle] (n8) at (c8) {8};
  \node[draw,shape=circle] (n3) at (c3) {3};
  \node[draw,shape=circle] (n9) at (c9) {9};
  % Desenho:
  \draw (n1) -- node [above]{{\tiny V}} (n4);
  \draw (n4) -- node [above left]{{\tiny H}} (n5);
  \draw (n4) -- node [right]{{\tiny V}} (n7);
  \draw (n5) -- node [above left]{{\tiny V}} (n2);
  \draw (n5) -- node [above]{{\tiny H}} (n6);
  \draw (n5) -- node [right]{{\tiny V}} (n8);
  \draw (n6) -- node [above left]{{\tiny V}} (n3);
  \draw (n6) -- node [above right]{{\tiny V}} (n9);
  \end{tikzpicture}
  Representative Graph
  \end{figure}
  \end{column}
  \end{columns}
  \begin{center}
  \footnotesize
  $
  M = \begin{bmatrix}
  5 & 5 & 5 & 1 & 5 & 5 & 5 & 5 & 5\\
  5 & 5 & 5 & 5 & 1 & 5 & 5 & 5 & 5\\
  5 & 5 & 5 & 5 & 5 & 1 & 5 & 5 & 5\\
  1 & 5 & 5 & 5 & 0 & 5 & 1 & 5 & 5\\
  5 & 1 & 5 & 0 & 5 & 0 & 5 & 1 & 5\\
  5 & 5 & 1 & 5 & 0 & 5 & 5 & 5 & 1\\
  5 & 5 & 5 & 1 & 5 & 5 & 5 & 5 & 5\\
  5 & 5 & 5 & 5 & 1 & 5 & 5 & 5 & 5\\
  5 & 5 & 5 & 5 & 5 & 1 & 5 & 5 & 5
  \end{bmatrix}
  $
  \end{center}
\end{frame}
%##### FRAME 16 #####
\begin{frame}
  \frametitle{The Loop Cycle - Shifting from $1^{st}$ to $R$}
  \begin{columns}
  \begin{column}[c]{4cm}
  \begin{figure}
  \begin{tikzpicture}[scale=0.7,line width=3pt]
  \path (0,0) node (P0_2) {$5$} ;
  \path (-2cm,0) node (P0_1) {$4$};
  \path (2cm,0) node (P0_3) {$6$};
  \path (-2cm,2cm) node (P1) {$1$};
  \path (-2cm,-2cm) node (P2) {$7$};
  \path (0cm,2cm) node (P3) {$2$};
  \path (0cm,-2cm) node (P4) {$8$};
  \path (2cm,2cm) node (P5) {$3$};
  \path (2cm,-2cm) node (PR) {$9$};
  % Draw the system:
  \draw (P0_1) -- (P0_2) -- (P0_3);
  \draw (P1) -- (P0_1) -- (P2);
  \draw (P3) -- (P0_2) -- (P4);
  \draw (P5) -- (P0_3) -- (PR);
  % Animation:
  \uncover<3->
  {
  \draw [color=red] (P1) -- (P0_1);
  }
  \uncover<4->
  {
  \draw [color=red] (P0_1) -- (P0_2);
  }
  \uncover<5->
  {
  \draw [color=red] (P0_2) -- (P0_3);
  }
  \uncover<6->
  {
  \draw [color=red] (P0_3) -- (PR);
  }
  \end{tikzpicture}
  \end{figure}
  \end{column}
  \begin{column}[c]{4cm}
  \begin{figure}
  \begin{tikzpicture}[scale=0.3]
  %\tikzstyle{every node}=[draw,shape=circle]
  \coordinate (c1) at (0:0cm);
  \coordinate (c4) at ($(c1)+(0:4cm)$);
  \coordinate (c5) at ($(c4)+(60:4cm)$);
  \coordinate (c7) at ($(c4)+(-60:4cm)$);
  \coordinate (c2) at ($(c5)+(60:4cm)$);
  \coordinate (c6) at ($(c5)+(0:4cm)$);
  \coordinate (c8) at ($(c5)+(-60:4cm)$);
  \coordinate (c3) at ($(c6)+(40:4cm)$);
  \coordinate (c9) at ($(c6)+(-40:4cm)$);
  % Nodos:
  \node[draw,shape=circle] (n1) at (c1) {1};
  \node[draw,shape=circle] (n4) at (c4) {4};
  \node[draw,shape=circle] (n5) at (c5) {5};
  \node[draw,shape=circle] (n7) at (c7) {7};
  \node[draw,shape=circle] (n2) at (c2) {2};
  \node[draw,shape=circle] (n6) at (c6) {6};
  \node[draw,shape=circle] (n8) at (c8) {8};
  \node[draw,shape=circle] (n3) at (c3) {3};
  \node[draw,shape=circle] (n9) at (c9) {9};
  % Desenho:
  \draw (n1) -- node [above]{{\tiny V}} (n4);
  \draw (n4) -- node [above left]{{\tiny H}} (n5);
  \draw (n4) -- node [right]{{\tiny V}} (n7);
  \draw (n5) -- node [above left]{{\tiny V}} (n2);
  \draw (n5) -- node [above]{{\tiny H}} (n6);
  \draw (n5) -- node [right]{{\tiny V}} (n8);
  \draw (n6) -- node [above left]{{\tiny V}} (n3);
  \draw (n6) -- node [above right]{{\tiny V}} (n9);
  % Animação:
  \pause
  \node[draw,shape=circle,color=red,line width=4pt] (n1) at (c1) {1};
  \pause
  \draw[color=red,line width=4pt] (n1) -- (n4);
  \node[draw,shape=circle,color=red,line width=4pt] (n4) at (c4) {4};
  \pause
  \draw[color=red,line width=4pt] (n4) -- (n5);
  \node[draw,shape=circle,color=red,line width=4pt] (n5) at (c5) {5};
  \pause
  \draw[color=red,line width=4pt] (n5) -- (n6);
  \node[draw,shape=circle,color=red,line width=4pt] (n6) at (c6) {6};
  \pause
  \draw[color=red,line width=4pt] (n6) -- (n9);
  \node[draw,shape=circle,color=red,line width=4pt] (n9) at (c9) {9};
  \end{tikzpicture}
  \end{figure}
  \end{column}
  \end{columns}
  \vspace{0.2cm}
  \begin{figure}
  % Define block styles
  \tikzstyle{decision} = [diamond, draw, fill=white, text width=3.5em, text badly centered, node distance=2cm, inner sep=1pt]
  \tikzstyle{block} = [rectangle, draw, fill=white, text width=4em, text centered, minimum height=2em,node distance=2cm]
  \tikzstyle{block_dashed} = [rectangle, draw, dashed, fill=white, text width=3em, text centered, minimum height=2em,node distance=2cm]
  \tikzstyle{line} = [draw, -latex']
  \scriptsize
  \begin{tikzpicture}[scale=0.3]
    % Place nodes:
    \uncover<2->
    {
    \node [block_dashed] (stopped_1) {Stop};
    }
    \uncover<3->
    {
    \node [block,right of=stopped_1, node distance=1.7cm] (move_vertical_1) {Move Vert.};
    \node [block_dashed, right of=move_vertical_1, node distance=1.7cm] (stopped_2) {Stop};
    }
    \uncover<4->
    {
    \node [block, right of=stopped_2, node distance=1.7cm] (move_horizontal) {Move Horiz.};
    }
    \uncover<5->
    {
    \node [block_dashed, right of=move_horizontal, node distance=1.7cm] (stopped_3) {Stop};
    }
    \uncover<6->
    {
    \node [block,right of=stopped_3, node distance=1.7cm] (move_vertical_2) {Move Vert.};
    \node [block_dashed, right of=move_vertical_2, node distance=1.7cm] (stopped_4) {Stop};
    }
    % Place Lines:
    \uncover<3->
    {
    \path [line] (stopped_1) -- node [above]{{\tiny acc.}} (move_vertical_1);
    \path [line] (move_vertical_1) -- node [above]{{\tiny dec.}} (stopped_2);
    }
    \uncover<4->
    {
    \path [line] (stopped_2) -- node [above]{{\tiny acc.}} (move_horizontal);
    }
    \uncover<5->
    {
    \path [line] (move_horizontal) -- node [above]{{\tiny dec.}} (stopped_3);
    }
    \uncover<6->
    {
    \path [line] (stopped_3) -- node [above]{{\tiny acc.}} (move_vertical_2);
    \path [line] (move_vertical_2) -- node [above]{{\tiny dec.}} (stopped_4);
    }
  \end{tikzpicture}
  \end{figure}
\end{frame}
%##### FRAME 17 #####
\begin{frame}
  \frametitle{Resulting in...}
    \begin{textblock}{5}(20,22.5)
    \flashmovie[auto=1,loop=1,controlbar=1,engine=jw-player,width=9cm,height=6.5cm]{Movies/test_2.flv}
  \end{textblock}
\end{frame}
%##### FRAME 18 #####
\begin{frame}
  \frametitle{Communication Protocol}
  \begin{columns}
  \begin{column}[c]{7cm}
  Ethernet Cable and TCP/IP.
  \vspace{0.2cm}
  \begin{itemize}
  \item PC $\rightarrow$ \textit{Arduino}:
  \begin{itemize}
    \item Set Command;
    \item Get Command.
  \end{itemize}
  \item \textit{Arduino} $\rightarrow$ PC:
  \begin{itemize}
    \item Answer to Set Command:
    \begin{itemize}
      \item Invalid Gear ;
      \item Manual Mode;
      \item Gear OK.
    \end{itemize}
    \item Answer to Get Command:
    \begin{itemize}
      \item Changing from ... to ...;
      \item Current Gear;
    \end{itemize}
    \item Unrecognised Command.
  \end{itemize}
  \end{itemize}
  \end{column}
  \begin{column}[c]{5cm}
  \vspace{-1cm}
  \begin{figure}
  \includegraphics[scale=0.05]{Images/ArduinoEthernetShield_R3_Front.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    \textit{Arduino} Ethernet Shield
  \end{center}
  \vspace{-0.5cm}
  \begin{figure}
  \includegraphics[scale=0.35]{Images/ArduinoEthernetFront.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    \textit{Arduino} Ethernet
  \end{center}
  \end{column}
  \end{columns}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%#################################
% HARDWARE-IN-THE-LOOP SIMULATOR #
%#################################
\section{Hardware-in-the-Loop Simulator}
%###############
%              #
%  SUBSECTION  #
%              #
%######################
% Simulator Structure #
%######################
\subsection{Simulator Structure}
%##### FRAME 19 #####
\begin{frame}
  \frametitle{Hardware-in-the-Loop Simulator Structure}
  % Define block styles:
  \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=10em, text centered, minimum height=2em,node distance=2cm]
  \tikzstyle{hardware_block} = [rectangle, draw, fill=red!20, text width=10em, text centered, minimum height=2em,node distance=2cm]
  \tikzstyle{line} = [draw, -latex']
  \begin{figure}
  \tiny
  \begin{tikzpicture}[scale=0.05]
    % Place nodes:
    \node [block] (data_acquisition) {\footnotesize Data \\ acquisition};
    \node [above of=data_acquisition, node distance=1cm] (virtual_node_up) {\large COMPUTER};
    \node [right of=virtual_node_up, node distance=2cm] (virtual_node_up_right) {};
    \node [right of=virtual_node_up_right, node distance=2cm] (virtual_node_up_right_2) {\large HARDWARE};
    \node [block, below of=data_acquisition, node distance=1.2cm] (physics_calculations) {\footnotesize Physics \\ Calculations};
    \node [block, below of=physics_calculations, node distance=1.2cm] (determining_the_gear) {\footnotesize Determining the Gear};
    \node [below of=determining_the_gear, node distance=1cm] (virtual_node_1) {};
    \node [hardware_block, right of=virtual_node_1, node distance=4cm] (hardware) {\footnotesize Gear Selector Mechanism};
    \node [block, below of=virtual_node_1, node distance=1cm] (plot_update) {\footnotesize Plot Update};
    \node [left of=plot_update, node distance=2cm] (virtual_node_2) {};
    \node [below of=plot_update, node distance=1cm] (virtual_node_down){};
    \node [right of=virtual_node_down, node distance=2cm] (virtual_node_down_right) {};
    % Place Lines:
    \path [line] (data_acquisition) -- (physics_calculations);
    \path [line] (physics_calculations) -- (determining_the_gear);
    \path [line] (determining_the_gear) -| (hardware);
    \path [line] (hardware) |- (plot_update);
    \draw (plot_update) -- (virtual_node_2.center);
    \path [line] (virtual_node_2.center) |- (data_acquisition);
    \draw[dashed] (virtual_node_up_right.center) -- (virtual_node_down_right.center);
  \end{tikzpicture}
  \end{figure}
\end{frame}
%###############
%              #
%  SUBSECTION  #
%              #
%######################
% Simulator Structure #
%######################
\subsection{Vehicle Physics}
%##### FRAME 20 #####
\begin{frame}[fragile]
  \frametitle{Vehicle Physics}
  Main forces acting on the Vehicle:
  \vspace{0.2cm}
  \begin{columns}
  \begin{column}[c]{6cm}
  \begin{itemize}
  \item Engine Force ($F_{eng}$);
  \item Drag Force ($F_{drag}$);
  \item Force of Gravity ($F_{g}$);
  \item Rolling Resistance \\ Force ($F_{rr}$);
  \item Braking Force ($F_{b}$).
  \end{itemize}
  \end{column}
  \hspace{-1cm}
  \begin{column}[l]{7cm}
  \begin{figure}
  \def\iangle{30} % Angle of the inclined plane
  \def\down{-90}
  \def\arcr{5mm} % Radius of the arc used to indicate angles
  \begin{tikzpicture}[
  force/.style={>=latex,draw=blue,fill=blue},
  axis/.style={densely dashed,gray,font=\small},
  M/.style={rectangle,draw,fill=lightgray,minimum size=5mm,thin},
  m/.style={rectangle,draw=black,fill=lightgray,minimum size=3mm,thin},
  plane/.style={draw=black,fill=blue!10},
  string/.style={draw=red, thick},
  pulley/.style={thick},
  ]
  \matrix[column sep=6mm]{
  %% Sketch
    \draw[plane] (0,-1) coordinate (base)
                     -- coordinate[pos=0.5] (mid) ++(\iangle:3) coordinate (top)
                     |- (base) -- cycle;
    \newdimen\mydimx
    \newdimen\mydimy
    
    \path (mid) node[M,rotate=\iangle,yshift=2.5mm] (M) {};
    
    \pgfextractx{\mydimx}{M.center};
	\pgfextracty{\mydimy}{M.center};
	
    % Draws the Center of Mass:
    
    \draw[thick] (M.center) circle(1mm);
    \fill[black] (M.center) -- (\mydimx+1mm,\mydimy) arc (0:90:1mm) -- (M.center) -- cycle;
    \fill[black] (M.center) -- (\mydimx-1mm,\mydimy) arc (0:90:-1mm) -- (M.center) -- cycle;
    
    %arc (0:-90:1mm) -- (M.center) -- cycle    
    
    \draw[->] (base)++(\arcr,0) arc (0:\iangle:\arcr);
    \path (base)++(\iangle*0.5:\arcr+5pt) node {$\alpha$};
    &
    %% Free body diagram of M
    \begin{scope}[rotate=\iangle]
        \node[M,transform shape] (M) {};
        % Draw axes and help lines
        {[axis,->]
            \draw (0,-1) -- (0,2) node[right] {$+y$};
            \draw (M) -- ++(2,0) node[right] {$+x$};
            % Indicate angle. The code is a bit awkward.
            \draw[solid,shorten >=0.5pt] (\down-\iangle:\arcr)
                arc(\down-\iangle:\down:\arcr);
            \node at (\down-0.5*\iangle:1.3*\arcr) {$\alpha$};
        }
        % Forces
        { [force,->]
            % Assuming that Mg = 1. The normal force will therefore be cos(alpha)
            \draw (M.center) -- ++(0,{cos(\iangle)}) node[above right] {$N$};
            \draw (M.west) -- ++(-1,0) node[left] {$F_{b}$};
            \draw (M.north west) -- ++(-1,0) node[above left] {$F_{rr}$};
            \draw (M.south west) -- ++(-1,0) node[below left] {$F_{drag}$};
            \draw (M.east) -- ++(1,0) node[above] {$F_{eng}$};
        }
    \end{scope}
    % Draw gravity force. The code is put outside the rotated
    % scope for simplicity. No need to do any angle calculations. 
    \draw[force,->] (M.center) -- ++(0,-1) node[below] {$F_{g}$};
    \draw[thick] (0,0) circle(0.1);
    % Draws the Center of Mass:
    %\filldraw[fill=black, draw=black](0,0) -- (0.1,0) arc (0:30:3mm) -- cycle;
    \fill[black] (0,0) -- (0.1,0) arc (0:90:0.1) -- (0,0);
    \fill[black] (0,0) -- (-0.1,0) arc (0:90:-0.1) -- (0,0);
    %%
  \\
  };
  \end{tikzpicture}
  \end{figure}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 21 #####
\begin{frame}
  \frametitle{Gear Schedule}
  \begin{figure}
    \includegraphics[scale=0.4]{Images/gear_shifting_schedule_2.pdf}
  \end{figure}
\end{frame}
%##### FRAME 22 #####
\begin{frame}
  \frametitle{Simulator GUI}
  \begin{columns}
  \begin{column}[c]{5cm}
  \begin{figure}
  \includegraphics[scale=0.3]{Images/parameters_gui_simulator.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    Parameters GUI
  \end{center}
  \end{column}
  \begin{column}[c]{5cm}
  \begin{figure}
  \includegraphics[scale=0.3]{Images/simulator_gui.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    Simulator GUI
  \end{center}
  \end{column}
  \end{columns}
\end{frame}
%##### FRAME 23 #####
\begin{frame}
  \frametitle{The Result}
  \begin{textblock}{5}(20,22.5)
    \flashmovie[auto=1,loop=1,controlbar=1,engine=jw-player,width=9cm,height=6.5cm]{Movies/test_1_v2.flv}
  \end{textblock}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%######################
% Auxilliary Software #
%######################
\section{Auxiliary Software}
%##### FRAME 24 #####
\begin{frame}
  \frametitle{Auxiliary Software}
  \vspace{-1cm}
  \begin{columns}
  \begin{column}[c]{5cm}
  \begin{figure}
  \includegraphics[scale=0.4]{Images/calibrator_gui.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    Calibrator
  \end{center}
  \end{column}
  \begin{column}[c]{5cm}
  \begin{figure}
  \includegraphics[scale=0.15]{Images/ros_node.pdf}
  \end{figure}
  \begin{center}
    \vspace{-0.2cm}
    \scriptsize
    ROS Node
  \end{center}
  \end{column}
  \end{columns}
\end{frame}
%############
%           #
%  SECTION  #
%           #
%##############################
% Conclusions and Future Work #
%##############################
\section{Conclusions and Future Work}
%###############
%              #
%  SUBSECTION  #
%              #
%###############
% Conclusions #
%##############
%##### FRAME 25 #####
\begin{frame}
  \frametitle{Conclusions}
  \begin{itemize}
  \item Reliability of the controller;
  \item Successful firmware control solution, using the Dijkstra's algorithm to achieve the sequential and non-sequential modes;
  \item Robustness of the communication messaging system;
  \item Good results achieved when tested in laboratory;
  \item Mechanical belt and pulley system {\color{red} not suited} for the task.
  \end{itemize}
\end{frame}
%##### FRAME 26 #####
\begin{frame}
  \frametitle{Conclusions}
  \begin{figure}
  \includegraphics[scale=0.13]{Images/PROBLEMATIC_SITUATION.pdf}
  \end{figure}
\end{frame}
%##### FRAME 27 #####
\begin{frame}
  \frametitle{Future Work}
  \begin{itemize}
  \item Remake of the power transmission system, probably replacing it by a chain and sprocket;
  \item Mounting the system on the AtlasCar;
  \item Closed-loop speed control using the gearbox;
  \item More complex manoeuvres (parking, biting-point and start of movement);
  \item Higher speed tests;
  \item ...
  \end{itemize}
\end{frame}
% Title Page:
\begin{frame}
  \titlepage
\end{frame}
\end{document}