[chronojump] realtime inertial capture should work now
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] realtime inertial capture should work now
- Date: Wed, 28 Jan 2015 19:44:31 +0000 (UTC)
commit 0c9bf436aaae63cd5d43697daa97f56eb258df19
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 28 20:44:10 2015 +0100
realtime inertial capture should work now
encoder/capture.R | 20 +++++++++++---------
encoder/util.R | 23 ++++++++++++++---------
2 files changed, 25 insertions(+), 18 deletions(-)
---
diff --git a/encoder/capture.R b/encoder/capture.R
index c8dddc5..ce190dd 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -53,22 +53,24 @@ while(input[1] != "Q") {
position = cumsum(displacement)
+ start = 1
+ end = length(displacement)
if( ! isInertial(op$EncoderConfigurationName)) {
reduceTemp = reduceCurveBySpeed(op$Eccon, 1,
1, 0, #startT, startH
displacement, #displacement
op$SmoothingOneC #SmoothingOneC
)
+
+ start = reduceTemp[1]
+ end = reduceTemp[2]
+ #write("printing reduceTemp2", stderr())
+ #write(reduceTemp[2], stderr())
+ if(end > length(displacement))
+ end = length(displacement)
+
+ displacement = displacement[start:end]
}
-
- start = reduceTemp[1]
- end = reduceTemp[2]
- #write("printing reduceTemp2", stderr())
- #write(reduceTemp[2], stderr())
- if(end > length(displacement))
- end = length(displacement)
-
- displacement = displacement[start:end]
g = 9.81
diff --git a/encoder/util.R b/encoder/util.R
index b93f409..0f33dd2 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -681,16 +681,21 @@ getDisplacementInertialBody <- function(displacement, draw, title)
print("at findCurvesInertial")
print(position.ext)
- #Fix if disc goes wrong direction at start
- if(position.ext$maxindex[1] < position.ext$minindex[1]) {
- displacement = displacement * -1
- position=cumsum(displacement)
- position.ext=extrema(position)
- }
-
- firstDownPhaseTime = position.ext$minindex[1]
+ #do if extrema(position)$nextreme == 0... then do not use extrema
+ #TODO: check if started backwards on realtime capture (extrema is null)
+ firstDownPhaseTime = 1
+ downHeight = 0
+ if(position.ext$nextreme > 0) {
+ #Fix if disc goes wrong direction at start
+ if(position.ext$maxindex[1] < position.ext$minindex[1]) {
+ displacement = displacement * -1
+ position=cumsum(displacement)
+ position.ext=extrema(position)
+ }
- downHeight = abs(position[1] - position[firstDownPhaseTime])
+ firstDownPhaseTime = position.ext$minindex[1]
+ downHeight = abs(position[1] - position[firstDownPhaseTime])
+ }
positionPerson = abs(cumsum(displacement))*-1
#this is to make "inverted cumsum"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]