[chronojump] Fixed the unmatched raws in raceEncoder export
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed the unmatched raws in raceEncoder export
- Date: Tue, 29 Jun 2021 11:07:59 +0000 (UTC)
commit b15fdec364eef4564c5985066b11f8e241910b2d
Author: Xavier Padullés <x padulles gmail com>
Date: Tue Jun 29 13:06:46 2021 +0200
Fixed the unmatched raws in raceEncoder export
r-scripts/sprintEncoder.R | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index a2ad889e4..2edf39be2 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -108,6 +108,7 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
raceAnalyzer$displacement = raceAnalyzer$displacement * metersPerPulse
position = cumsum(raceAnalyzer$displacement)
speed = raceAnalyzer$displacement[2:length(raceAnalyzer$displacement)] / elapsedTime
+ speed = c(0,speed)
#Adjusting the time of each sample to the mean time between two samples
# for( i in 2:length(totalTime)){
@@ -123,6 +124,7 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
accel = c(accel, (speed[i+1] - speed[i-1]) / (totalTime[i +1] - totalTime[i -1]))
}
accel = c(accel, accel[length(accel)])
+ accel = c(0, accel)
forceBody = accel * Mass + Ka*(speed - Vw)^2
totalForce = forceBody + raceAnalyzer$force
power = totalForce * speed
@@ -824,7 +826,7 @@ testEncoderCJ <- function(filename, filenameInstantaneous, testLength, splitLeng
print(srd$Vw)
exportInstantaneous <- cbind (srd$time, srd$rawPosition,
- c(0, srd$rawSpeed), c(0, 0, srd$rawAccel), #0s are to have same
length in all variables
+ srd$rawSpeed, srd$rawAccel, #0s are to have same length in all
variables
srd$rawForce, srd$rawPower,
s.fitted, a.fitted, f.fitted, p.fitted
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]