mholow / gsp-r10-adapter

MIT License
62 stars 16 forks source link

Possible issue with device setup units #36

Open rbrundritt opened 9 months ago

rbrundritt commented 9 months ago

Digging through the code I find it a bit odd that the Garmin device appears to use a mix of metric and imperial values. The "LaunchMonitor.Proto" doesn't provide any insights on this, and I suspect there is not publicly documented information on it's schema.

In the BluetoothConnection.cs file, when calling ShotConfig method of the launch monitor, temperature and altitude are in Fahrenheit/feet, while the tee distance is converted to meters. Similarly, the speed data returned by the launch monitor all appear to be in meters per second.

I'm wondering if temperature and altitude should be metric (Celsius/meters). Temperature has some impact on the shot but it's not huge, so confusing the units here likely won't make that much of a difference (maybe a couple yards). Altitude can make a bigger difference, however, if the default is zero, many may not notice any issue.

mholow commented 9 months ago

I agree. It could very well be incorrect. This entire interface was reverse engineered so I have no documentation or insight into their design decisions.

I think I came to conclusions about units based on Bluetooth traffic captured when using the official app to configure the device. ie i think I’ve seen the app configure temperature as 60, leading me to assume Fahrenheit.

This is definitely something I’ll look into though, because I agree it does seem odd. Thanks for bringing it to my attention.

rbrundritt commented 9 months ago

Ok, cool. I'll do some testing as well.

rbrundritt commented 9 months ago

I didn't see any of this information when inspecting the initial messages from the device. Not sure how you reverse engineered that part.

As an experiment I went through and passed in random values (no conversion) into the ShotConfig and looked to see if the success response was true or false.

Temp Altitude Tee Distance ShotConfig Response
0 0 1 false
0 0 2 true
0 0 3 true
0 0 4 true
0 0 5 false
-10 0 3 true
60 0 3 true
100 0 3 true
131 0 3 true
-40 0 3 true
0 30000 3 true
0 -30000 3 true

Findings

In the Garmin golf app I played around with changing the settings of the units, and it did give me the option to set altitude in meters (range of 0 to 3,048), and temperature in Celsius (range of -9 to 54). If you are listening to the device communications to see what the Garmin app sends, changing the unit settings in your app may make a difference, although I didn't see any way to specify units via the proto schema.

All this said, the Garmin device doesn't provide a carry distance value (pretty sure this is left up to the sim apps to figure out). So the impact of temperature and altitude may be negligible.

Possible further testing

If I get a chance later this week I was thinking I could try various temp/altitude values, and take a bunch of shots, and see if there is any noticeable difference.

What I'm trying to accomplish

You might be wondering why I'm diving to this level of detail. I've been playing around with creating a simple sim app and as part of that I've put together a reusable .NET Maui library that can directly connect to Garmin R10 based on this project. Eventually I'll make that open source so others who want to create cross platform sim apps can use it. I have an machine learning model I created for launch monitor data that calculates distance and a few other things that I'll include in a sample since that will likely be the next biggest roadblock for developers.

mholow commented 9 months ago

really interesting analysis. Sounds like a pretty cool project you’re working on. I’m definitely interested to see how it turns out. I’ve actually been wanting to do a Maui ui for this connector but haven’t had the time.

All this said, the Garmin device doesn't provide a carry distance value (pretty sure this is left up to the sim apps to figure out). So the impact of temperature and altitude may be negligible.

I think I’m remembering now that this was the reason I never really cared about figuring out these settings. The launch monitor provides speed and direction and the sim software does the rest of the calculation taking temp and altitude into account.

If I get a moment I’ll dust off the reverse engineering setup and see if the official app even includes these fields in the shot config request. Theres a chance they were found in the protos but unused by the app/device.