christianrauch / msp

Implementation of the MultiWii Serial Protocol (MSP) for MultiWii and Cleanflight flight controller
http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol
GNU Lesser General Public License v3.0
80 stars 27 forks source link

Incorrect GPS longitude value?? #21

Closed mwingerson closed 6 years ago

mwingerson commented 6 years ago

I was trying to get the current GPS of my vehicle streamed to my laptop and when I look at my longitude, I am getting about 312 degrees while I should be getting -117 degrees. I am fairly sure that I am just missing something simple.

Thanks! marsall

christianrauch commented 6 years ago

I only added the message definition from the MSP message overview, but I never used it. It might be an error during the deserialisation of the payload.

Have you tried to read the GPS values with one of the official GUI programs?

Which firmware are you using? It might also be that the message definition changed between thd original MultiWii and cleanflight/betaflight.

mwingerson commented 6 years ago

Sigh....it was just that I needed to cast the long and lat to a signed value.

Thanks!

christianrauch commented 6 years ago

Are you referring to the MSP_RAW_GPS? I am wondering why you need to cast the value to a signed. The lon and lat are given in 1/10000000 degree. Simply casting these uint32 to int32 will give you wrong values.

mwingerson commented 6 years ago

Sorry Christian I lost this conversation in my emails :/

For the firmware, I am using INAV/MATEKF405 1.9.0

The protocol documentation showed that the uint32_t values for lat and lon are given in 1/10000000 degrees but the lat and lon are not defined as a int32_t. They are defined as uint32_t which confused me until I realized the value should be signed.

But I figured it out. Thanks!