|
@@ -196,7 +196,8 @@ int iv::decition::Compute00::getFirstNearestPointIndex(GPS_INS rp, std::vector<G
|
|
|
{
|
|
|
int index = -1;
|
|
|
// DecideGps00().minDis = iv::MaxValue;
|
|
|
- float minDis = 10;
|
|
|
+// float minDis = 10;
|
|
|
+ float minDis = 100.0;
|
|
|
double maxAng = iv::MaxValue;
|
|
|
|
|
|
int startIndex = 0; // startIndex = 0 则每一次都是遍历整条地图路线
|
|
@@ -205,7 +206,8 @@ int iv::decition::Compute00::getFirstNearestPointIndex(GPS_INS rp, std::vector<G
|
|
|
for (int j = startIndex; j < endIndex; j++)
|
|
|
{
|
|
|
int i = (j + gpsMap.size()) % gpsMap.size();
|
|
|
- double tmpdis = GetDistance(rp, (*gpsMap[i]));
|
|
|
+ double tmpdis = (rp.gps_x - gpsMap[i]->gps_x) * (rp.gps_x - gpsMap[i]->gps_x) + (rp.gps_y - gpsMap[i]->gps_y) * (rp.gps_y - gpsMap[i]->gps_y);
|
|
|
+
|
|
|
|
|
|
if (tmpdis < minDis && (abs(rp.ins_heading_angle - (*gpsMap[i]).ins_heading_angle) < 80
|
|
|
|| abs(rp.ins_heading_angle - (*gpsMap[i]).ins_heading_angle - 360) < 80
|
|
@@ -220,7 +222,7 @@ int iv::decition::Compute00::getFirstNearestPointIndex(GPS_INS rp, std::vector<G
|
|
|
}
|
|
|
|
|
|
DecideGps00().maxAngle=maxAng;
|
|
|
- DecideGps00().minDis=minDis;
|
|
|
+ DecideGps00().minDis=sqrt(minDis);
|
|
|
return index;
|
|
|
}
|
|
|
|