LocomotionSample

open class LocomotionSample: ActivityTypeTrainable, TimelineObject, Codable

A composite, high level representation of the device’s location, motion, and activity states over a brief duration of time.

The current sample can be retrieved from LocomotionManager.highlander.locomotionSample().

Dynamic Sample Sizes

Each sample’s duration is dynamically determined, depending on the quality and quantity of available ocation and motion data. Samples sizes typically range from 10 to 60 seconds, however varying conditions can sometimes produce sample durations outside those bounds.

Higher quality and quantity of available data results in shorter sample durations, with more specific representations of single moments in time.

Lesser quality or quantity of available data result in longer sample durations, thus representing the average or most common states and location over the sample period instead of a single specific moment.

  • Undocumented

    Declaration

    Swift

    public var objectId: UUID
  • Undocumented

    Declaration

    Swift

    public weak var store: TimelineStore?
  • Undocumented

    Declaration

    Swift

    internal(set) public var inTheStore = false
  • Undocumented

    Declaration

    Swift

    open var currentInstance: LocomotionSample?
  • Undocumented

    Declaration

    Swift

    public let sampleId: UUID
  • The timestamp for the weighted centre of the sample period. Equivalent to location.timestamp.

    Declaration

    Swift

    public let date: Date
  • The sample’s smoothed location, equivalent to the weighted centre of the sample’s filteredLocations.

    This is the most high level location value, representing the final result of all available filtering and smoothing algorithms. This value is most useful for drawing smooth, coherent paths on a map for end user consumption.

    Declaration

    Swift

    public let location: CLLocation?
  • The raw locations received over the sample duration.

    Declaration

    Swift

    public let rawLocations: [CLLocation]?
  • The Kalman filtered locations recorded over the sample duration.

    Declaration

    Swift

    public let filteredLocations: [CLLocation]?
  • The moving or stationary state for the sample. See MovingState for details on possible values.

    Declaration

    Swift

    public let movingState: MovingState
  • Undocumented

    Declaration

    Swift

    public let recordingState: RecordingState
  • The user’s walking/running/cycling cadence (steps per second) over the sample duration.

    This value is taken from CMPedometer. and will only contain a usable value if startCoreMotion() has been called on the LocomotionManager.

    Note

    If the user is travelling by vehicle, this value may report a false value due to bumpy motion being misinterpreted as steps by CMPedometer.

    Declaration

    Swift

    public let stepHz: Double?
  • The degree of variance in course direction over the sample duration.

    A value of 0.0 represents a perfectly straight path. A value of 1.0 represents complete inconsistency of direction between each location.

    This value may indicate several different conditions, such as high or low location accuracy (ie clean or erratic paths due to noisy location data), or the user travelling in either a straight or curved path. However given that the filtered locations already have the majority of path jitter removed, this value should not be considered in isolation from other factors - no firm conclusions can be drawn from it alone.

    Declaration

    Swift

    public let courseVariance: Double?
  • The average amount of accelerometer motion on the XY plane over the sample duration.

    This value can be taken to be mean(abs(xyAccelerations)) + (std(abs(xyAccelerations) * 3.0), with xyAccelerations being the recorded accelerometer X and Y values over the sample duration. Thus it represents the mean + 3SD of the unsigned acceleration values.

    Declaration

    Swift

    public let xyAcceleration: Double?
  • The average amount of accelerometer motion on the Z axis over the sample duration.

    This value can be taken to be mean(abs(zAccelerations)) + (std(abs(zAccelerations) * 3.0), with zAccelerations being the recorded accelerometer Z values over the sample duration. Thus it represents the mean + 3SD of the unsigned acceleration values.

    Declaration

    Swift

    public let zAcceleration: Double?
  • Undocumented

    Declaration

    Swift

    public var timelineItemId: UUID?
  • The sample’s parent TimelineItem, if recording is being done via a TimelineManager.

    Declaration

    Swift

    public var timelineItem: TimelineItem?
  • Undocumented

    Declaration

    Swift

    internal(set) public var classifierResults: ClassifierResults?
  • Undocumented

    Declaration

    Swift

    internal(set) public var unfilteredClassifierResults: ClassifierResults?
  • Undocumented

    Declaration

    Swift

    public var activityType: ActivityTypeName?
  • Undocumented

    Declaration

    Swift

    public var confirmedType: ActivityTypeName?
  • Undocumented

    Declaration

    Swift

    public var classifiedType: ActivityTypeName?
  • Undocumented

    Declaration

    Swift

    public lazy var timeOfDay: TimeInterval = { return self.date.sinceStartOfDay }()
  • Undocumented

    Declaration

    Swift

    public var hasUsableCoordinate: Bool
  • Undocumented

    Declaration

    Swift

    public var isNolo: Bool
  • Undocumented

    Declaration

    Swift

    public func distance(from otherSample: LocomotionSample) -> CLLocationDistance?
  • Undocumented

    Declaration

    Swift

    public required init(from sample: ActivityBrainSample)
  • Undocumented

    Declaration

    Swift

    public required init(from dict: [String: Any?])
  • For recording samples to mark special events such as app termination.

    Declaration

    Swift

    public required init(date: Date, recordingState: RecordingState)
  • Declaration

    Swift

    public required init(from decoder: Decoder) throws
  • Declaration

    Swift

    open func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public var description: String
  • Declaration

    Swift

    public var hashValue: Int
  • Declaration

    Swift

    public static func ==(lhs: LocomotionSample, rhs: LocomotionSample) -> Bool