imu {simts} | R Documentation |
Create an IMU Object
Description
Builds an IMU object that provides the program with gyroscope, accelerometer, and axis information per column in the dataset.
Usage
imu(
data,
gyros = NULL,
accels = NULL,
axis = NULL,
freq = NULL,
unit = NULL,
name = NULL
)
Arguments
data |
A |
gyros |
A |
accels |
A |
axis |
A |
freq |
An |
unit |
A |
name |
A |
Details
data
can be a numeric vector, matrix or data frame.
gyros
and accels
cannot be NULL
at the same time, but it will be fine if one of them is NULL
.
In the new implementation, the length of gyros
and accels
do not need to be equal.
In axis
, duplicate elements are not alowed for each sensor. In the new implementation, please specify the axis for each column of data.
axis
will be automatically generated if there are less than or equal to 3 axises for each sensor.
Value
An imu
object in the following attributes:
- sensor
A
vector
that indicates whether data contains gyroscope sensor, accelerometer sensor, or both.- num.sensor
A
vector
that indicates how many columns of data are for gyroscope sensor and accelerometer sensor.- axis
Axis value such as 'X', 'Y', 'Z'.
- freq
Observations per second.
- unit
String representation of the unit.
- name
Name of the dataset.
Author(s)
James Balamuta and Wenchao Yang
Examples
## Not run:
if(!require("imudata")){
install_imudata()
library("imudata")
}
data(imu6)
# Example 1 - Only gyros
test1 = imu(imu6, gyros = 1:3, axis = c('X', 'Y', 'Z'), freq = 100)
df1 = wvar.imu(test1)
plot(df1)
# Example 2 - One gyro and one accelerometer
test2 = imu(imu6, gyros = 1, accels = 4, freq = 100)
df2 = wvar.imu(test2)
plot(df2)
# Example 3 - 3 gyros and 3 accelerometers
test3 = imu(imu6, gyros = 1:3, accels = 4:6, axis =
c('X', 'Y', 'Z', 'X', 'Y', 'Z'), freq = 100)
df3 = wvar.imu(test3)
plot(df3)
# Example 4 - Custom axis
test4 = imu(imu6, gyros = 1:2, accels = 4:6, axis =
c('X', 'Y', 'X', 'Y', 'Z'), freq = 100)
df4 = wvar.imu(test4)
plot(df4)
## End(Not run)