[chronojump] RaceAnalyzer device fixed
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RaceAnalyzer device fixed
- Date: Wed, 4 Sep 2019 11:08:32 +0000 (UTC)
commit c485e222ddb6db7e0ce77581350e53de4d0d9bed
Author: Xavier Padullés <x padulles gmail com>
Date: Wed Sep 4 13:07:33 2019 +0200
RaceAnalyzer device fixed
r-scripts/sprintEncoder.R | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 9a1a8aa0..303b056e 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -50,7 +50,7 @@ assignOptions <- function(options) {
#-------------- assign options -------------
op <- assignOptions(options)
-getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, Height , Vw = 0, device)
+getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, Height , Vw = 0, device =
"FISHING")
{
print("#####Entering in getSprintFromEncoder###############")
# Constants for the air friction modeling
@@ -68,20 +68,18 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
elapsedTime = diff(c(0,totalTime)) #The elapsed time between each sample
#The encoder can be used with both loose ends of the rope. This means that the encoder can rotate
- #in both directions. We considre always the speed as positive.
+ #in both directions. We consider always the speed as positive.
if(mean(raceAnalyzer$displacement) < 0)
raceAnalyzer$displacement = -raceAnalyzer$displacement
- diameter = 0.16 #Diameter of the pulley
- #raceAnalyzer$displacement = raceAnalyzer$displacement * 2 * pi * diameter / 200
- #In 30m there are 12267 pulses.
- #TODO: measure this several times to have an accurate value
- pulsesIn30m = NULL
- if(device == "FISHING")
- pulsesIn30m = 12267
- else
- pulsesIn30m = 12267 #TODO: change value
+
+ #TODO: measure metersPerPulse several times to have an accurate value
+ metersPerPulse = NULL
+ if(device == "FISHING") #Hand device
+ metersPerPulse = 0.003003
+ else #sled device
+ metersPerPulse = 30 / 12267 #In 30m there are 12267 pulses.
- raceAnalyzer$displacement = 4 * raceAnalyzer$displacement * 30 / pulsesIn30m
+ raceAnalyzer$displacement = raceAnalyzer$displacement * metersPerPulse
position = cumsum(raceAnalyzer$displacement)
speed = raceAnalyzer$displacement / elapsedTime
accel = (speed[3] - speed[1]) / (totalTime[3] - totalTime[1])
@@ -507,7 +505,7 @@ tryNLS <- function(data){
testEncoderCJ <- function(filename, testLength, mass, personHeight, tempC)
{
- sprintRawDynamics = getSprintFromEncoder(filename, testLength, op$mass, op$tempC, op$personHeight,
op$device)
+ sprintRawDynamics = getSprintFromEncoder(filename, testLength, op$mass, op$tempC, op$personHeight,
Vw = 0, device = op$device)
# print("sprintRawDynamics:")
# print(sprintRawDynamics)
if (sprintRawDynamics$longEnough & sprintRawDynamics$regressionDone)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]