[chronojump] Encoder analyze single instant (96%)



commit 8d2e959c1362f721c980081ec511e7d8a92d1abd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 4 21:58:49 2016 +0100

    Encoder analyze single instant (96%)

 encoder/capture.R |    2 +-
 encoder/graph.R   |   18 +++++++++++++-----
 encoder/util.R    |    8 ++++++--
 3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/encoder/capture.R b/encoder/capture.R
index b5f043a..fb36999 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -77,7 +77,7 @@ calcule <- function(displacement, op, curveNum)
                                                 op$EncoderConfigurationName, op$diameter, op$diameterExt, 
                                                 op$anglePush, op$angleWeight, op$inertiaMomentum, 
op$gearedDown,
                                                 ""), #laterality 
-                               SmoothingsEC, op$SmoothingOneC, g, isPropulsive)
+                               SmoothingsEC, op$SmoothingOneC, g, isPropulsive, TRUE)
 
        paf = data.frame()
        myLaterality = "" #TODO
diff --git a/encoder/graph.R b/encoder/graph.R
index 154a837..1525187 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -646,7 +646,7 @@ kinematicRanges <- function(singleFile, displacement, curves,
                                               "") #laterality 
        
                kn <- kinematicsF(displacement[curves[i,1]:curves[i,2]],
-                              repOp, smoothingsEC[i], smoothingOneC, g, isPropulsive)
+                              repOp, smoothingsEC[i], smoothingOneC, g, isPropulsive, TRUE)
 
                if(max(abs(kn$speedy)) > maxSpeedy)
                        maxSpeedy = max(abs(kn$speedy))
@@ -2693,14 +2693,20 @@ doProcess <- function(options)
                        write("going to create array of data", stderr())
                        kn <- kinematicsF(displacement[curves[op$Jump,1]:curves[op$Jump,2]],
                                          repOp,
-                                         SmoothingsEC[smoothingPos], op$SmoothingOneC, g, isPropulsive)
+                                         #SmoothingsEC[smoothingPos], op$SmoothingOneC, g, isPropulsive)
+                                         SmoothingsEC[smoothingPos], op$SmoothingOneC, g, 
+                                         FALSE,        #create array of data with all curve and not only 
propulsive phase
+                                         FALSE         #show all the repetition, not only ground phase on ecc
+                                         ) 
 
                        df=data.frame(cbind(kn$speedy, kn$accely, kn$force, kn$power))
                        colnames(df)=c("speed","acceleration","force","power")
 
                        write("going to write it to file", stderr())
+                       #write(paste("length", curves[op$Jump,2] - curves[op$Jump,1] ), stderr())
+                       #write(paste("df", length(df[,1])), stderr())
+                       #write(paste("eccon", repOp$eccon), stderr())
                        write.csv(df, paste(op$EncoderTempPath,"/chronojump-analysis-instant.csv",sep=""), 
append=TRUE, quote=FALSE)
-                       #TODO: el millor es enviar el path a tmp i que aqui es generin els arxius, enlloc de 
enviar de C# a R el SpecialData...
 
                        write("done!", stderr())
                }
@@ -2863,7 +2869,7 @@ doProcess <- function(options)
                                                                 #myInertiaMomentum,myGearedDown,
                                                                 repOpSeparated,
                                                                 SmoothingsEC[i],op$SmoothingOneC, 
-                                                                g, isPropulsive),
+                                                                g, isPropulsive, TRUE),
                                                     repOp$massBody, repOp$massExtra, repOp$laterality, 
repOp$inertiaM
                                                     )))
                }
@@ -3135,7 +3141,9 @@ doProcess <- function(options)
                                                  "") #laterality 
 
                        kn <- kinematicsF(displacement[curves[i,1]:curves[i,2]],
-                                         repOp, smoothingsEC[i], op$smoothingOneC, g, isPropulsive)
+                                         repOp, SmoothingsEC[i], op$smoothingOneC, g, isPropulsive, 
+                                         TRUE #TODO: think if it's more appropiate to be FALSE in order to 
export full ecc phase
+                                         )
 
                        #fill with NAs in order to have the same length
                        col1 = displacement[curves[i,1]:curves[i,2]]
diff --git a/encoder/util.R b/encoder/util.R
index b16f6fd..ba85dc6 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -448,7 +448,10 @@ assignRepOptions <- function(
 #kinematicsF <- function(displacement, massBody, massExtra, exercisePercentBodyWeight,
 #                      
encoderConfigurationName,diameter,diameterExt,anglePush,angleWeight,inertiaMomentum,gearedDown,
 #                      smoothingOneEC, smoothingOneC, g, eccon, isPropulsive)
-kinematicsF <- function(displacement, repOp, smoothingOneEC, smoothingOneC, g, isPropulsive)
+#eccModesStartOnGround is default mode for calculations on e, ec starting when person lands,
+#      but on single analysis instant array, disable it in order to see the full repetition
+#      also think what to do on export CSV
+kinematicsF <- function(displacement, repOp, smoothingOneEC, smoothingOneC, g, isPropulsive, 
eccModesStartOnGround)
 {
        print("at kinematicsF")
 
@@ -529,7 +532,8 @@ kinematicsF <- function(displacement, repOp, smoothingOneEC, smoothingOneC, g, i
 
 
        #on "e", "ec", start on ground
-       if(! isInertial(repOp$econfName) && (repOp$eccon == "e" || repOp$eccon == "ec")) {
+       if(eccModesStartOnGround && ! isInertial(repOp$econfName) && 
+          (repOp$eccon == "e" || repOp$eccon == "ec")) {
                #if eccentric is undefined, find it
                if(eccentric == 0) {
                        if(repOp$eccon == "e")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]