Skip to main content
. 2017 Aug 16;17(8):1882. doi: 10.3390/s17081882
Algorithm 1: The proposed trajectory recording algorithm.
Input: Gyroscope sensor G, Accelerometer sensor AC, destination D
Output: Stack S that contains the set of instructions, I(A, SC, θcurrent,P), where A, SC, θ, P are the variables for the action, step count, compass direction, and position, respectively.
Procedure:
1. Initialize A ← null, θprevious, θcurrent0° , SC ← 0, P(Px, Py) ← (0,0);

2.
// Determine the action type
If AC < 0.03, then AStop
3. else if |θcurrentθprevious|>15° then ATurn
4. else AGo-straight
5. //Estimate the instruction parameters according to the action type
if A is Go-straight, then SC, Px, Py is updated by the following equation:
        SCSC+1, PxSC·cosθcurrent, PySC·sinθcurrent
6. else if A is Turn, then θcurrentθprevious
7. PushI(A, SC, θcurrent,P) to S


8.
//check if the current positioning information is the destination (the positioning information is obtained by recognizing the QR codes)
if the current location is destination, then terminate
9. else Go to Line 2