delete magic numbers in autopilot
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user