|
@@ -107,7 +107,8 @@ float iv::decition::PIDController::getPidAngle(float realSpeed, std::vector<Poin
|
|
EPos = trace[gpsIndex].x;
|
|
EPos = trace[gpsIndex].x;
|
|
|
|
|
|
for (unsigned int i = max(0, gpsIndex - 3); i < min((size_t)(gpsIndex + 3), trace.size()); i++) {
|
|
for (unsigned int i = max(0, gpsIndex - 3); i < min((size_t)(gpsIndex + 3), trace.size()); i++) {
|
|
- farTrace.push_back(trace[gpsIndex]);
|
|
|
|
|
|
+ // farTrace.push_back(trace[gpsIndex]);
|
|
|
|
+ farTrace.push_back(trace[i]);
|
|
}
|
|
}
|
|
if (farTrace.size() == 0) {
|
|
if (farTrace.size() == 0) {
|
|
EAng = 0;
|
|
EAng = 0;
|
|
@@ -159,6 +160,7 @@ float iv::decition::PIDController::getAveDef(std::vector<Point2D> farTrace){
|
|
}
|
|
}
|
|
double average_y = sum_y / min(5, (int)farTrace.size());
|
|
double average_y = sum_y / min(5, (int)farTrace.size());
|
|
double average_x = sum_x / min(5, (int)farTrace.size());
|
|
double average_x = sum_x / min(5, (int)farTrace.size());
|
|
|
|
+ if(average_y == 0)average_y = 10.0;
|
|
return atan(average_x / average_y) / M_PI * 180;
|
|
return atan(average_x / average_y) / M_PI * 180;
|
|
}
|
|
}
|
|
|
|
|