The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

animate_imu

Introduction

This vignette describes how one may generate a 3-D animation of a time series of orientations of an inertial measurement unit (IMU).

We first follow the steps described in vignette("imuf") to generate a time series of orientations using the walking_shin_1 dataset:

library(imuf)
library(purrr)
#
lst_ned_in <- as.list(as.data.frame(t(walking_shin_1))) %>% unname
dt <- 1/50
#
myCompUpdate <- function(initQ, accgyr) {
  acc <- accgyr[1:3]
  gyr <- accgyr[4:6]
  gain <- 0.1
  orientation <- compUpdate(acc, gyr, dt, initQ, gain)
  orientation
}
#
orientations <- purrr::accumulate(lst_ned_in, myCompUpdate, .init = c(1, 0, 0, 0))
#
head(orientations)
#> [[1]]
#> [1] 1 0 0 0
#> 
#> [[2]]
#> [1]  0.9999657701 -0.0041990423 -0.0071175965 -0.0004080098
#> 
#> [[3]]
#> [1]  0.9998798598 -0.0078567189 -0.0133472834 -0.0006228269
#> 
#> [[4]]
#> [1]  0.9997609096 -0.0111531161 -0.0187912870 -0.0007868925
#> 
#> [[5]]
#> [1]  0.9996243467 -0.0139555857 -0.0235688255 -0.0009578893
#> 
#> [[6]]
#> [1]  0.999478521 -0.016386379 -0.027797655 -0.001209502

3-D animation of IMU orientations

Next we use the animate_imu() function to visualize a 3-D animation of the orienations.

#
# time increment for animation needs to be in milli-seconds
animate_imu(orientations, dt*1000)

3-D animation of IMU orientations within Shiny

We will now illustrate how one may display the 3-D animation in Shiny.

if (interactive()) {
  library(shiny)

  ui = pageWithSidebar(
    headerPanel("render an IMU animation example"),
    sidebarPanel(),
    mainPanel(animate_imuOutput('orientations'))
  )
  
  server = function(input, output, session) {
    output$orientations <- renderAnimate_imu(
      animate_imu(orientations, dt*1000)
    )
  }
  
  shinyApp(ui = ui, server = server)
}

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.