Skip to content
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

Not all laps consumed #22

Open
avdv opened this issue Sep 22, 2015 · 6 comments
Open

Not all laps consumed #22

avdv opened this issue Sep 22, 2015 · 6 comments

Comments

@avdv
Copy link

avdv commented Sep 22, 2015

Hi.

At first, thanks for your work. It's great being able to access my watch data without having to launch a VM. 😂

Alas, I have a problem. For one of the workouts, the program just bails out with the abovementioned exception in Watch.cpp.

I fired off gdb and inspected the state at the failure:

wo.nsamples = 130 # OK, not trusted anyway
i = 131           # the value of the loop counter when break was called

distance(lap_it, wo.lapinfo.end()) = 2 # only off by one

But, the LapInfo data of *(lap_it+1) looks suspicious:

lap_number = 26 # OK, lap_it->lap_number = 25
...
speed = 649,89999999999998 # (km/h) woooshhh.. ?
distance = 0               # no progress
lap = {
  tm_sec = 1
  tm_min = 0
  tm_hour = 0
}

This seems to be just some sort of stray lap entry, which could
probably be skipped when reading the data? What do you think?

@mru00
Copy link
Owner

mru00 commented Sep 23, 2015

Hi!

Glad that my program is of use for you. And thank you for the detailed report.

Could you please send me an "image" (I should have called it "dump") of your data? The program has a "--to_image xxx.bin" option. That file contains everything read from the watch and should allow me to reproduce your error. I will try to debug it as soon as my time allows it.
If you are concerned about using your watch in the meanwhile, you can do a to-image now, a -clear, and a -from-image later, when we fixed the problem.

If you agree I would also like to add your bin file to the testcases for regression testing.

About debugging: I'm afraid that this will require to inspect each sample recieved from the watch.
It would be also interesting what the "GPS Master " software does with the data, can you please try that?

Gps can be messy, and have big gaps in reception. So perhaps there is a huge delta in position, if we naively just divide by time, we end up with such a ridiculous speed.
We can add "plausibility checking" and reject samples which produce such data.

Anyways a ".bin" image would be a good start for me to debug too.

@avdv
Copy link
Author

avdv commented Sep 24, 2015

I've been already debugging on an image of the watch. That works great and is so much faster. 😄

I have changed the code to skip lap info entries whose speed exceeds 300 km/h. This did not throw the runtime exception, but a error: basic_ios::clear exception. I suppose the image was only transferred from the watch up to the point when the exception occurred and hence reading the image fails going further.

So, I ended up creating a new image from the watch, which soon ended in the same exception ("Not all laps consumed") again. Only this time the entry was not as implausible as the first one.

But what's interesting is that it was again the last lap info that was not consumed. Perhaps, the last info entry may be in an uncommitted state when the watch never finished it (because the user stopped the watch)?! So, I just changed the check to:

if (std::distance(lap_it, wo.lapinfo.end()) > 2) {

and finally got this message:

...
46 workouts read from watch

I'm a bit short on time right now, I'll upload an image in the next days if you still want it.

@ajfclark
Copy link
Contributor

I'm also seeing this exception. If I comment the code out that throws the exception, the image generated has 3 laps, the watch says there's 10.

Is there somewhere that's easiest to push the image file to?

@mru00
Copy link
Owner

mru00 commented Jan 16, 2016

Good to get more evidence! You can add the file to git and make a pull request.

/test/not_all_laps_consumed/myimage.bin
/test/not_all_laps_consumed/myimage.txt

A short description file would be nice, too. It should record your assumptions.

@ajfclark
Copy link
Contributor

https://github.com/ajfclark/crane_gps_watch/tree/not-all-laps-consumed/test/not_all_laps_consumed

I've included the exports from gps master for 6 workouts in the image.

Workout 2 and workout 6 are the problematic ones.

Workout 2 the GPS dropped out. It should be 10 laps, but the client drops out after 3.

Workout 6 should not have had any GPS data in it, by may have in the last lap? It should be 11 laps, but the client drops out after 10.

@ajfclark
Copy link
Contributor

I think I've also created an appropriate pull request for you to integrate the data. I haven't cleared the data off the watch yet either in case the image is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants