commit 117b1a2c1dbc492584a44ea0bff3ee1ffef595d0
parent 8701e9de5c04e12a27721a0b2751bed7c80940f0
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Tue, 11 Oct 2016 11:18:45 -0400
Hysteresis on bearing changes.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/R/identifyManeuvers.R b/R/identifyManeuvers.R
@@ -20,7 +20,11 @@ identifyBearingChanges <- function(trajectory, loThresh, hiThresh = NA) {
t$bearing[2:length(t$bearing)])) /
c(NA, diff(t$time))
- isBearingChange <- abs(bearingChanges) > hiThresh
+ isBearingChange <- hysteresisThresh(bearingChanges, max(loThresh), max(hiThresh))
+ if (length(loThresh) > 1) {
+ isBearingChange <- isBearingChange |
+ hysteresisThresh(-bearingChanges, -min(loThresh), -min(hiThresh))
+ }
return(isBearingChange)
}