finished speed and sensor menu in modes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user