[chronojump] In allSet corrected the speed each repetition



commit 8b4f2211c7b2e6cbd5336a33d33b0727cc9964da
Author: Xavier Padullés <x padulles gmail com>
Date:   Tue Jul 18 14:18:49 2017 +0200

    In allSet corrected the speed each repetition

 encoder/graph.R |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 9db2d0b..70e5e01 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2907,25 +2907,27 @@ doProcess <- function(options)
                                par(new=T)
                                
                                correctedSpeed = speed$y[0:(curves[1,1] -1)]    #The first part of the graph 
isn't corrected
-                               #The speed at the excentric phase should be negative
-                               #Seeing if the speed at the excentric phase is positive or negative
-                               if(speed$y[curves[1,1] + 300] > 0)
-                               {
-                                       sign = -1                               #If the speed is positive it 
must be changeed the sign of it
-                               } else 
+                               #adding the consecutive repetitions to the correctedSpeed
+                               for (n in 2:length(curves[,1]))
                                {
-                                       sign = 1                                #If the speed is negative it 
must to be manteined
+                                       if(speed$y[curves[n -1 , 1]] > 0)    #If the speed is positive it 
must be changeed the sign of it
+                                       {
+                                               correctedSpeed = c(correctedSpeed, -1 * (speed$y[curves[n -1, 
1]:(curves[n,1] -1 )]))
+                                       } else                          #If the speed is negative it must to 
be manteined               
+                                       {
+                                               correctedSpeed = c(correctedSpeed, (speed$y[curves[n -1, 
1]:(curves[n,1] -1 )]))                             
+                                       }
                                }
                                
-                               
-                               #adding the consecutive repetitions to the correctedSpeed
-                               for (n in 2:length(curves[,1]))
+                               if(speed$y[curves[length(curves[,1]), 1]] > 0)    #If the speed is positive 
it must be changeed the sign of it
+                               {
+                                       correctedSpeed = c(correctedSpeed, -1 * 
(speed$y[curves[length(curves[,1]), 1]:length(speed$y)]))
+                               } else                          #If the speed is negative it must to be 
manteined               
                                {
-                                       correctedSpeed = c(correctedSpeed, sign * (speed$y[curves[n -1, 
1]:(curves[n,1] -1 )]))
-                                       sign = sign * (-1)
+                                       correctedSpeed = c(correctedSpeed, speed$y[curves[length(curves[,1]), 
1]:length(speed$y)])                        
                                }
                                
-                               correctedSpeed = c(correctedSpeed, sign 
*speed$y[curves[length(curves[,1]),1]: length(speed$y)])
+                               #correctedSpeed = c(correctedSpeed, speed$y[curves[length(curves[,1]),1]: 
length(speed$y)])
                                print(paste("CorrectedSpeed length =", length(correctedSpeed)))
                                ylimHeight = max(abs(range(correctedSpeed)))
                                ylim=c(- 1.05 * ylimHeight, 1.05 * ylimHeight)  #put 0 in the middle, and 
have 5% margin at each side


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