[chronojump] When detecting repetitions, the ecc/con minimum displacement can be diferent
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] When detecting repetitions, the ecc/con minimum displacement can be diferent
- Date: Thu, 24 Oct 2019 09:12:13 +0000 (UTC)
commit dadd3dcbaacb8243568c41516449927e7012bf50
Author: Xavier Padullés <x padulles gmail com>
Date: Thu Oct 24 09:50:30 2019 +0200
When detecting repetitions, the ecc/con minimum displacement can be diferent
r-scripts/forcePosition.R | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/r-scripts/forcePosition.R b/r-scripts/forcePosition.R
index 205000f6..7db1c2bf 100644
--- a/r-scripts/forcePosition.R
+++ b/r-scripts/forcePosition.R
@@ -6,7 +6,7 @@ getDynamicsFromForceSensor <- function(file = "/home/xpadulles/.local/share/Chro
stiffness = 71.93, #71.93 N/m measured in the black rubber
angle = 0,
smooth = 5,
- minDisplacement = 0.1
+ conMinDisplacement = 0.1, eccMinDisplacement = 0.1
)
{
forceSensor = read.csv(file, sep =";", dec = ",", header = TRUE)
@@ -72,7 +72,7 @@ getDynamicsFromForceSensor <- function(file = "/home/xpadulles/.local/share/Chro
# par(new = T)
#Getting the basic information of each repetition
- repetitions = getRepetitions(dynamics[, "time"], dynamics[, "position"], dynamics[, "rawForce"],
minDisplacement)
+ repetitions = getRepetitions(dynamics[, "time"], dynamics[, "position"], dynamics[, "rawForce"],
conMinDisplacement, eccMinDisplacement)
plot(#dynamics[, "time"]
dynamics[, "position"]
@@ -113,7 +113,7 @@ getDynamicsFromForceSensor <- function(file = "/home/xpadulles/.local/share/Chro
)
}
-getRepetitions <- function(time, position, force, minDisplacement){
+getRepetitions <- function(time, position, force, conMinDisplacement, eccMinDisplacement){
#The comments supposes that the current phase is concentric. In the case that the phase is eccentric
#the signal is inverted by multiplying it by -1.
@@ -138,7 +138,13 @@ getRepetitions <- function(time, position, force, minDisplacement){
#Detecting the first phase type
if(position[currentSample] > position[possibleExtremeSample])
- {concentric = 1} else {concentric = -1}
+ {
+ concentric = 1
+ minDisplacement = eccMinDisplacement
+
+ } else {
+ concentric = -1
+ minDisplacement = conMinDisplacement}
#print(paste("starting in mode:", concentric) )
@@ -173,7 +179,11 @@ getRepetitions <- function(time, position, force, minDisplacement){
#Changing the phase from concentric to eccentril or viceversa
concentric = -concentric
- # print(paste("Current phase is", concentric))
+ if (concentric == 1){
+ minDisplacement = eccMinDisplacement
+ } else {
+ minDisplacement = conMinDisplacement
+ }
#Calculate mean RFD and mean speed of the phase
lastRFD = (force[currentSample] - force[lastExtremeSample]) / (time[currentSample] -
time[lastExtremeSample])
@@ -191,12 +201,11 @@ getRepetitions <- function(time, position, force, minDisplacement){
, meanSpeeds = meanSpeeds[2:length(meanSpeeds)]))
}
-testDir = "/home/xpadulles/chronojump/r-scripts/tests/"
-allFiles = dir("/home/xpadulles/chronojump/r-scripts/tests/")
+testDir = "/home/xpadulles/Descargas/Piscina-mati/separat-per-punticoma/"
+allFiles = dir(testDir)
-for(i in 1:length(allFiles))
+for(i in 1:5)
{
dynamics = getDynamicsFromForceSensor(file = paste(testDir, allFiles[i], sep ="")
,smooth = 10, totalMass = 0, stiffness = 71.93, angle = 0,
minDisplacement = .5)
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]