[chronojump: 2/4] Updated forcePosition in order to diferentiate minDisplacement in ecc or con
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump: 2/4] Updated forcePosition in order to diferentiate minDisplacement in ecc or con
- Date: Tue, 22 Oct 2019 09:12:00 +0000 (UTC)
commit 207a34c0d328c9d7f71bfaf531827838edec0ac6
Author: Xavier Padullés <x padulles gmail com>
Date: Wed Oct 16 18:37:21 2019 +0200
Updated forcePosition in order to diferentiate minDisplacement in ecc or con
r-scripts/forcePosition.R | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/r-scripts/forcePosition.R b/r-scripts/forcePosition.R
index 4de069b7..d5df28a1 100644
--- a/r-scripts/forcePosition.R
+++ b/r-scripts/forcePosition.R
@@ -5,7 +5,7 @@ getDynamicsFromForceSensor <- function(file = "/home/xpadulles/.local/share/Chro
totalMass = 75,
angle = 0,
smooth = 5,
- minDisplacement = 0.1
+ conMinDisplacement = 0.1, eccMinDisplacement = 0.1
)
{
forceSensor = read.csv(file, sep =";", dec = ",", header = TRUE)
@@ -71,7 +71,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"]
@@ -112,7 +112,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.
@@ -137,7 +137,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) )
@@ -172,7 +178,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])
@@ -190,12 +200,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, angle = 0, minDisplacement = .5)
+ ,smooth = 10, totalMass = 0, angle = 0, conMinDisplacement =
0.5, eccMinDisplacement = 0.1)
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]