Guest User

Untitled

a guest
Apr 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. private func processLocation(_ current:CLLocation) {
  2. guard let location = lastLocation else {
  3. lastLocation = current
  4. speed.value = 0
  5. return
  6. }
  7. var speed = current.speed
  8. if (speed > 0) {
  9. speed.value = speed
  10. } else {
  11. speed = location.distance(from: current) / (current.timestamp.timeIntervalSince(location.timestamp))
  12. speed.value = speed
  13. }
  14. lastLocation = current
  15. }
  16.  
  17. Speed: 0.249200397696353
  18. Speed: 0.778375328912623
  19. Speed: 6.99212664940017 -> peak
  20. Speed: 4.91809055561385 -> peak
  21. Speed: 0.701735999364708
  22. Speed: 0.025146066057472
  23. Speed: 0.0233857682731226
  24. Speed: 12.7814687721084 -> peak
  25. Speed: 0.61632553168542
  26. Speed: 7.37520678279276 -> peak
  27. Speed: 0.023421072500409
  28. Speed: 0.0343784939631481
  29. Speed: 0.471982071125438
  30. Speed: 0.0207671001927932
  31. Speed: 0.0217459598583271
  32. Speed: 0.0394697185852203
  33. Speed: 0.439568634647097
  34. Speed: 14.1348693612176 -> peak
  35. Speed: 6.29588775714151 -> peak
  36. Speed: 5.55254459904619 -> peak
  37. Speed: 0.218587071425142
Add Comment
Please, Sign In to add comment