[chronojump] Inertial single set graph smooth before getDisplacementInertialBody cuts (experimental)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Inertial single set graph smooth before getDisplacementInertialBody cuts (experimental)
- Date: Wed, 23 Mar 2016 00:26:42 +0000 (UTC)
commit e406a16b504b3993614f1c28d6967915454a0b82
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Mar 23 01:23:21 2016 +0100
Inertial single set graph smooth before getDisplacementInertialBody cuts (experimental)
encoder/graph.R | 15 +++++++++++----
encoder/util.R | 4 ++--
2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index c49b467..1596332 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2350,6 +2350,7 @@ doProcess <- function(options)
#if data file ends with comma. Last character will be an NA. remove it
#this removes all NAs
displacement = displacement[!is.na(displacement)]
+ displacementInertialNotBody <- NULL
if(isInertial(op$EncoderConfigurationName))
{
@@ -2358,6 +2359,7 @@ doProcess <- function(options)
diametersPerMs, op$diameterExt, op$gearedDown)
+ displacementInertialNotBody <- displacement #store a copy to be used on "single" (all
set) to have a better set smooth
displacement = getDisplacementInertialBody(0, displacement, curvesPlot, op$Title)
#positionStart is 0 in graph.R. It is different on capture.R because depends on the
start of every repetition
@@ -2571,9 +2573,14 @@ doProcess <- function(options)
maxPowerAtAnyRep <- max(dynamics$power)
}
+ #if is inertial, then use displacement of the machine (not the body) to have a better
smooth
+ displacementAllSet <- displacement
+ if(isInertial(op$EncoderConfigurationName))
+ displacementAllSet <- displacementInertialNotBody
+
#2.a) find max power (y) for some smoothings(x)
x <- seq(from = op$SmoothingOneC, to = 0, length.out = 30)
- y <- smoothAllSetYPoints(x, displacement,
+ y <- smoothAllSetYPoints(x, displacementAllSet,
op$EncoderConfigurationName, op$MassBody, op$MassExtra,
op$ExercisePercentBodyWeight,
op$gearedDown, op$anglePush, op$angleWeight, op$diameter,
op$inertiaMomentum)
@@ -2598,7 +2605,7 @@ doProcess <- function(options)
#3.a) find max power (y) for some smoothings(x) (closer)
x <- seq(from = xUpperValue, to = xLowerValue, length.out = 5)
- y <- smoothAllSetYPoints(x, displacement,
+ y <- smoothAllSetYPoints(x, displacementAllSet,
op$EncoderConfigurationName, op$MassBody,
op$MassExtra, op$ExercisePercentBodyWeight,
op$gearedDown, op$anglePush, op$angleWeight,
op$diameter, op$inertiaMomentum)
@@ -2610,7 +2617,7 @@ doProcess <- function(options)
debugParameters(listN(x, y, maxPowerAtAnyRep, smoothingAll), "paint all smoothing 3")
#4) create dynamics data for this smoothing
- speed <- getSpeedSafe(displacement, smoothingAll)
+ speed <- getSpeedSafe(displacementAllSet, smoothingAll)
accel <- getAccelerationSafe(speed)
#speed comes in mm/ms when derivate to accel its mm/ms^2 to convert it to m/s^2 need
to *1000 because it's quadratic
accel$y <- accel$y * 1000
@@ -2619,7 +2626,7 @@ doProcess <- function(options)
speed$y, accel$y,
op$MassBody, op$MassExtra, op$ExercisePercentBodyWeight,
op$gearedDown, op$anglePush, op$angleWeight,
- displacement, op$diameter,
+ displacementAllSet, op$diameter,
op$inertiaMomentum, smoothingAll
#inertiaMomentum, smoothing
)
diff --git a/encoder/util.R b/encoder/util.R
index 5ef9b9a..c8dd608 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -974,7 +974,7 @@ getDisplacementInertial <- function(displacement, encoderConfigurationName, diam
#positionStart is the height at the start of the curve. It's used only on realtime capture.
#displacementPerson has to be adjusted for every repetition using the positionStart relative to the start of
the movement
#Eg, at start of the capture position is always 0, then goes down (first eccentric phase), and then starts
con-ecc, con-ecc, con-ecc, ...
-#To divide the con-ecc in two phases (because for the encoder is only one phsae because it rotates in the
same direction), we need to know the positionAtStart
+#To divide the con-ecc in two phases (because for the encoder is only one phase because it rotates in the
same direction), we need to know the positionAtStart
getDisplacementInertialBody <- function(positionStart, displacement, draw, title)
{
position=cumsum(displacement)
@@ -995,7 +995,7 @@ getDisplacementInertialBody <- function(positionStart, displacement, draw, title
( position[position.ext$maxindex[1]] >= ( max(abs(position)) *.2 ) ) ) {
displacement = displacement * -1
position=cumsum(displacement)
- position.ext=extrema(position)
+ #position.ext=extrema(position)
}
#unused
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]