[chronojump] reduceCurveBySpeed on inertial. This will cut inertial phases with less zeros
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] reduceCurveBySpeed on inertial. This will cut inertial phases with less zeros
- Date: Fri, 1 Apr 2016 12:51:41 +0000 (UTC)
commit 7bbaa1294f2e248430b3d3eb5fef1336eca1bce6
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Apr 1 14:37:02 2016 +0200
reduceCurveBySpeed on inertial. This will cut inertial phases with less zeros
encoder/capture.R | 33 +++++++++++++++++++++------------
encoder/graph.R | 28 +++++++++++++++++-----------
encoder/util.R | 2 +-
3 files changed, 39 insertions(+), 24 deletions(-)
---
diff --git a/encoder/capture.R b/encoder/capture.R
index 12dcfa6..6863f89 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -212,24 +212,33 @@ doProcess <- function(options)
displacement = getDisplacement(op$EncoderConfigurationName, displacement,
op$diameter, op$diameterExt)
}
- start = 1
- end = length(displacement)
- if( ! isInertial(op$EncoderConfigurationName)) {
- reduceTemp = reduceCurveBySpeed(op$Eccon,
+
+ #cut curve by reduceCurveBySpeed ---->
+
+ reduceTemp = reduceCurveBySpeed(op$Eccon,
1, 0, #startT, startH
displacement, #displacement
op$SmoothingOneC #SmoothingOneC
)
+ start = reduceTemp[1]
+ end = reduceTemp[2]
- start = reduceTemp[1]
- end = reduceTemp[2]
- #write("printing reduceTemp2", stderr())
- #write(reduceTemp[2], stderr())
- if(end > length(displacement))
- end = length(displacement)
+ #reduceCurveBySpeed, on inertial doesn't do a good right adjust on changing phase,
+ #it adds a value at right, and this value is a descending value that can produce a high
acceleration there
+ #delete that value
+ if( isInertial(op$EncoderConfigurationName))
+ end = end -1
- displacement = displacement[start:end]
- }
+ #write("printing reduceTemp2", stderr())
+ #write(reduceTemp[2], stderr())
+ if(end > length(displacement))
+ end = length(displacement)
+
+ displacement = displacement[start:end]
+
+ #<---- cut curve by reduceCurveBySpeed done
+
+
#if(debug)
# write("doProcess 3", stderr())
diff --git a/encoder/graph.R b/encoder/graph.R
index 6b59ef2..5be533f 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2445,17 +2445,23 @@ doProcess <- function(options)
#reduceCurveBySpeed, don't do in inertial because it doesn't do a good right adjust on
changing phase
#what reduceCurveBySpeed is doing in inertial is adding a value at right, and this value is a
descending value
#and this produces a high acceleration there
- if( ! isInertial(op$EncoderConfigurationName)) {
- for(i in 1:n) {
- reduceTemp=reduceCurveBySpeed(op$Eccon,
- curves[i,1], curves[i,3], #startT, startH
- displacement[curves[i,1]:curves[i,2]],
#displacement
- op$SmoothingOneC
- )
- curves[i,1] = reduceTemp[1]
- curves[i,2] = reduceTemp[2]
- curves[i,3] = reduceTemp[3]
- }
+
+ for(i in 1:n) {
+ reduceTemp=reduceCurveBySpeed(op$Eccon,
+ curves[i,1], curves[i,3], #startT, startH
+ displacement[curves[i,1]:curves[i,2]], #displacement
+ op$SmoothingOneC
+ )
+
+ #reduceCurveBySpeed, on inertial doesn't do a good right adjust on changing phase,
+ #it adds a value at right, and this value is a descending value that can produce a
high acceleration there
+ #delete that value
+ if( isInertial(op$EncoderConfigurationName))
+ reduceTemp[2] = reduceTemp[2] -1
+
+ curves[i,1] = reduceTemp[1]
+ curves[i,2] = reduceTemp[2]
+ curves[i,3] = reduceTemp[3]
}
#print("curves after reduceCurveBySpeed")
diff --git a/encoder/util.R b/encoder/util.R
index ebeb410..c2a49ed 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -360,7 +360,7 @@ reduceCurveBySpeed <- function(eccon, startT, startH, displacement, smoothingOne
} else if(eccon=="ce") {
time1 = min(which(speed$y == max(speed$y)))
time2 = max(which(speed$y == min(speed$y)))
- } else { #c
+ } else { #c, ecS, ceS
speed$y=abs(speed$y)
time1 = min(which(speed$y == max(speed$y)))
time2 = max(which(speed$y == max(speed$y)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]