Nothing
#' Low-Pass filter Gyroscope data
#'
#' @inheritParams check_second
#' @inheritParams read_AG_IMU
#' @inheritParams read_AG_counts
#' @param samp_rate The sampling rate, in Hz
#'
#' @return A data frame with filtered gyroscope data
#'
#' @examples
#' data(imu_to_collapse)
#' imu_filter_gyroscope(imu_to_collapse, 100)
#'
#' @export
imu_filter_gyroscope <- function(
AG, samp_rate, filter_hz = 35, verbose = FALSE
) {
if (!isTRUE(requireNamespace("seewave", quietly = TRUE))) {
stop(
"You must install the seewave package to filter IMU data",
call. = FALSE
)
}
if (verbose) message_update(19, filter_hz = filter_hz)
gyro_names <- grepl("gyroscope", names(AG), ignore.case = TRUE)
AG[ , gyro_names] <- sapply(
AG[, gyro_names],
function(x) {
seewave::bwfilter(
wave = x,
f = samp_rate,
n = 2,
to = filter_hz
)
}
)
if (verbose) message_update(20)
return(AG)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.