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
improvement to distance filter #3462
Comments
You should probably explain what the problem is. What functions does it affect in your case? |
As an example I have implemented a function that only requests for geocoding when the device is stationary(ie when motion = no ). I can imagine any future functions that uses motion will have similar issues if motion is reported as yes when the device is actually stationary. |
I would need an example from official version of Traccar. |
I cannot think of an official traccar function besides that the fact that if you use the distance filter the "motion" state of the device will be incorrect sometimes. I hope atleast you follow why that is the case. Maybe it might not need resolution but but keep in mind for the future if the motion attribute gets more use. Do you mind pointing me to where the distance filter is implemented? I'll like to do a simple modification to my version of code where it looks at the previous position data to make sure there was no motion before it implements the distance filter. |
It's in |
Thanks! I made this modification below. It basically makes sure the device has come to a stop before it starts filtering the position. I don't know if its of any value to be included in the official traccar code. private boolean filterDistance(Position position, Position last) {
if (filterDistance != 0 && last != null && !last.getBoolean(last.KEY_MOTION) ) {
return position.getDouble(Position.KEY_DISTANCE) < filterDistance;
}
return false;
} |
Thanks for sharing the code. We will consider including something like that into official version. |
Regarding the distance filter I have a real scenario that I am having trouble with. |
Yes, the is a configuration parameter specifically for that purpose. Read official documentation. |
Thanks for the reply Anton. Knowing that I found it in the documentation. I am assuming filter.skipLimit is the property. |
Yes, that's the parameter. |
Hi there, I have had the same problem like socstur, and I have used the code that he shared here, and thanks, it woked fine, but is there a way to get this code work with ignition status ? like this:
is that possible ? if yes, how to do it the correct way ? thanks |
Hi Anton,
I'm seeing devices that are stationary but traccar shows them having motion = yes. I believe whats causing that is the distance filter configuration which filters out the data when the device actually comes to a stop (ie speed~0) since the coordinates are within the distance filter.
To explain more...when a device reports position right before a stop it'll have a speed not equal to 0 (sometimes I see speeds as high as 5 mph). When the device reports its next position which could be several second later ( no less than 10s in my case) it'll have a speed ~0 but the coordinates will be the same as before or within the distance filter. This position and any other subsequent position gets filtered out by the distance filter so traccar never gets a position data where speed ~0 even though the device has stopped. This will affect any functions that uses the device motion state for calculations.
Two solutions come to mind..one is to increase the speed threshold. In my case I'll probably have to put it close to 10mph which is not ideal. Another solution is to allow the distance filter to only come into effect after certain number of reported positions are within the range of filtering. Lets say we can let the first two or three positions within the distance filter to not get filtered out.
what are your thought on this?
The text was updated successfully, but these errors were encountered: