This function determines the time point when the player was first away from the reference position, and then determines the last time that its velocity away from the reference position was smaller than a threshold. Positions are initially median-filtered, and so is the computed velocity. All calculations are performed without resampling.

guess_escape_begin_time(
  df,
  ref_pos,
  esc_dist = 0.75,
  span = 5,
  min_speed = 0.1,
  min_time = min(df$time),
  max_time = max(df$time),
  indx = 1
)

Arguments

df

movement data frame

ref_pos

reference position, a list containing `pos_x` and `pos_z`

esc_dist

minimum distance from reference position to determine escape

span

span of the median filter

min_speed

minimum speed to determine start of escape

min_time

minimum time to start searching for escape

max_time

maximum time to search for escape

indx

currently disabled (only needed for debugging)

Details

Developer note: if escape is imposed on an ongoing movement away from bush, it might not be detected by this algorithm based on a fixed velocity criterion. However, it can actually be ambiguous to decide whether the escape was planned before or after the min_time. The algorithm could potentially be improved by using an acceleration criterion (e.g. zero crossing) but the tracker data are a bit noisy and this would require some more elaborate signal processing/filtering.