Downhill Mountainbike race timer with split times

Hi, 

I wonder if it possible to program an app or maybe only a data field with the functionality like the Crossbox race timer? 

For the first step I would like to know if and how you can record a track and then stop multiple runs on this track? I have currently no experience with GPS recordings in my apps. 

It should be possible to get info from the watch if the person is moving or starts moving. But in my first tests the basic check of “currentSpeed” seems not sufficient. 
Is there a better way to check this? 

My idea is to check for the start of the movement automatically and stop the timing with an ANT+ button on the handlebar. 

  • It should be possible to get info from the watch if the person is moving or starts moving. But in my first tests the basic check of “currentSpeed” seems not sufficient. 

    Sounds like you're probably just checking if currentSpeed is 0, which is definitely not going to work, since even if you're standing still, currentSpeed will probably be a very small non-zero number.

    You could use a speed threshold for moving, if you need to detect "pauses", which is what both Garmin and Strava do.

    Strava uses 30 minutes per mile (0.89408 metres per second) as its moving threshold for running. In one of my apps, I use 60 minutes per mile (or (0.4475 metres per second) as my threshold.

    You could start with one of those numbers and go from there.

    I wonder if it possible to program an app or maybe only a data field with the functionality like the Crossbox race timer? 

    For the first step I would like to know if and how you can record a track and then stop multiple runs on this track? I have currently no experience with GPS recordings in my apps. 

    If you need to control activity recording, you'll want to implement a device app and not a data field. Connect IQ data fields can add custom FIT fields to an activity recording, but they can't do anything to control the activity recording itself (start, stop and lap are all out of the control of the CIQ data field app, although the data field app can *react* to those things).

    With a device app, you have full control over the recording. The app decides when to start, pause/stop, lap and save the recording. You can trigger these actions based on user button presses or with logic in the app (like auto-detecting movement, as you said.)

    See: ActivityRecording.createSession and ActivityRecording.Session.

    A single invocation of your app can record multiple activities (one at a time, of course.) After you save the current session, you can start a new one.

    In the CIQ SDK, you can look at the following sample apps for examples of recording: MO2Display, PitchCounter and RecordSample.

    To enable GPS in your device app, you'll want to call Position.enableLocationEvents.

    My idea is to check for the start of the movement automatically and stop the timing with an ANT+ button on the handlebar. 

    Is there a reason they can't just press the START button on their watch? Is that too dangerous or inconvenient?

  • The thing with the threshhold sound about right. I will check that.

    To get reliable timings for each run I thought about to get the timers running similar to like when you ride trough the start gate. And for the stopping this is only a first approach. It would be nice to set up some virtual gates within the gps track and mark them for split times or finish to stop the timer.

    If I can get the button to work I can think of it as a remote setting up the splits etc.

    Is it easy to visualize the track on the watch? Maybe even with map like in the stock apps?

  • Is it easy to visualize the track on the watch? Maybe even with map like in the stock apps?

    For devices that support maps (not just breadcrumb trails), there's the MapView class:

    https://developer.garmin.com/connect-iq/api-docs/Toybox/WatchUi/MapView.html

    https://developer.garmin.com/connect-iq/connect-iq-faq/how-do-i-use-a-mapview/

    If you need to support other devices, I think you have to generate and draw the breadcrumb trail yourself.

  • On devices with maps, MapView and MapTrackView.  Both use the native view so look just like in the native activities.

    You probably will want to use MapTrackView, as it does things like draw the track for you, and does things like keep your location centered.

    NOTE.  The sim doesn't really do all that happens on a real device and uses different maps. so you want to do much of your testing on a real device.. You wont see the track, the scale, etc, in the sim.

    There also is the mapsample in the SDK, which shows MapView and MapTrackView, but the first time I used it, I found that turning on GPS helped make MapTrackView easier to understand.

    As far as adding splits, etc. you would use addLap() and then these get marked in the fit file.

  • The goal for splits should be slightly different - I want to complete the course one time and set gates or marker for split times (e.g. in the trackwalk or first run). Afterwards you can ride the set up track and split times are shown automatically for the previously set up gates. So maybe it is not necessary to track the course before but to set up all gates for timing afterwards.