autopilot inherits speed from manualControl

spelling
refactor
This commit is contained in:
2023-08-14 15:28:21 +02:00
parent 99dc1709d8
commit c7a19163ff
4 changed files with 22 additions and 21 deletions
+6 -3
View File
@@ -139,12 +139,15 @@ void Autopilot::init() {
this->courseCorrection.correction = 0;
this->courseCorrection.distance = 0;
this->updateDisplay = true;
this->maxRotationSpeed = 4.5;
this->maxForwardSpeed = 1;
}
void Autopilot::drive() {
this->moveControl->setRotationSpeed(0);
if (this->courseCorrection.distance >= this->minRemainingDistance)
this->moveControl->setSpeed(this->drivingSpeed);
this->moveControl->setSpeed(this->maxForwardSpeed);
else
this,moveControl->setSpeed(0);
}
@@ -158,9 +161,9 @@ void Autopilot::beginRotate() {
this->moveControl->setSpeed(0);
if (this->courseCorrection.correction > 0)
this->moveControl->setRotationSpeed(-this->rotationSpeed);
this->moveControl->setRotationSpeed(-this->maxRotationSpeed);
else
this->moveControl->setRotationSpeed(this->rotationSpeed);
this->moveControl->setRotationSpeed(this->maxRotationSpeed);
}
}