Skip to main content
. 2020 Sep 19;20(18):5377. doi: 10.3390/s20185377
Algorithm 2. Pseudo code for turning features extraction.
    01: #Detected Turns
    02: Access turn start and end timings with turning angle magnitude
    03: #Spatiotemporal turning characteristics
    04: for total turns detected
    05:  Turn time = mean of (turn end time − turn start time)
    06:  Turn angle = mean of turning angle magnitude vector
    07:  minimum, maximum, and variability in turn time and angle vector
    08:  #Full turn angular velocity
    09:  Angular velocity = Turn angle/Turn time
    10:   #Angular frequency (angular velocity) in start, mid & end of turn
    11:  selection of 0.1 s in the start, mid, end of within turn
    12:  mean & variability in (max of angular frequency in overall turn)
    13:  mean & variability in (mean of 0.1 s window in the start, mid, end)
    14:  #Direction of turn
    15:  left turn if angle magnitude is negative or right otherwise
    16:  #Number of turn/transitions
    17:  length of start and end time vector
    18: end for
    19: #Signal based turning characteristics
    20: Accessing the ω, a in VT, AP & ML directions
    21: Detrend the ω, a
    22: Data filtering: 4th order low-pass Butterworth filter at 20 Hz cut-off
    23: Getting resultant magnitude of VT,AP & ML for ω, a
    24: for each start, mid, and end of turn
    25:  RMS for ω, a in VT, AP, ML & R #Turn overall, start, mid & end
    26:  #Jerk: rate of change of a
    27:  RMS, max, min, range of each turn jerk in VT, AP, ML & R #Turn
    28:   overall, start, mid & End
    29:  #Angular acceleration: rate of change of ω
    30:  RMS, max, min, range of each turn angular acceleration in VT, AP,
    31:   ML & R #Turn overall, start, mid & end
    32: end for #classification modeling and statistical analysis