【问题标题】:Calculate Heading with two GPS Devices使用两个 GPS 设备计算航向
【发布时间】:2017-08-14 14:21:11
【问题描述】:

您好,我计划使用两个 RTK-GPS 设备来获取户外机器人的位置和航向。两台设备分别放置在机器人左右两侧,相距2m。标题应该是 0 到 2*PI 之间的值。如果机器人朝北,则为 0。

我正在尝试以下方法:

double x1 = gps_left->latitude;
double y1 = gps_left->longitude;
double x2 = gps_right->latitude;
double y2 = gps_right->longitude;

double dx = x2-x1;
double dy = y2-y1;

// get the normal of the line
double nx = dy*-1;
double ny = dx;

double angle = atan2(ny ,nx);

即使我旋转机器人,角度总是保持不变

【问题讨论】:

  • 添加一些您的机器人已捕获的x1y1x2y2 值示例可能会很有用。我怀疑两个 GPS 单元可能返回相同的值,因为它们可能的分辨率和设备的分离。

标签: gps robotics robot


【解决方案1】:
double x1 = gps_left->latitude;
double y1 = gps_left->longitude;
double x2 = gps_right->latitude;
double y2 = gps_right->longitude;

double dy = y2-y1;

double nx = cos(x2)*sin(dy);
double ny = cos(x1)*sin(dy) - sin(x1)*cos(x2)*cos(dy);

double angle = atan2(nx,ny);

你可以试试这个吗?

0 - 向北行驶, 90 - 向东行驶, 180 - 向南行驶, 270 - 向西行驶。

【讨论】:

    【解决方案2】:

    像@Mark Booth 一样,分辨率可能还不够。我们遇到了类似的问题,所以我们使用了磁力计来解决这个问题。使用来自磁力计和 GPS 的航向信息,我们能够成功导航。

    【讨论】:

      猜你喜欢
      • 2013-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-19
      • 2023-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多