Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何计算GPS数据?_C++_C++11_Gps - Fatal编程技术网

C++ 如何计算GPS数据?

C++ 如何计算GPS数据?,c++,c++11,gps,C++,C++11,Gps,我需要用提供的以下信息计算GPS数据 Bits size description Bits 0-25 26 Latitude Location latitude Latitude as 26-bit integer * 100,000 Bits 26-51 26 Longitude Location longitude Longitude as 26-bit integer * 100,000 基于上述信息,我理解 1) 纬度值可以是+-90.xxxxx

我需要用提供的以下信息计算GPS数据

Bits       size description 
Bits 0-25   26  Latitude    Location latitude   Latitude as 26-bit integer * 100,000
Bits 26-51  26  Longitude   Location longitude  Longitude as 26-bit integer * 100,000
基于上述信息,我理解 1) 纬度值可以是+-90.xxxxxx,即需要7位来容纳90(2^7)的值。根据这些信息,我如何计算纬度并将其转换为尾数(7位)和指数(19位)部分。还有,符号位呢?例如,值87.45需要以87存储为7位的方式存储,其中as 19位存储值45

2) 类似的经度值可能是+-180,这需要8位来适应180(2^8)的值,基于如何计算经度并将其转换为尾数(8位)和指数(18位)部分的信息。还有,符号位呢


例如,值130.50需要以一种方式存储,即130被存储到8位,其中18位存储值50。

我认为您的看法是错误的……您得到了一个52位的值,其中包含整数值lat和lon,对吗?不要担心尾数。您需要将输入的两个部分视为单独的整数,并将每个部分除以100000以获得度数

尝试以下方法:

#include <stdint.h>
int main() {
  int64_t input = yourGpsVal();
  // note: lat/lon may be the wrong way round
  // strip off the rightmost 26 bits and convert to double
  double lat = ( input >> 26 ) / 100000.;
  // zero the bits left of the rightmost 26 and convert to double
  double lon = ( input % ( 1 << 26 )) / 100000.;
}
#包括
int main(){
int64_t input=yourGpsVal();
//注:lat/lon可能是错误的循环方式
//去掉最右边的26位并转换为双精度
双lat=(输入>>26)/100000。;
//将最右边26的左边的位归零,并转换为双精度
双lon=(输入%(1