\documentclass[fleqn]{beamer}
%\usetheme{Warsaw}
%\usetheme{Montpellier}
%\usetheme{CambridgeUS}
%\usetheme{Singapore}



%\usetheme{m}
\usetheme[everytitleformat=regular]{m}

% Costumizing the m-theme here
\setbeamertemplate{footline}[text line]{%
    \parbox{\linewidth}{
        \vspace*{-35pt}\insertpagenumber
        \hfill\inserttitle
        \hspace*{-30pt}  
        \hfill\includegraphics[width=0.20\textwidth]{gfx/logo_orange}
        \hspace*{-30pt}
    }
  }
  
\definecolor{mWhite}{HTML}{FFFFFF}
\definecolor{mOrange}{HTML}{e84e25}   
\setbeamercolor{frametitle}{%
  use=mWhite,
  fg=mWhite,
  bg=mOrange
}
\setbeamercolor{alerted text}{%
  fg=mOrange
}
% End Costumizing





\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
%\usepackage[scaled=0.9]{helvet}
%\usepackage{courier}

% font
\usepackage{lmodern}

%video
%\usepackage{multimedia}
%\usepackage[3D]{movie15}
\usepackage{media9}


%\usepackage{wrapfig}

\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{amsmath}
\renewcommand{\vec}[1]{\boldsymbol{#1}}
\newcommand{\mat}[1]{\boldsymbol{#1}}
%\renewcommand{\hat}[1]{\oldhat{\mathbf{#1}}}

\newcommand{\SI}[2]{\ensuremath{#1}\text{\,#2}}
\newcommand{\SIrange}[3]{\ensuremath{#1} to \ensuremath{#2}\text{\,#3}}
\newcommand{\cm}{cm}
\newcommand{\meter}{m}
\newcommand{\per}{/}
\newcommand{\milli}{m}
\newcommand{\second}{s}
\newcommand{\giga}{G}
\newcommand{\hertz}{Hz}
\newcommand{\dBm}{dBm}
\newcommand{\percent}{\%}
\newcommand{\decibel}{dB}
\newcommand{\dB}{dB}
\newcommand{\degree}{\ensuremath{^{\circ}}}


\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\NDist}{\mathcal{N}}
\newcommand{\UDist}{\mathcal{U}}


\newcommand{\qTurn}{\theta}
\newcommand{\qBaro}{\hat\rho_{\text{rel}}}


\newcommand{\oWifi}{s_{\text{wifi}}}
\newcommand{\oBeacons}{s_{\text{beacons}}}
\newcommand{\oStep}{n_\text{step}}
\newcommand{\oTurn}{\Delta\theta}
\newcommand{\oBaro}{\rho_{\text{rel}}}

\newcommand{\ispace}{\vspace{2mm}}

\newcommand{\vecB}[2]{\begin{pmatrix} #1\\ #2 \end{pmatrix}}
\newcommand{\matD}[4]{\begin{bmatrix} #1 & #2 \\ #3 & #4 \end{bmatrix}}


\title{On Prior Navigation Knowledge in Multi Sensor Indoor Localisation}
%\author{F. Ebner, T. Fetzer, F. Deinzer, L. Köping, M. Grzegorzek}
\author{F. Ebner$^\star$, T. Fetzer$^\star$, F. Deinzer$^\star$, L. Köping$^\dagger$, M. Grzegorzek$^\dagger$}
\date{\today}
\institute{ $^\star$ University of Applied Sciences W\"urzburg - Schweinfurt \\
            $^\dagger$ University of Siegen - Pattern Recognition Group}

\begin{document}

	\maketitle
	
	
	%\frame{\tableofcontents[currentsection]}
	\frame{\tableofcontents}
	
	\section{Overview}
	
		\begin{frame}			
			
			\begin{tabular}{lcr}
				
				% icons: https://thenounproject.com/search/?q=graph
				
				\includegraphics[width = 0.12\textwidth]{icons/wifi1.eps} \enskip	\includegraphics[width = 0.09\textwidth]{icons/ibeacon1.eps} &
				&
				\includegraphics[width = 0.14\textwidth]{icons/accel1.eps} \enskip \includegraphics[width = 0.12\textwidth]{icons/gyro1.eps} \\
				\small{absolute positioning $(x,y,z)$}	&	& \small{relative positioning $(x,y)$} \\
				\small{\textit{Wi-Fi, iBeacons}}		&	& \small{\textit{accelerometer, gyroscope}} \\
				
				
				\\
				~\hspace{4.5cm}~ & & ~\hspace{4.5cm}~\\
				\\
				
				\includegraphics[width = 0.12\textwidth]{icons/baro1.eps} &
				&
				\includegraphics[width = 0.12\textwidth]{icons/graph1.eps} \enskip \includegraphics[width = 0.12\textwidth]{icons/route1.eps} \\
				\small{relative positioning $(z)$}		&	& \small{motion prediction $(x,y,z)$} \\
				\small{\textit{barometer}}				&	& \small{\textit{graph, routing}}
				
				
			\end{tabular}
			
		\end{frame}
		
	\section{System}
	
		\subsection{Recursive Density Estimation}
			\begin{frame}
				\frametitle{Recursive Density Estimation}
				\begin{itemize}
					\item<1->	Current State\\
								$\vec{q} = (x,y,z, \qTurn, \qBaro)^T, \enskip{}
									\overbrace{x,y,z \in \R}^{\text{position}}, \enskip 
									\overbrace{\qTurn \in \R}^{\text{heading}},\enskip{}
									\overbrace{\qBaro \in \R}^{\text{rel. pressure}}
								$	\\
								$\vec{q_0} = $ uniformly distributed
								\ispace
					\item<2->	Observation\\
								$\vec{o} = (\vec{\oWifi}, \vec{\oBeacons}, \oStep, \oTurn, \oBaro)$
								\ispace
					\item<3->	\small$
									\underbrace{ p(\vec{q_t}\mid \vec{o}_{1:t})}_{\text{estimation}}
									\propto %
									\underbrace{ p(\vec{o_t} \mid \vec{q_t}) }_{\text{evaluation}}%
									\int
									\underbrace{ p(\vec{q_t} \mid \vec{q_{t-1}}, \vec{o_{t-1}}) }_{\text{transition}}%
									\underbrace{ p(\vec{q_{t-1}} \mid \vec{o}_{1:t-1})}_{\text{recursion}}%
									d\vec{q}_{t-1}%
								$
				\end{itemize}
			\end{frame}
		
	
		\subsection{Observation}
			\begin{frame}
				\frametitle{Observation}
				\begin{itemize}
					\item<1->	a location's probability based on the current sensor readings
								\begin{equation*}
									\begin{split}
									p(\vec{o}_t \mid \vec{q}_t) =&\\
									&p(\vec{o}_t \mid \vec{q}_t)_{\text{wifi}} \\
									&p(\vec{o}_t \mid \vec{q}_t)_{\text{beacons}} \\
									&p(\vec{o}_t \mid \vec{q}_t)_{\text{baro}} \\
									\end{split}
								\end{equation*}
								\ispace
					\item<1->	assuming statistical independence
					\item<1->	\textit{step- and turn detection are used within the transition}
				\end{itemize}
			\end{frame}
			
			%\begin{frame}
			%	\frametitle{Observation - Wi-Fi/iBeacons}
			%	\begin{itemize}
			%		\item<1->	2D signal strength prediction\\
			%					$
			%						P_r(d) = 
			%						\underbrace{P_0}_{\text{reference}}\enskip
			%						\underbrace{- 10 \gamma \cdot \log_{10}(\tfrac{d}{d_0})}_{\text{attenuation per meter}}\enskip
			%						\underbrace{+ X}_{\text{noise}}
			%						,\enskip\enskip
			%						X \sim \NDist(0,\sigma^2_{\text{wifi}})
			%					$
			%					\ispace
			%		\item<2->	3D signal strength prediction\\
			%					$
			%						P_r'(d,\Delta f) = P_r(d) + \Delta f \lambda,\enskip
			%						\underbrace{\Delta f \in \N}_{\text{number of floors}}
			%						,\enskip
			%						\underbrace{\lambda \approx -8}_{\text{attenuation per floor}}
			%					$
			%					\ispace
			%		\item<3->	
			%						$p(\vec{o}_t \mid \vec{q}_t)_\text{wifi}=$
			%						$p(\vec{\oWifi} \mid \vec{q}_t) = \prod_{\oWifi} \NDist(s_i \mid P_r'(d_i, \Delta f_i), \sigma_{\text{wifi}}^2)$,\\
			%						\vspace{3mm}
			%						$\sigma_{\text{wifi}}$ also depends on the measurement's age\\
			%						$\Delta f_i = $floors between location and sender\\
			%						$d_i = \| \underbrace{(\varrho_i^x, \varrho_i^y, \varrho_i^z\cdot h)^T}_{\text{sender's position}} - (q_t^x, q_t^y, q_t^z)^T \|$,\\
			%		\item<1->	FAST ETWAS ZU VOLL? GRAFIK?
			%	\end{itemize}
			%\end{frame}
			
			
			\begin{frame}
				\frametitle{Observation - Wi-Fi/iBeacons}
				\begin{itemize}
					
					\item<1->
						$p(\vec{o}_t \mid \vec{q}_t)_\text{wifi}=$
						$p(\vec{\oWifi} \mid \vec{q}_t) = \prod_{\oWifi} \NDist(s_i \mid P_r(d_i, \Delta f_i), \sigma_{\text{wifi}}^2)$,\\
						\ispace
						
					\item<2->	3D signal strength prediction\\\ispace
								$
									P_r(d,\Delta f) = 
									\underbrace{P_0}_{\text{reference}}\enskip
									\underbrace{- 10 \gamma \cdot \log_{10}(\tfrac{d}{d_0})}_{\text{attenuation per meter}}\enskip
									\underbrace{+ \Delta f \lambda}_\text{floor attenuation}
									\underbrace{+ X}_{\text{  noise  }}
								$
								%\\\ispace$
								%	X \sim \NDist(0,\sigma^2_{\text{wifi}}),\enskip
								%	\underbrace{\Delta f \in \N}_{\text{number of floors}},\enskip
								%	\underbrace{\lambda \approx -8}_{\text{attenuation per floor}}
								%$
								%\ispace
						\only<3>{ \includegraphics[width = 0.4\textwidth]{gfx/wifi1.png} }%
						\only<4->{ \includegraphics[width = 0.4\textwidth]{gfx/wifi2.png} }%
						\only<5>{ \includegraphics[width = 0.4\textwidth]{gfx/wifi3.png} }%
						\only<6->{ \includegraphics[width = 0.4\textwidth]{gfx/wifi4.png} }%
						
			\end{itemize}
			\end{frame}
		
			
			\begin{frame}
				\frametitle{Observation - Barometer}
				\begin{itemize}
					\item<1->	$p(\vec{o}_t \mid \vec{q}_t)_{\text{baro}} = $
								$\NDist(o_t^{\oBaro} \mid q_t^{\qBaro}, \sigma_{\text{baro}}^2)$
								\ispace
					\item<2->	each transition performs a relative pressure prediction:\\
								\ispace
								$q_t^{\qBaro} = q_{t-1}^{\qBaro} + \Delta z \cdot b$, \enskip
								$\underbrace{\Delta z = q_{t-1}^z - q_{t}^z}_{\text{height change}}$, \enskip
								$\underbrace{b \in \R}_{\text{pressure change / meter}}$\\
								%
								\vspace{5mm}
								\begin{figure}
									\centering
									\includegraphics[width = 0.4\textwidth]{gfx/baroChange}
								\end{figure}
								
				\end{itemize}

			\end{frame}
			
			%\begin{frame}
			%	\frametitle{Observation - Step/Turn}
			%	\begin{itemize}
			%		\item<1->	$
			%						p(\vec{o}_t \mid \vec{q}_t, \vec{q}_{t-1})_{\text{step}} = 
			%						\begin{cases}
			%							\NDist(d_{\text{obs}} \mid d_{s}, \sigma_{s}^2)		& \quad \text{step}\\
			%							\NDist(d_{\text{obs}} \mid d_{ns}, \sigma_{ns}^2)	& \quad \text{no step}
			%						\end{cases}
			%					$,\\
			%					\ispace
			%					$ d_{\text{obs}} = \|  (q_{t-1}^x, q_{t-1}^y)^T - (q_t^x, q_t^y)^T \| $
			%					\ispace
			%		\item<2->	$
			%						p(\vec{o}_t \mid \vec{q}_t, \vec{q}_{t-1})_{\text{turn}} = 
			%						f_{\text{mises}}(\Delta \alpha \mid \Delta \alpha_t, \kappa),
			%					$\\
			%					\ispace
			%					$
			%						\Delta \alpha = \angle \vec{q}_{t} - \angle \vec{q}_{t-1}, \enskip
			%						\Delta \alpha_t = \text{gyroscope}
			%					$
			%	\end{itemize}
			%\end{frame}
		
		\subsection{Transition}
					
			
			\begin{frame}
				\frametitle{Transition - Floorplan}
					\only<1>{%
						1) start with the building's floorplan\\%
						\includegraphics[width = 1.0\textwidth]{gfx/step1}%
					}%
					\only<2>{%
						2) divide into cells and remove those intersecting with walls\\%
						\includegraphics[width = 1.0\textwidth]{gfx/step2}%
					}%
					\only<3>{%
						3) add edges to all (available) adjacent cells\\%
						\includegraphics[width = 1.0\textwidth]{gfx/step3}%
					}%
					\only<4>{%
						4) add stairs and remove unreachable cells\\%
						\includegraphics[width = 1.0\textwidth]{gfx/step4}%
					}%
			\end{frame}
			
			
			
			
			
			\newcommand{\leHeading}{\theta_{\text{walk}}}
			%\newcommand{\leDistance}{d_{\text{walk}}}
			\newcommand{\leDistance}{d}
				
			\begin{frame}
				\frametitle{Transition - Random Walk}
				\begin{minipage}{0.49\textwidth}
					$p(\vec{q}_t \mid \vec{q}_{t-1})$:
					\begin{enumerate}
						\item get node $\vec{q}_{t-1}$ belongs to
						\item draw distance $\leDistance$ to walk%\\ \textit{depends on the number of detected steps}
						\item repeat until $\leDistance$ is reached
						\begin{enumerate}
							\item draw edge $e_{i,j}$ according to its probability $p(e_{i,j})$
							\item walk along the edge
							\item $\leDistance = \leDistance - \|e_{i,j}\|$
						\end{enumerate}
					\end{enumerate}
				\end{minipage}
				\begin{minipage}{0.49\textwidth}
					\begin{figure}
						\includegraphics[width = 1.0\textwidth]{gfx/walk}
					\end{figure}
				\end{minipage}
			\end{frame}
						
						

			
						
			\begin{frame}
				\frametitle{Transition - Random Walk}
				\begin{itemize}
					
					%\item<1-> each transition $p(\vec{q}_t \mid \vec{q}_{t-1}, \vec{o}_{t-1})$ from $\vec{q}_{t-1}$ to $\vec{q}_t$ is
					%	\begin{itemize}
					%		\item a random walk along several edges
					%		\item uses constraints to describe pedestrian's walking behaviour
					%		\item depends on recent sensor readings (distance to walk, heading)
					%		\item uses prior knowledge of the pedestrian's desired destination
					%	\end{itemize}
					%	\ispace
					
					\item<1-> distance to walk\\
						\ispace
						$%
							\leDistance =
							\underbrace{{o}_{t-1}^{\oStep}}_\text{steps detected} \cdot
							\underbrace{s_\text{step}}_\text{step size} + 
							\underbrace{\mathcal{N}(0, \sigma^2_{\leDistance})}_\text{uncertainty}
						$\newline\newline
					
					\item<2->	pedestrian's heading\\
								\ispace
								$p(e_{i,j})_\text{turn} = p(e_{i,j} \mid \leHeading) = \NDist(\angle e_{i,j} \mid \leHeading, \sigma^2_{\text{dev}} )$\\
								\ispace
								$%
									\underbrace{\leHeading = {q}_{t}^{\qTurn}}_\text{current heading} = 
									\underbrace{{q}_{t-1}^{\qTurn}}_\text{previous heading} +
									\underbrace{{o}_{t-1}^{\oTurn}}_\text{sensor readings} + 
									\underbrace{\mathcal{N}(0, \sigma^2_{\leHeading})}_\text{uncertainty}
								$\\
								
					
				\end{itemize}
			\end{frame}
			
			\newcommand{\dist}[2]{\text{d}(#1, #2)}
			\newcommand{\dest}{v_\text{dest}}
			
			\begin{frame}
				\frametitle{Transition - Prior Knowledge}
				\begin{itemize}
					
					\item<1->
						pedestrian's destination is known beforehand
					
					\item<2->
						use this prior knowledge to enhance the movement prediction
						
						\begin{itemize}
							\item calculate the shortest path from the desired destination to all other vertices using Dijkstra's algorithm
							\item favour nodes approaching the destination over others
							\ispace
							\item
								$%
								p(e_{i,j})_\text{path} = p(v_j \mid v_i) = 
								\begin{cases} 
									\kappa			&	\dist{v_j}{\dest} < \dist{v_i}{\dest}\\
									(1-\kappa)		&	\text{else}
								\end{cases}
								$
							
						\end{itemize}
					\item<3-> however: calculated path is very unrealistic and sticks to walls
				\end{itemize}
			\end{frame}
			
			\begin{frame}
				\frametitle{Transition - Shortest Path}
				\only<1>{%
					1) using shortest path as-is, produces unlikely-to-walk paths
					\includegraphics[width = 1.0\textwidth]{gfx/path1}%
				}%
				\only<2>{%
					2) determine likelyhood for a vertex to be visited by the pedestrian
					\includegraphics[width = 1.0\textwidth]{gfx/step5}%
				}%
				\only<3>{%
					3) use this likelyhood to adjust Dijkstra's weighting function $\delta(e_{i,h})$
					\includegraphics[width = 1.0\textwidth]{gfx/path2}%
				}%
			\end{frame}

			
		
	\section{Experiments}
	
		%\frame{\tableofcontents[currentsection]}
			
		%\begin{frame}
		%	\frametitle{WiFi \& simple transition}
		%	$\overline{e} = \SI{730}{\cm},\enskip\sigma = \SI{395}{\cm}$
		%	\vspace{-13mm}
		%	\begin{figure}
		%		\centering{}
		%		\includegraphics[width = 1.0\textwidth]{gfx2/paths/path2_wifi_only_simple_trans}
		%	\end{figure}
		%\end{frame}
				
		\begin{frame}
			%\movie[start=6s, width=11cm,height=6cm, poster]{}{yy.gif}
			%\includemovie[autoplay, poster]{4cm}{3cm}{yy.gif}
			%\includemedia[width=5cm,height=4cm]{}{/tmp/mgl/out.mpg}
			
			%\newcommand\Wider[2][3em]{%
			%	\makebox[\linewidth][c]{%
			%	  \begin{minipage}{\dimexpr\textwidth+#1\relax}
			%	  \raggedright#2
			%	  \end{minipage}%
			%	  }%
			%}

			\vspace{-5mm}
			\makebox[\linewidth][c]{
				\begin{minipage}{\dimexpr\textwidth+5em\relax}
					\raggedright
						\includemedia[
						  activate=pageopen,%
						  width=\textwidth, height=8.0cm,%
						  addresource=exp.flv,%
						  flashvars={%
							 source=exp.flv%
							 &scalemode=letterbox%
						  }
						]{}{VPlayer.swf}
				\end{minipage}
			}

			%\includemedia[
			%	width=0.6\linewidth,%
			%	height=0.3375\linewidth,%
			%	activate=pageopen,%
			%	addresource=nyan.flv,
			%	flashvars={}%
			%]{}{nyan.flv}
				
		\end{frame}

\end{document}
