compute_orientation {MIMSunit} | R Documentation |
Estimate the accelerometer orientation
Description
compute_orientation
returns a dataframe with accelerometer
orientations estimated by
Mizell,
2003 for the input dataframe.
Usage
compute_orientation(df, estimation_window = 2, unit = "deg")
Arguments
df |
dataframe. Input multi-channel signal. First column should be timestamps in POSIXt format. |
estimation_window |
number. window size in seconds to be used to estimate orientations. Default is 2 (seconds), as suggested by Mizell, 2003. |
unit |
string. The unit of orientation angles. Can be "deg" (degree) or "rad" (radian). Default is "deg". |
Details
This function accepts a dataframe (in mhealth accelerometer data format) and
computes the estimated acclerometer orientations (in x, y, and z angles) for
every estimation_window
seconds of the entire sequence, and outputs
the mean of these angles. The returned dataframe will have the same format as
input dataframe, including four columns, and have the same datetime format as
input dataframe in the timestamp column. The orientation estimation method
used in the function is based on
Mizell,
2003.
Value
dataframe. The returned dataframe will have the same format as input dataframe.
How is it used in mims-unit algorithm?
This function is used in
function (aggregate_for_orientation
).
See Also
Other transformation functions:
sum_up()
,
vector_magnitude()
Examples
# Use first 10 second sample data for testing
df = sample_raw_accel_data
df = clip_data(df, start_time = df[1,1], stop_time = df[1, 1] + 600)
# compute orientation angles in degrees
compute_orientation(df)
# compute orientation angles in radian angles
compute_orientation(df, unit='rad')