openambitproject / openambit

openambit
280 stars 82 forks source link

No time while converting log file to gpx #242

Closed gin123 closed 4 years ago

gin123 commented 4 years ago

My watch is Ambit3 Peak. While converting I get errors

Traceback (most recent call last): File "./openambit2gpx.py", line 219, in latInterPolEP=str( ((lat2-lat1)/timeDiff(t1,t2))*timeDiff(t1,t) + lat1 ) File "./openambit2gpx.py", line 74, in timeDiff secs1=utcSplitConvSeconds(utcTime1) File "./openambit2gpx.py", line 64, in utcSplitConvSeconds tmpTime=utcTime.split("T")[1].split("Z")[0].split(":") IndexError: list index out of range

In log file on line 5 is <Time>2019-12-08T11:07:11</Time>

and other time tags are filled with some numbers.

In new gpx file all lines are filled with <time /> e.g.

<trkpt lat="xxx" lon="xxx"><time /><extensions><gpxdata:temp>18.7</gpxdata:temp><gpxdata:speed>226</gpxdata:speed><gpxdata:SeaLevelPressure>10042</gpxdata:SeaLevelPressure></extensions></trkpt>

Please any help.

rnorris commented 4 years ago

This is the same as Issue #206, as you can see the dates are messed up in December as the openambit log files do not contain values in the 'Sample'->'UTC' field - which is used by the openambit2gpx python program for the GPX time.

I posted a solution to this in PR #212, which is in libambit but this has yet to be accepted.

NB: Viewing the information in the openambit GUI works OK as I believe the time & duration values shown are taken from the 'Header' section of the log files, as opposed to calculating it from all the individual 'Sample' records.

NB2 If PR #212 is accepted, since it's a fault in libambit - you would need to regenerate your broken openambit log files (i.e. delete the affected log files in ~/.openambit/ and then rerun with the fixed openambit program)

NB3 The way the 'Header' time data that is extracted from the watch is different to the times in the individual 'sample' records, hence the Header time value is always OK.

gin123 commented 4 years ago

rnorris, thank you for the reply, I will try to compile new library.

gin123 commented 4 years ago

I changed pmem20.c file, recompiled libraries, converted log to gpx, but nothing changed. Time tags are empty.

rnorris commented 4 years ago

@gin123 The only things I can immediately think of are:

  1. Ensure you've deleted the appropriate existing log files in ~/.openambit/ to definitely cause openambit to regenerate them.
  2. Ensure you're using your modified openambit program (and lib). Check your system paths, maybe deinstall the OS distribution version.

Otherwise probably need to debug / trace what's really going on, such as suggested in #206

Place some printf() below the line (gmtime(...)), regenerate a Log and post it here? https://github.com/openambitproject/openambit/blob/master/src/libambit/pmem20.c#L1160

printf("Time: %d-%d-%d T %d:%d\n", tm->year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);

And maybe need to see what is input into add_time() as well, so something like this too:

printf("In Time: %d-%d-%d T %d:%d\n", intime->year, intime->month, intime->day, intime->hour, intime->minute);

HTH.

gin123 commented 4 years ago

Sorry, I deleted old log files and new ones are good. Thank you very much.

I had few old log files, made gpx from them, and imported them to Strava. Is it possible to import these and other gpx files to Movescount as 'moves' (not routes)?

centic9 commented 4 years ago

I think this is fixed via #212 now.

Also the gpx-conversion script was updated via https://github.com/openambitproject/openambit/commit/8c82071f7c64495219153f86b71e4c834ddf840f to not crash on unexpected time-values. This will lead to some empty "time" entries if invalid date/time strings are present, but will at least allow to create gpx-files which can be used for navigation purposes.