| Title: | Estimate Orientation of an Inertial Measurement Unit |
|---|---|
| Description: | Estimate the orientation of an inertial measurement unit (IMU) with a 3-axis accelerometer and a 3-axis gyroscope using a complementary filter. 'imuf' takes an IMU's accelerometer and gyroscope readings, time duration, its initial orientation, and a gain factor as inputs, and returns an estimate of the IMU's final orientation. |
| Authors: | Felix Chan [aut, cre, cph], Ricardo Cabello [cph] ('three.js' JavaScript library) |
| Maintainer: | Felix Chan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.6.0.9000 |
| Built: | 2026-05-22 07:31:26 UTC |
| Source: | https://github.com/gitboosting/imuf |
Create interactive animated movements of an inertial measurement unit
animate_imu(data, dt, width = NULL, height = NULL, elementId = NULL)animate_imu(data, dt, width = NULL, height = NULL, elementId = NULL)
data |
A |
dt |
A numeric of time duration in milli-seconds |
width, height
|
width and height of animate_imu htmlwidget
specified in any valid |
elementId |
|
Output and render functions for using animate_imu within Shiny applications and interactive Rmd documents.
animate_imuOutput(outputId, width = "100%", height = "400px") renderAnimate_imu(expr, env = parent.frame(), quoted = FALSE)animate_imuOutput(outputId, width = "100%", height = "400px") renderAnimate_imu(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a animate_imu |
env |
The environment in which to evaluate |
quoted |
Is |
compUpdate() uses complementary filtering to update the orientation, given
an initial orientation, readings of a 3-axis accelerometer and a 3-axis
gyroscope. time duration, and a gain factor
compUpdate(acc, gyr, dt, initQuat, gain)compUpdate(acc, gyr, dt, initQuat, gain)
acc |
A numeric 3-vector of 3-axis accelerometer readings in g |
gyr |
A numeric 3-vector of 3-axis gyroscope readings in rad/sec |
dt |
A numeric of time duration in sec |
initQuat |
A numeric 4-vector of the starting orientation in quaternion |
gain |
A numeric gain factor between 0 and 1 |
A numeric 4-vector of the ending orientation in quaternion
compUpdate(c(0, 0, -1), c(1, 0, 0), 0.1, c(1, 0, 0, 0), 0.1)compUpdate(c(0, 0, -1), c(1, 0, 0), 0.1, c(1, 0, 0, 0), 0.1)
Create in real time animated movements of an inertial measurement unit in shiny
imu_object(data = c(1, 0, 0, 0), width = NULL, height = NULL, elementId = NULL)imu_object(data = c(1, 0, 0, 0), width = NULL, height = NULL, elementId = NULL)
data |
A |
width, height
|
width and height of imu_object htmlwidget
specified in any valid |
elementId |
|
Output and render functions for using imu_object within Shiny applications and interactive Rmd documents.
imu_objectOutput(outputId, width = "100%", height = "400px") renderImu_object(expr, env = parent.frame(), quoted = FALSE)imu_objectOutput(outputId, width = "100%", height = "400px") renderImu_object(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a imu_object |
env |
The environment in which to evaluate |
quoted |
Is |
Pair of functions used in conjunction to update a imu_object widget
imu_proxy(id, session = shiny::getDefaultReactiveDomain()) imu_send_data(proxy, data)imu_proxy(id, session = shiny::getDefaultReactiveDomain()) imu_send_data(proxy, data)
id |
HTML element id that houses the html widget |
session |
shiny session - default to current session |
proxy |
imu_proxy output to be used as input to imu_send_data |
data |
a numeric unit 4-vector (quaternion) for the updated orientation |
rotV() rotates a 3-vector by a quaternion expressed as a unit 4-vector in
(w,x,y,z) convention
rotV(quat, vin)rotV(quat, vin)
quat |
A numeric unit 4-vector (w,x,y,z) for a rotation quaternion |
vin |
A numeric 3-vector to be rotated by quat |
A numeric 3-vector after the rotation
q <- c(cos(pi/4), sin(pi/4), 0, 0) vin <- c(0, 1, 0) rotV(q, vin)q <- c(cos(pi/4), sin(pi/4), 0, 0) vin <- c(0, 1, 0) rotV(q, vin)
Accelerations and angular velocities captured by sensors of the mobile device situated on the shin of subject 1 while the subject was walking for 10 minutes
walking_shin_1walking_shin_1
walking_shin_1A data frame with 31,946 rows and 6 columns of accelerometer and gyroscope measurements at 50 Hz
north, east and down acceleration in m/s^2
angular velocity about north, east and down in rad/sec
https://www.uni-mannheim.de/dws/research/projects/activity-recognition/dataset/dataset-realworld/s1/