Estimate Orientation of an Inertial Measurement Unit

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.


imuf imuf website

R-CMD-check

‘imuf’ uses complementary filtering to estimate the orientation of an inertial measurement unit (IMU) with a 3-axis accelerometer and a 3-axis gyroscope. It takes the IMU’s accelerometer and gyroscope readings, time duration, its initial orientation, and a ‘gain’ factor as inputs, and provides an estimate of the final orientation as outputs.

‘imuf’ adopts the north-east-down (NED) coordinate system. The initial and final orientations are expressed as quaternions in (w, x, y, z) convention.

Installation

install.packages("imuf")

You can install the development version of imuf from GitHub with:

# install.packages("pak")
pak::pak("gitboosting/imuf")

Example

This is a basic example which shows you how to solve a common problem:

library(imuf)
#
acc <- c(0, 0, -1)         # accelerometer NED readings in g (~ 9.81 m/s^2) 
gyr <- c(1, 0, 0)          # gyroscope NED readings in radians per second
deltat <- 0.1              # time duration in seconds
initq <- c(1, 0, 0, 0)     # initial orientation expressed as a quaternion
gain <- 0.1                # a weight (0-1) given to the accelerometer readings
#
# final orientation expressed as a quaternion
(final <- compUpdate(acc, gyr, deltat, initq, gain))
#> [1] 0.99898767 0.04498481 0.00000000 0.00000000
#
#
# rotate a vector pointing east by 90 deg about north
q <- c(cos(pi/4), sin(pi/4), 0, 0)   # quaternion to rotate 90 deg about north
vin <- c(0, 1, 0)                    # vector in east direction
(vout <- rotV(q, vin))               # after rotation, vector is in down direction
#> [1] 0.000000e+00 2.220446e-16 1.000000e+00

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("imuf")

0.6.0 by Felix Chan, 2 years ago


https://github.com/gitboosting/imuf, https://gitboosting.github.io/imuf/


Report a bug at https://github.com/gitboosting/imuf/issues


Browse source code at https://github.com/cran/imuf


Authors: Felix Chan [aut, cre, cph] , Ricardo Cabello [cph] ('three.js' JavaScript library)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports htmltools, htmlwidgets, Rcpp

Suggests knitr, rmarkdown, testthat, purrr, ggplot2, shiny, serial, stringr

Linking to Rcpp, RcppEigen


See at CRAN