## Materials and Methods
### Collision Avoidance Velocity  
The data obtained from INS are then fitted to the building layout by using our map-matching algorithm. We try to correct the error of rotation using walls as boundaries. The movement of an individual can be defined by a velocity vector, broken down into orientation and length. The orientation reflects the direction of the movement while the length reflects the speed along this direction. Our idea for map-matching is to record the changes in the orientation of the velocity vector imposed by collision avoidance. The intuition of the algorithm is as follows. For each step of the individual, we define an orientation of the velocity vector by subtraction of the new position coming from radio equipment and the position previously recorded. If the velocity vector collides with a wall, we calculate the change in angle of the orientation of the velocity vector needed to avoid collision with the wall. The change is stored in an _update matrix_ and each subsequent step of the individual is then corrected according to these saved changes. The velocity obstacle, as well as the collision avoidance velocity calculation, is based on the Optimal Reciprocal Collision Avoidance (ORCA) algorithm proposed in [37]. The algorithm is widely discussed in [37; 38; 39]. However, for the sake of clarity, let us briefly present this algorithm. The algorithm aims to avoid the velocity obstacle (\(VO\)). The velocity obstacle is the set of all velocities of an agent that will result in a collision with another agent or an obstacle. Due to the ambiguity of concepts used in VO, let us describe the approach using formal notation. Let \(\mathcal{A}=\{A_{1},\cdots,A_{n},\cdots,A_{N}\}\) be the set of \(N\) agents sharing the same \(\mathbb{R}^{2}\) plane. Any agent \(A_{n}\) from \(\mathcal{A}\) is represented by a disc with its center at position \(p_{n}\) and radius \(r_{n}\). The obstacles are defined as rectangles by four points in counter-clockwise order. However, they are also projected onto the disc with its center at \(p_{n}\) and radius \(r_{n}\). Hence, discussing collision avoidance among agents does not differ from discussing collision avoidance between an agent and an obstacle. However, for the sake of this article, keeping these concepts together does not introduce much complexity. The velocity obstacle \(VO^{\tau}_{A_{n}|A_{k}}\) for an agent \(A_{n}\) induced by an agent \(A_{k}\) for some time window \(\tau\) is the set of all velocities that result in a collision of the agents at some moment before time \(\tau\)[39]:  
\[VO^{\tau}_{A_{n}|A_{k}}=\{v|\exists t\in[0,\tau]::tv\in D(p_{k}-p_{n},r_{n}+r_ {k})\}, \tag{3}\]  
where \(D(p,r)\) represents a disc with center \(p\) and radius \(r\). Figure 2 depicts the geometric interpretation of the velocity obstacle. In the ORCA algorithm, \(VO\) is calculated as a Minkowski sum \(A_{n}\oplus A_{k}\) of two objects representing agents \(A_{n}\) and agent \(A_{k}\), and object \(-A_{n}\) reflecting its reference point:  
\[A_{n}\oplus A_{k}=\{a_{n}+a_{k}|a_{n}\in A_{n},a_{k}\in A_{k}\},-A_{n}=\{-a_{n }|a_{n}\in A_{n}\}. \tag{4}\]  
There is a ray \(\lambda\) from \(p_{n}\) in the direction of the relative velocity of \(A_{n}\) and \(A_{k}\)\((v_{n}-v_{k})\). If the ray intersects the Minkowski sum of \(A_{k}\) and \(-A_{n}\) centered at \(p_{k}\), then \(v_{n}\) is the velocity obstacle of agent \(A_{n}\) induced by agent \(A_{k}\):  
\[VO_{A_{n}|A_{k}}=\{v_{n}|\lambda(p_{n},v_{n}-v_{k})\cap A_{k}\oplus-A_{n}\
eq \emptyset\}, \tag{5}\]  
then, for any \(v_{m}\in V_{k}\) and \(v_{n}\
otin VO^{\tau}_{A_{n}|A_{k}}\oplus V_{B}\), \(A_{n}\) and \(A_{k}\) are guaranteed to be collision-free at their current velocities for at least time \(\tau\). The collision avoiding velocity is defined as follows:  
\[CA^{\tau}_{A_{n}|A_{k}}(V_{k})=\{v|v\
otin VO^{\tau}_{A_{n}|A_{k}}\oplus V_{k}\}. \tag{6}\]  
Figure 2: The geometric interpretation of the velocity obstacle. (**a**) general idea; (**b**) limitation induced by \(\tau\) constraints.