delete magic numbers in autopilot

This commit is contained in:
2022-03-03 10:29:16 +01:00
parent d97be897c1
commit 552c98c71a
4 changed files with 65 additions and 10 deletions
+9 -9
View File
@@ -80,20 +80,20 @@ void Autopilot::setSelfDriving(bool val) {
}
void Autopilot::setSpeedInRelToDistance(double distance) {
// TODO: Delte Magic Numbers
if (distance > 2)
this->moveControl->setSpeed(1.5);
else if (distance < 0.5)
this->moveControl->setSpeed(1.5);
else
if (distance >= MIN_DISTANCE_TO_NEXT_POINT)
this->moveControl->setSpeed(AUTOPILOT_MAX_SPEED);
else if (distance < MIN_DISTANCE_TO_NEXT_POINT)
this->moveControl->setSpeed(AUTOPILOT_SPEED_2);
else {
this->moveControl->setSpeed(0);
std::cout << "Error in Autopilot::setSpeedInRelToDistance" << std::endl;
}
}
void Autopilot::setRotInRelToDistance(int16_t course) {
// TODO: Delte Magic Numbers
int8_t steps = course / 30;
int8_t steps = course / COURSE_CORRECTION_FACTOR;
if (steps == 0 && abs(course) >= 5)
if (steps == 0 && abs(course) >= MIN_COURSE_CORRECTION_TO_ACT)
steps = 1;
if (course == 0)