You can supply timestamps to `min_time` and `max_time` (e.g timestamp of begin escape) to average over only a period.

extract_orientation2(
  ref_movement,
  target_movement,
  min_time = 0,
  max_time = Inf,
  convert2cos = TRUE,
  ...
)

Arguments

ref_movement

A reference movement data frame, e.g. the head or the waist movement. Movement file should have `pos_x`, `pos_y`, `pos_z`, `rot_x`, `rot_y`, `rot_z` columns.

target_movement

Data frame of reference movement (e.g threat movement)

min_time

minimum time in s (default trial start)

max_time

maximum time in s (default trial end)

convert2cos

Whether to use the cosine of the angle (TRUE, default) or the absolute angle (FALSE)

...

any other arguments to be passed on to `add_orientation2target2`

Value

An average of the `target_ratio` or absolute target difference over time between `min_time` and `max_time`. Uses trapezium rule for average over variable sample rate.