This is a convenience function to make imprecisely attached trackers comparable between scenarios. For example waist trackers may be in a slightly different place on the torso on different trials and subjects. This functions subtracts the median of the first 10 rows and adds the starting position. The median is used to avoid impact of tracker imprecision in individual frames.

reorient_movement_to_start(
  df,
  .cols = c("rot_x", "rot_y", "rot_z", "pos_x", "pos_z"),
  ref_pos = list(pos_x = 0, pos_y = 0, pos_z = 0, rot_x = 0, rot_y = 0, rot_z = 0)
)

Arguments

df

A movement data frame.

.cols

Columns to reorient. Default: all rotations and in-plane position

ref_pos

Reference position (named list, names must correspond to columns in df. See also `find_start_pos` for a way of generating such a list)

Value

A re-oriented data frame with the same column names