[chronojump] Minor fix



commit a143f1f807aa5aebabdab16d64acb62f484e218f
Author: Xavier Padullés <x padulles gmail com>
Date:   Tue Mar 26 11:00:15 2019 +0100

    Minor fix

 r-scripts/scripts-util.R  |  5 ++++-
 r-scripts/sprintEncoder.R | 20 ++++++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/r-scripts/scripts-util.R b/r-scripts/scripts-util.R
index 1485b1e4..118c30cc 100644
--- a/r-scripts/scripts-util.R
+++ b/r-scripts/scripts-util.R
@@ -77,7 +77,10 @@ getAreaUnderCurve2 <- function(x, y)
 getMeanValue <- function(X, Y, startX, endX)
 {
         print(paste("Calculating mean in the X range of [", startX, ",", endX, "]"))
-        
+        # print("x:")
+        # print(X)
+        # print("y:")
+        # print(Y)
         
         #Calculating the value of Y corresponding at startX
         #print("Calculating the first Y value")
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 537783bb..8c27e635 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -62,7 +62,7 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
         
         raceAnalyzer = read.csv2(file = filename, sep = ";")
         colnames(raceAnalyzer) = c("displacement", "time", "force")
-        raceAnalyzer$force = raceAnalyzer$force * 0.140142 /2  #TODO: Implement the calibration factor 
comming from the arduino
+        raceAnalyzer$force = (raceAnalyzer$force + 13544) * 0.2 /2  #TODO: Implement the calibration factor 
comming from the arduino
         totalTime = raceAnalyzer$time/1E6     #Converting microseconds to seconds
         elapsedTime = diff(c(0,totalTime))      #The elapsed time between each sample
         
@@ -86,18 +86,22 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
         forceBody = accel * Mass + Ka*(speed - Vw)^2
         totalForce = forceBody + raceAnalyzer$force
         power = totalForce * speed
+        # print("time:")
+        # print(raceAnalyzer$time)
+        # print("elapsedTime:")
+        # print(elapsedTime)
         # print("position:")
         # print(position)
         # print("speed:")
         # print(speed)
         # print("accel:")
         # print(accel)
-        print("forceBody:")
-        print(forceBody)
-        print("forceRope:")
-        print(raceAnalyzer$force)
-        # print("power:")
-        # print(power)
+        # print("forceBody:")
+        # print(forceBody)
+        # print("forceRope:")
+        # print(raceAnalyzer$force)
+        print("power:")
+        print(power)
         
         
         # #Checking if the sprint is long enough
@@ -174,7 +178,7 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
 
 plotSprintFromEncoder <- function(sprintRawDynamics, sprintFittedDynamics, title = "Test graph",
                                   plotRawMeanSpeed = TRUE, plotRawSpeed = TRUE, plotRawAccel = FALSE, 
plotRawForce = FALSE, plotMeanRawForce = TRUE, plotRawPower = FALSE, plotMeanRawPower = TRUE,
-                                  plotFittedSpeed = TRUE, plotFittedAccel = FALSE, plotFittedForce = FALSE, 
plotFittedPower = TRUE)
+                                  plotFittedSpeed = TRUE, plotFittedAccel = FALSE, plotFittedForce = FALSE, 
plotFittedPower = FALSE)
 {
         #Plotting position
         # plot(sprintRawDynamics$time[sprintRawDynamics$startSample:sprintRawDynamics$endSample], 
sprintRawDynamics$rawPosition[sprintRawDynamics$startSample:sprintRawDynamics$endSample],


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