\section{Introduction}
\label{sec:intro}

Setting up a reliable localization solution for a building is a challenging and time-consuming task, especially in environments that are not built with localization in mind or do not provide any wireless infrastructure or even both. 
Such scenarios are of special interest when old or historical buildings serve a new purpose such as museums, shopping malls or retirement homes.
In terms of European architecture, the problems emanating from these buildings worsen over time.

In the scope of this work, we deployed an indoor localization system to a 13th century building.
The first 300 years, the building was initially used as a convent, and, after that, had different functions ranging from a granary to an office for Bavarian officials. 
Over time, the building underwent major construction measures and was extended several times.
Since 1936, the \SI{2500}{\square\meter} building acts as a museum of the medieval town Rothenburg ob der Tauber \cite{Rothenburg}, Germany.

Such buildings are often full of nooks and crannies, what makes it hard for dynamical models using any kind of pedestrian dead reckoning (PDR). Here, the error accumulates not only over time, but also with the number of turns and steps made \cite{Ebner-15}. 
\del{There is also a higher chance of detecting false or misplaced turns,} \add{There is also a higher probability of detecting a wrong turn,} what can cause the position estimation to lose track or getting stuck within a demarcated area. 
Thus, this paper presents a \del{robust but realistic} \add{continuous} movement model using a three-dimensional navigation mesh based on triangles.
\add{In addition, a novel threshold-based activity-recognition is used to allow for smooth floor changes.}
%In addition, this allows for very small map sizes, consuming little storage space.

In localization systems using a sample based density representation, like particle filters, aforementioned problems can further lead to more advanced problems like sample impoverishment \cite{Fetzer-17} or multimodalities \cite{Fetzer-16}.
Sample impoverishment refers to a situation, in which the filter is unable to sample enough particles into proper regions of the building, caused by a high concentration of misplaced particles. 
Within this work we present a simple yet efficient method that enables a particle filter to fully recover from sample impoverishment. 
We also use \del{a novel} \add{an} approach for finding an exact estimation of the pedestrian's current position by using a \del{rapid computation} \add{approximation} scheme of the kernel density estimation (KDE) \cite{Bullmann-18}.

Many historical buildings, especially bigger ones like castles, monasteries or churches, are built of massive stone walls and have annexes from different historical periods out of different construction materials.
\del{This leads to problems} \add{This makes it more challenging to ensure good radio coverage of the entire building, especially} for technologies using received signal strengths indications (RSSI) from \docWIFI{} or Bluetooth.
\add{For methods requiring environmental knowledge, like the wall-attenuation-factor model, the high signal attenuation between different rooms causes further problems.}
Many unknown quantities, like the walls definitive material or thickness, make it expensive to determine important parameters, \eg{} the signal's depletion over distance. 
Additionally, \del{most wireless} \add{many of these} approaches are based on a line-of-sight assumption. 
Thus, the performance will be even more limited due to the irregularly shaped spatial structure of such buildings. 
Our approach tries to avoid those problems using an optimization scheme for Wi-Fi based on a \del{few} \add{set of} reference measurements.  
We distribute a \del{small number} \add{set} of \del{simple} \add{small (\SI{2.8}{\centi\meter} x \SI{3.5}{\centi\meter})} and cheap \add{($\approx \SI{10}{\$}$)} \docWIFI{} beacons over the whole building \add{to ensure a reasonable coverage} and instead of measuring their position \add{and necessary parameters, we use our optimization scheme, initially presented in \cite{Ebner-17}}.

\add{An optimization scheme is able to compensate for wrongly measured access point positions, inaccurate building plans or other knowledge necessary for the Wi-Fi component.
}
%An optimization scheme also avoids inaccuracies like wrongly measured access point positions or outdated fingerprints caused by changes of the environment or inaccurate building plans. 
%\commentByFrank{warum fingerprints? das verwirrt mich an der stelle. willst du sagen, dass opt. besser ist, als ueberhaupt fingerprints zu nehmen? dann kommt es nicht so rueber. unsicher, deshalb kein direkter fix sondern comment}
\del{It is obvious, that} \add{Of course, } this could be solved by re-measuring the building, however this is a very time-consuming process requiring specialized hardware and a surveying engineer. 
\add{Depending on the size of the building, such a complex and time-consuming process is} contrary to most costumers expectations of a fast to deploy \del{and low-cost} solution.
%
In addition, this is not just a question of \del{costs incurred} \add{initial effort}, but also for buildings under monumental protection, not allowing for larger construction measures. 
\add{That is why the compact Wi-Fi beacons are a reasonable alternative to conventional access points for localization. 
The access points of a classic Wi-Fi infrastructure are mostly mounted to the ceilings of the building to presume a cost efficient setting receiving the highest possible coverage.
However, this usually requires new cabling, e.g. an extra power over Ethernet connection. 
In contrast, the beacons can simply be plugged into already existing power outlets and due to their low price they can be distributed in large quantities, if necessary. 
In the here presented scenario, the beacons do not establish a wireless network and thus serve only to provide signal strengths.}

%To sum up, this work presents a smartphone-based localization system using.

To sum up, \add{this work presents an updated version of the winning localization system of the smartphone-based competition at IPIN 2016 \cite{Ebner-15}, including the improvements and newly developed methods that have been made since then \cite{Ebner-16, Ebner-17, Fetzer-17, Bullmann-18}.
This is the first time that all these previously acquired findings have been fully combined and applied simultaneously.
During the here presented update, the following novel contributions will be presented and added to the system: 
\begin{itemize}
	\item The pedestrian's movement is modelled in a more realistic way using a navigation mesh, based on the building's floorplan. This only allows movements that are actually feasible, e.g. no walking through walls. Compared to the gridded-graph structure we used before \cite{Ebner-16}, the mesh allows continuous transitions and reduces the required storage space drastically.
	\item To enabled more smooth floor changes, a threshold-based activity recognition using barometer and accelerometer readings is added to the state evaluation process of the particle filter. The method is able to distinguish between standing, walking, walking up and walking down. 
	\item To address the problem of sample impoverishment in a wider scope, we present a simplification of our previous method \cite{Fetzer-17}. This reduces the overhead of adapting an existing system to the method and allows to incorporate it as independent component of the state transition of any approach using a general particle filter methodology.
\end{itemize} 
}
%We then further omit time-consuming approaches like classic fingerprinting or measuring the exact positions of access points.
%Instead we use a simple optimization scheme based on reference measurements to estimate a corresponding \docWIFI{} model.

The goal of this work is to propose a fast to deploy \del{and low-cost} localization solution, that provides reasonable results in a high variety of situations.
Consequently, we believe that by utilizing our localization approach to such a challenging scenario, it is possible to prove those characteristics. 
\add{Despite evaluating the novel contributions and the overall performance of the system, we have carried out additional experiments to determine the performance of our Wi-Fi optimization in such a complex scenario as well as a detailed comparison between KDE-based and weighted-average position estimation.}

%novel experiments to previous methods due to the complex scenario blah und blub.}
%Finally, it should be mentioned that the here presented work is an highly updated version of the winner of the smartphone-based competition at IPIN 2016 \cite{Ebner-15}. 

\blfootnote{We would like to take this opportunity to thank Dr. Helmuth M\"ohring and all other employees of the Reichsstadtmuseum Rothenburg for the great cooperation and the provision of their infrastructure and resources. }
