Motion, Trips and Stops

Configuration

Following configuration parameters can be adjusted:

Motion attribute

It was introduced to standardize how traccar handle device motion. Some devices report this attribute directly. For other devices it is automatically calculated according to speed and speedThreshold parameter. It can also be corrected using computed attributes.

Motion detection

Motion detection became more complex, now it is virtual device state. Traccar analyzes positions flow and switch motion state according to configuration. Traccar switches state from "stopped" to "moving" if device is reporting "motion = true" more than minimalTripDuration seconds or tripped distance more than minimalTripDistance meters. Traccar switches state from "moving" to "stopped" if device is reporting "motion = false" more than minimalParkingDuration seconds or useIgnition enabled and ignition is OFF. Only continuous periods can switch the state, any fluctuations reset detection.

Last chance check might be applied when device changes status to "offline" or "unknown" if status.updateDeviceState parameter enabled. Might be helpful if device goes sleep faster than minimalParkingDuration or connection is not very stable.

Trips and Stops

Traccar provides two advanced report types Trips and Stops. It uses the same motion detection algorithm to determine trips and stops. Algorithm uses following parameters to check if device was moving or stopped:

Examples

Following are two examples to illustrate how it works.

First one shows how most devices report. Devices that have internal battery or connected to vehicle power supply all the time, but they can go into a sleep mode after some period (row #19-21) if there is no movement.

Trip 1 detected correctly, because period started from zero speed (initialized as stopped), distance longer than default 500 meters or duration longer than 5 minutes, and it is followed by stop longer than minimalParkingDuration.

Stop 1 detected because it has duration longer than minimalParkingDuration and the speed is close to zero.

Trip 2 also detected correctly from row 27, row 24-25 are ignored as fluctuation. Parameters are more than minimal, and it started and followed by positions with zero speed.

Second example illustrates case when device does not have internal battery and powered only when ignition is ON. Such devices always cold-start and have delay in GPS fix. Therefore such devices start reporting with speed much more than zero. It is impossible to use same algorithm as in the first example, so additional logic was introduced. Gaps between reporting intervals are detected as stops.

The report.trip.minimalNoDataDuration parameter is set to 600 (10 minutes). You can see that the speed is never less than speedThreshold, but the gap (row 15 - row 28) is more than 10 minutes. It is interpreted as a stop. Preceding trip is detected correctly. Following movement period is not detected as a trip because algorithm cannot determine when it ends.