Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get route time? #136

Open
fly2008begin opened this issue Mar 28, 2019 · 1 comment
Open

How to get route time? #136

fly2008begin opened this issue Mar 28, 2019 · 1 comment

Comments

@fly2008begin
Copy link

Hello!Why the function time() returns NULL in class Route when I run the MatcherExample .offline() ?
微信截图_20190328111801
I check the function toDebugJSON() to solve the above problem.
I found that you use "for" to get samples' time,but
why the size of samples() is not equal to sequence() sometimes?
Then how to get time in object route?

微信截图_20190328112357

@smattheis
Copy link

1.) The parameter time represents the time cost (travel time) for the route. This is usually not calculated and stored by default but after it's calculated once it is buffered in that variable, see:

public double time() {
if (time != null) {
return time;
} else {
time = cost(new Time());
return time;
}
}

2.) The size of the sequence in the k-state depends on your policy for matching samples. That means, if samples are temporal out-of-order or you configured a minimal distance or minimum time interval, it will omit samples to improve robustness such that the sequence is not the same size as your sample set, see parameters minDistance and minInterval here:
/**
* Matches a full sequence of samples, {@link MatcherSample} objects and returns state
* representation of the full matching which is a {@link KState} object.
*
* @param samples Sequence of samples, {@link MatcherSample} objects.
* @param minDistance Minimum distance in meters between subsequent samples as criterion to
* match a sample. (Avoids unnecessary matching where samples are more dense than
* necessary.)
* @param minInterval Minimum time interval in milliseconds between subsequent samples as
* criterion to match a sample. (Avoids unnecessary matching where samples are more dense
* than necessary.)
* @return State representation of the full matching which is a {@link KState} object.
*/
public MatcherKState mmatch(List<MatcherSample> samples, double minDistance, int minInterval) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants