【发布时间】: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);
即使我旋转机器人,角度总是保持不变
【问题讨论】:
-
添加一些您的机器人已捕获的
x1、y1、x2和y2值示例可能会很有用。我怀疑两个 GPS 单元可能返回相同的值,因为它们可能的分辨率和设备的分离。