Added debugMqtt and autoPilot

This commit is contained in:
2021-05-06 14:17:46 +02:00
parent 15bce31197
commit b5f2288db2
11 changed files with 322 additions and 30 deletions
+15 -14
View File
@@ -25,7 +25,7 @@ void MoveControl::runMoveControl() {
this->regulateMotors();
}
void MoveControl::setDrivingStatus(drivingStatus status) {
void MoveControl::setDrivingStatus(DrivingStatus status) {
this->driving_status = status;
}
@@ -53,13 +53,14 @@ void MoveControl::calcWheelSpeed() {
}
void MoveControl::regulateMotors() {
double ratio = 0;
switch (this->driving_status) {
case drivingStatus::stop :
case DrivingStatus::stop :
this->left_motor->setTargetPower(0);
this->right_motor->setTargetPower(0);
break;
case drivingStatus::straightForward :
case DrivingStatus::straightForward :
// Left motor
// Too slow
if (this->left_speedometer->getSpeed() < this->wheelspeed_left_target
@@ -89,7 +90,7 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::straightBackward :
case DrivingStatus::straightBackward :
// Left motor
// Too slow
if (this->left_speedometer->getSpeed() > this->wheelspeed_left_target
@@ -119,8 +120,8 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::arcForwardLeft : // Identical with arcForwardRight
double ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
case DrivingStatus::arcForwardLeft : // Identical with arcForwardRight
ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
// Left motor
// Too slow
@@ -151,8 +152,8 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::arcForwardRight : // Identical with arcForwardLeft
double ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
case DrivingStatus::arcForwardRight : // Identical with arcForwardLeft
ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
// Left motor
// Too slow
@@ -183,8 +184,8 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::arcBackwardLeft : // Identical with arcBackwardRight
double ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
case DrivingStatus::arcBackwardLeft : // Identical with arcBackwardRight
ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
// Left motor
// Too slow
@@ -215,8 +216,8 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::arcBackwardRight : // Identical with arcBackwardLeft
double ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
case DrivingStatus::arcBackwardRight : // Identical with arcBackwardLeft
ratio = this->wheelspeed_left_target / this->wheelspeed_right_target;
// Left motor
// Too slow
@@ -247,7 +248,7 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::rotateLeft :
case DrivingStatus::rotateLeft :
// Left motor
// Too slow
if (this->left_speedometer->getSpeed() > this->wheelspeed_left_target
@@ -277,7 +278,7 @@ void MoveControl::regulateMotors() {
}
break;
case drivingStatus::rotateRight :
case DrivingStatus::rotateRight :
// Left motor
// Too slow
if (this->left_speedometer->getSpeed() < this->wheelspeed_left_target