[chronojump] improving the detection of the start
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] improving the detection of the start
- Date: Mon, 18 Feb 2019 16:05:01 +0000 (UTC)
commit 1c7ff2a69f3ca26b20ccaaa562076514a39d1003
Author: Xavier Padullés <x padulles gmail com>
Date: Mon Feb 18 17:03:39 2019 +0100
improving the detection of the start
r-scripts/sprintEncoder.R | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 80008648..aa1fae19 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -296,20 +296,30 @@ getTrimmingSamples <- function(totalTime, position, speed, accel, testLength)
#The test starts when the speed is grater than 1
startSample = 0
startingSample = FALSE
- while(!startingSample)
+ while(!startingSample & startSample < (length(speed)-2))
{
startSample = startSample +1
if(accel[startSample+1] > 5)
{
- #Looking is after 2 seconds the position has increased a meter at least.
- sampleAfterSecond = which.min(totalTime - (totalTime[startSample] +1) )
- positionAfterSecnod = position[sampleAfterSecond]
- if(abs(positionAfterSecnod - position[startSample]) > 2){
+ print(paste("accel[", startSample +1 ,"] = ", accel[startSample + 1], sep = ""))
+
+ #Looking is after 1 seconds the position has increased at least 2m.
+ sampleAfterSecond = which.min(abs(totalTime - (totalTime[startSample] +1)))
+ print(paste("sampleAfterSecond =", sampleAfterSecond))
+ positionAfterSecond = position[sampleAfterSecond]
+ if(abs(positionAfterSecond - position[startSample]) > 2){
startingSample = TRUE
}
}
}
+ if(startSample == (length(speed) -2))
+ {
+ print("No start detected")
+ return()
+ }
+
+
#Going back in the time to find a really slow velocity
while(speed[startSample] > 0.5)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]