-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathStrideLengthEstimator.java
executable file
·46 lines (40 loc) · 1.21 KB
/
StrideLengthEstimator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cz.muni.fi.sandbox.service.stepdetector;
import java.util.Random;
/**
* StrideLengthEstimator class, contains model for estimation of the stride
* length based on stride duration.
*
*/
public class StrideLengthEstimator {
private double height;
/**
* Constructor
*
* @param stepLength
* is a reference step length to calibrate the model
* @param factor
* is a linear correction factor (leg length or person height can
* be used as basis)
*/
public StrideLengthEstimator(double height) {
this.height = height;
}
/**
* The estimator uses the stride length vs. frequency dependency to compute
* stride length estimate from stride duration.
*
* @param duration
* stride duration
*/
public double getStrideLengthFromDuration(double duration) {
//return factor * (0.3608 + 0.1639 / duration) * DEFAULT_STRIDE_LENGTH;
Random ranGen= new Random();
// http://www.javamex.com/tutorials/random_numbers/gaussian_distribution_2.shtml
double gaussianNoise = ranGen.nextGaussian() * 0.05;
double strideLength = height * 0.45 + gaussianNoise; //0.55
if (strideLength < 0.1)
return height * 0.415;
else
return strideLength;
}
}