php-fit-file-analysis icon indicating copy to clipboard operation
php-fit-file-analysis copied to clipboard

v3.1 Unsupported operand types from the fit file of TomTom

Open xjack913 opened this issue 6 years ago • 11 comments

I just updated the version to v3.1 and there is an error of "Unsupported operand types" in /home/ubuntu/workspace/vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php at line 1446 from TomTom user.

Could you please fix this or What should I do? Thank you.

run-20180322T212609.fit.TXT

xjack913 avatar Mar 23 '18 04:03 xjack913

Hi @xjack913 - see issue #45. Could you let me know if that works for you?

I have started working on a fix. The commits are in the master branch but ahead of the latest release. I'll up-version once we know that the issue is addressed.

adriangibbons avatar Apr 02 '18 10:04 adriangibbons

Hi, @adriangibbons I tried inserting the code issue #45 mentioned at line 2703, but it doesn't work.

I find out that the field_name "start_time" of each message_name "lap" of fit files from TomTom users is an array, not a timestamp. Therefore, when do add or sub operator to "this array" at line 1446 or 1493, it shows a Fatal Error Unsupported operand types.

Any suggestions? Thanks.

xjack913 avatar Apr 03 '18 02:04 xjack913

Hi @xjack913 do you still get this issue now in v3.2?

adriangibbons avatar Apr 23 '18 13:04 adriangibbons

Thanks, these fit files from TomTom users work fine in v3.2.

But a file show another issue, Division by zero in /home/ubuntu/workspace/vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1962

$this->data_mesgs[$message][$field] = round(60 / 3.6 / $this->data_mesgs[$message][$field], 3);

610464.fit.txt

PS: It looks like this file was crashed.

xjack913 avatar Apr 24 '18 02:04 xjack913

Great, that's good to know.

Is this file throwing the new error uploaded to Garmin Connect, Strava, etc? It's useful to see the information and charts shown on this kind of site to try and ensure this class is producing the same info.

Cheers, Adrian.

On 2018-04-24 10:58 am, XJack wrote:

Thanks, these fit files from TomTom users work fine in v3.2.

But a file show another issue, Division by zero in /home/ubuntu/workspace/vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1962

$this->data_mesgs[$message][$field] = round(60 / 3.6 / $this->data_mesgs[$message][$field], 3);

610464.fit.txt [1]

-- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [2], or mute the thread [3].

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/adriangibbons/php-fit-file-analysis","title":"adriangibbons/php-fit-file-analysis","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/adriangibbons/php-fit-file-analysis"}},"updates":{"snippets":[{"icon":"PERSON","message":"@xjack913 in #47: Thanks, these fit files from TomTom users work fine in v3.2. \r\n\r\nBut a file show another issue, Division by zero in /home/ubuntu/workspace/vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line \u003ci\u003e1962\u003c/i\u003e\r\n\r\n$this-\u003edata_mesgs[$message][$field] = round(60 / 3.6 / $this-\u003edata_mesgs[$message][$field], 3);\r\n\r\n610464.fit.txt"}],"action":{"name":"View Issue","url":"https://github.com/adriangibbons/php-fit-file-analysis/issues/47#issuecomment-383787693"}}}

--

Links:

[1] https://github.com/adriangibbons/php-fit-file-analysis/files/1940689/610464.fit.txt [2] https://github.com/adriangibbons/php-fit-file-analysis/issues/47#issuecomment-383787693 [3] https://github.com/notifications/unsubscribe-auth/AJvsl7gQMMUL720QufmZ5t8NpRwfQZ8yks5trpTjgaJpZM4S4J_0

adriangibbons avatar Apr 24 '18 07:04 adriangibbons

Hi, @adriangibbons ,

Recently, I got some fit files without session info, but other services like garmin connect and strava could handle these fit files as well. Could you please help me to take a look ? These fit files as below.

2775379975.fit.txt 2780451464.fit.txt 2825367441.fit.txt

Thank you very much.

xjack913 avatar Jul 05 '18 07:07 xjack913

Hi @xjack913 - I had a look at the first file and confirm that there isn't Session information being collected in there. I'm pretty sure that session is not a mandatory field/message - in fact I think pretty much everything in the ANT FIT protocol is optional. Perhaps the Lap field/message contains the information you are looking for?

var_dump($pFFA->data_mesgs['lap']);

// Output
array(31) {
["timestamp"]=> int(1528942335)
["start_time"]=> int(1528941993)
["start_position_lat"]=> float(25.0486)
["start_position_long"]=> float(121.5494)
["end_position_lat"]=> float(25.04917)
["end_position_long"]=> float(121.54935)
["total_elapsed_time"]=> float(340.741)
["total_timer_time"]=> float(340.741)
["total_distance"]=> float(1)
["total_cycles"]=> int(508)
["time_in_hr_zone"]=> array(7) {
    [0]=> float(93.053)
    [1]=> float(248.07)
    [2]=> int(0)
    [3]=> int(0)
    [4]=> int(0)
    [5]=> int(0)
    [6]=> int(0) }
["message_index"]=> int(0)
["total_calories"]=> int(51)
["avg_speed"]=> float(10.566)
["max_speed"]=> float(10.613)
["total_ascent"]=> int(4)
["total_descent"]=> int(0)
["avg_vertical_oscillation"]=> float(86.7)
["avg_stance_time_percent"]=> float(34.15)
["avg_stance_time"]=> float(228.7)
["event"]=> int(9)
["event_type"]=> int(1)
["avg_heart_rate"]=> int(154)
["max_heart_rate"]=> int(160)
["avg_cadence"]=> int(89)
["max_cadence"]=> int(91)
["lap_trigger"]=> int(2)
["sport"]=> int(1)
["sub_sport"]=> int(0)
["avg_fractional_cadence"]=> float(0.578125)
["max_fractional_cadence"]=> float(0.5) }

adriangibbons avatar Jul 06 '18 02:07 adriangibbons

Hi, @adriangibbons ,

I did try to collect what I need from the lap field, but all results show that all information including distance, total_timer_tiime, avg_speed.. etc are different with those shown at other services.

For example, the timer time filed of first file is 340.741 secs as you shown, but it is 1768 secs by Strava or Garmin connect which matched the user feedback. Thanks.

xjack913 avatar Jul 06 '18 07:07 xjack913

Can you make the Garmin Connect activity public and share the URL to the webpage? I get elapsed time of 340.741 in the lap field but when I compare max and min timestamps I get a different duration again!

echo (max($pFFA->data_mesgs['record']['timestamp']) - min($pFFA->data_mesgs['record']['timestamp']));
// Output
635

adriangibbons avatar Jul 06 '18 10:07 adriangibbons

Hi, @adriangibbons

These are other examples without session info and detail info differ with the same file uploaded to garmin connect.

2764794397.fit.txt https://connectus.garmin.cn/modern/activity/2827424537

2780451464.fit.txt https://connectus.garmin.cn/modern/activity/2844876841

2876706991.fit.txt https://connectus.garmin.cn/modern/activity/3298526012

Could you please help to fix these files as other services? Thank you very much.

xjack913 avatar Jan 14 '19 06:01 xjack913