[chronojump] Testing variable diameters in conical machines



commit 1bb069f4c3796a1e7d20a0fdc9f3eb01e475a7ef
Author: Xavier Padullés <x padulles gmail com>
Date:   Thu Apr 23 12:46:07 2015 +0200

    Testing variable diameters in conical machines

 encoder/tests/conical_diameters.R            |   56 ++++++++++++++++++++++++++
 encoder/tests/conical_diameters_Roptions.txt |   32 +++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/encoder/tests/conical_diameters.R b/encoder/tests/conical_diameters.R
new file mode 100644
index 0000000..21b661f
--- /dev/null
+++ b/encoder/tests/conical_diameters.R
@@ -0,0 +1,56 @@
+setwd("~/chronojump/encoder/tests/")
+source("../util.R")
+
+#Read a double vector indicating the initial diameter of every loop of the rope
+#plus the final diameter of the last loop and returns a dataframe with the radius
+#correspending to the total number of ticks of the encoder
+#This can be run only once per machine
+
+# Example of input of the sequence of the loop and diameter of the loop
+# We use diameters but in the next step we convert to radii
+# d_vector <- c(1.5, 1.5, 1.5, 1.5, 2, 2.5, 2.7, 2.9, 2.95, 3)
+getInertialDiametersPerTick <- function(d_vector)
+{
+  print("Diameter in getInertialDiametersPerTick before conversion")
+  print(d_vector)
+  #If only one diameter is returned, we assume that the diameter is constant
+  #and only a double is returned
+  if (length(d_vector) == 1){
+    return(d_vector)
+  }
+  
+  # Numerating the loops of the rope
+  d <- matrix(c(seq(from=0, to=(length(d_vector) -1), by=1), d_vector), ncol=2)
+  
+  # Converting the number of the loop to ticks of the encoder
+  d[,1] <- d[,1]*200
+  
+  # Linear interpolation of the radius across the lenght of the measurement of the diameters
+  d.approx <- approx(x=d[,1], y=d[,2], seq(from=1, to=d[length(d[,1]),1]))
+  print("Diameter in getInertialDiametersPerTick after conversion")
+  print(d.approx$y)
+  return(d.approx$y)
+}
+#Returns the instant diameter every milisecond
+getInertialDiametersPerMs <- function(displacement, diametersPerTick)
+{
+  print("Diameter in getInertialDiameterPerMs before conversion")
+  print(diametersPerTick)
+  diameter <- diametersPerTick[abs(cumsum(displacement)) + 1]
+  print("Diameter in getInertialDiameterPerMs after conversion")
+  print(diameter)
+  return(diameter)
+}
+
+getOptionsFromFile <- function(optionsFile, lines) {
+  optionsCon <- file(optionsFile, 'r')
+  options=readLines(optionsCon, n=lines)
+  close(optionsCon)
+  return (options)
+}
+
+options <- getOptionsFromFile("~/chronojump/encoder/tests/conical_diameters_Roptions.txt", 32)
+op <- assignOptions(optionsFile)
+diameter    <- as.numeric(unlist(strsplit("1.5; 1.91; 2.64; 3.38; 3.83; 4.14; 4.28; 4.46; 4.54; 4.77; 4.96; 
5.13; 5.3; 5.55", "\\;")))
+diametersPerTick <- getInertialDiametersPerTick(diameter)
+diametersPerMs <- getInertialDiametersPerMs(displacement, diameter)
diff --git a/encoder/tests/conical_diameters_Roptions.txt b/encoder/tests/conical_diameters_Roptions.txt
new file mode 100644
index 0000000..ef41de6
--- /dev/null
+++ b/encoder/tests/conical_diameters_Roptions.txt
@@ -0,0 +1,32 @@
+/usr/local/lib/chronojump/../../share/chronojump/encoder/capture.R
+/tmp/chronojump-captured
+none
+none
+none
+20
+0
+92
+0
+ecS
+-
+none
+-
+ROTARYAXISINERTIAL
+1.5
+-1
+-1
+-1
+101
+1
+0.7
+0
+430
+121
+COMMA
+none
+Linux
+/usr/local/lib/chronojump/../../share/chronojump/encoder/util.R
+none
+jump;body speed;speed;Speed;Accel.;Force;Power;Peak Power;Distance;Time to Peak 
Power;time;Range;distance;Weight;Mass;eccentric;concentric;land;air;jump height;Repetition;Not enough 
data.;Encoder is not connected.;prediction;Concentric mean speed on bench press 1RM =;Estimated percentual 
load =;Adapted from;Mean speed in concentric propulsive phase;Sorry, no repetitions matched your 
criteria.;Need at least three jumps;Laterality;RL;R;L
+jump;body speed;speed;Speed;Accel.;Force;Power;Peak Power;Distance;Time to Peak 
Power;time;Range;distance;Weight;Mass;eccentric;concentric;land;air;jump height;Repetition;Not enough 
data.;Encoder is not connected.;prediction;Concentric mean speed on bench press 1RM =;Estimated percentual 
load =;Adapted from;Mean speed in concentric propulsive phase;Sorry, no repetitions matched your 
criteria.;Need at least three jumps;Laterality;RL;R;L
+/usr/local/lib/chronojump/../../share/chronojump/encoder/graph.R


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