finished speed and sensor menu in modes

This commit is contained in:
2023-09-29 11:30:13 +02:00
parent d7357d4f95
commit 45264c6481
17 changed files with 96 additions and 78 deletions
+9 -11
View File
@@ -125,17 +125,13 @@ void Autopilot::init() {
this->courseCorrection.correction = 0;
this->courseCorrection.distance = 0;
this->updateDisplay = true;
this->maxRotationSpeed = 7;
this->maxForwardSpeed = 1.5;
}
void Autopilot::drive() {
this->moveControl->setRotationSpeed(0);
if (this->courseCorrection.distance >= this->minRemainingDistance)
this->moveControl->setSpeed(this->maxForwardSpeed);
else
this,moveControl->setSpeed(0);
DrivingSpeeds speeds = {0, 0};
if (this->courseCorrection.distance >= this->minRemainingDistance)
speeds.x = this->maxSpeeds.x;
this->moveControl->setSpeeds(speeds);
}
void Autopilot::beginRotate() {
@@ -145,11 +141,13 @@ void Autopilot::beginRotate() {
this->rotationAimAzimuth = this->getSensorData()->getRealAzimuth() + this->courseCorrection.correction;
this->rotationAimAzimuth = Navigation::fixDegree(this->rotationAimAzimuth);
this->moveControl->setSpeed(0);
DrivingSpeeds speeds = {0, 0};
if (this->courseCorrection.correction > 0)
this->moveControl->setRotationSpeed(-this->maxRotationSpeed);
speeds.rot = -this->maxSpeeds.rot;
else
this->moveControl->setRotationSpeed(this->maxRotationSpeed);
speeds.rot = this->maxSpeeds.rot;
this->moveControl->setSpeeds(speeds);
}
}