sensor_orientations estimates the orientation angles for the input
multi-channel accelerometer signal. The input signal can be from devices of
any sampling rate and dynamic range. Please refer to function
compute_orientation for the implementation of the estimation
sensor_orientations( df, before_df = NULL, after_df = NULL, epoch = "5 sec", dynamic_range, st = NULL )
dataframe. Input multi-channel accelerometer signal.
dataframe. The multi-channel accelerometer signal comes
before the input signal to be prepended to the input signal during
computation. This is used to eliminate the edge effect during extrapolation
and filtering. If it is
dataframe. The multi-channel accelerometer signal comes after
the input signal to be append to the input signal. This is used to
eliminate the edge effect during extrapolation and filtering. If it is
string. Any format that is acceptable by argument
numerical vector. The dynamic ranges of the input
signal. Should be a 2-element numerical vector.
character or POSIXct timestamp. An optional start time you can set to force the epochs generated by referencing this start time. If it is NULL, the function will use the first timestamp in the timestamp column as start time to generate epochs. This is useful when you are processing a stream of data and want to use a common start time for segmenting data. Default is NULL.
dataframe. The orientation dataframe. The first column is the start time of each epoch in POSIXct format. The second to fourth columns are the orientation angles.
This function interpolates and extrapolates the signal before estimating the orientation angles.
after_df are often set when the accelerometer
data are divided into files of smaller chunk.
This is not included in the official MIMS-unit algorithm nor the manuscript, but we found it is useful to know the sensor orientations in addition to the summary of movement.
# Use sample data for testing df = sample_raw_accel_data # compute sensor orientation angles sensor_orientations(df, epoch = '2 sec', dynamic_range=c(-8, 8))#> ================================================================================#> HEADER_TIME_STAMP X_ANGLE Y_ANGLE Z_ANGLE #> 1 2016-01-15 11:00:00.013 11.45678 88.88573 101.4010 #> 2 2016-01-15 11:00:02.003 10.93501 90.81432 100.9039 #> 3 2016-01-15 11:00:04.003 10.57168 91.72037 100.4276# compute sensor orientation angles with different epoch length output = sensor_orientations(df, epoch = '1 sec', dynamic_range=c(-8, 8))#> ================================================================================head(output)#> HEADER_TIME_STAMP X_ANGLE Y_ANGLE Z_ANGLE #> 1 2016-01-15 11:00:00.013 NaN NaN NaN #> 2 2016-01-15 11:00:01.003 NaN NaN NaN #> 3 2016-01-15 11:00:02.003 NaN NaN NaN #> 4 2016-01-15 11:00:03.003 NaN NaN NaN #> 5 2016-01-15 11:00:04.003 NaN NaN NaN #> 6 2016-01-15 11:00:05.003 NaN NaN NaN