- remove NtripReconnect from Autopilot and CaptureRoute
- shiftet moveControl States in the class namespace - added auto reconeect to NtripClient - a lot of refactor
This commit is contained in:
+12
-9
@@ -47,6 +47,9 @@ MoveControl::~MoveControl() {
|
||||
delete this->right_motor;
|
||||
delete this->left_speedometer;
|
||||
delete this->right_speedometer;
|
||||
delete this->left_pid;
|
||||
delete this->right_pid;
|
||||
|
||||
}
|
||||
|
||||
void MoveControl::loop() {
|
||||
@@ -91,19 +94,19 @@ void MoveControl::runMoveControl() {
|
||||
this->regulateMotors();
|
||||
}
|
||||
|
||||
void MoveControl::setDrivingStatus(DrivingStatus status) {
|
||||
void MoveControl::setDrivingStatus(Status status) {
|
||||
this->setSpeed(0);
|
||||
this->setRotationSpeed(0);
|
||||
this->setRawPowerLeft(0);
|
||||
this->setRawPowerRight(0);
|
||||
this->driving_status = status;
|
||||
// switch (this->driving_status) {
|
||||
// case DrivingStatus::stop :
|
||||
// Serial.println("New drivingState = stop in MoveControl::setDrivingStatus");
|
||||
// case Status::Stop :
|
||||
// Serial.println("New drivingState = Stop in MoveControl::setDrivingStatus");
|
||||
// break;
|
||||
|
||||
// case DrivingStatus::drive :
|
||||
// Serial.println("New drivingState = drive in MoveControl::setDrivingStatus");
|
||||
// case Status::Drive :
|
||||
// Serial.println("New drivingState = Drive in MoveControl::setDrivingStatus");
|
||||
// break;
|
||||
|
||||
// default:
|
||||
@@ -119,7 +122,7 @@ void MoveControl::emergencyStop() {
|
||||
this->setRotationSpeed(0);
|
||||
this->setRawPowerLeft(0);
|
||||
this->setRawPowerRight(0);
|
||||
this->driving_status = DrivingStatus::stop;
|
||||
this->driving_status = Status::Stop;
|
||||
}
|
||||
|
||||
void MoveControl::setSpeed(double speed) {
|
||||
@@ -194,21 +197,21 @@ void MoveControl::calcTargetWheelSpeed() {
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
switch (this->driving_status) {
|
||||
case DrivingStatus::stop :
|
||||
case Status::Stop :
|
||||
this->left_motor->setTargetPower(0);
|
||||
this->right_motor->setTargetPower(0);
|
||||
this->setSpeedometerDirection(this->left_speedometer, 0);
|
||||
this->setSpeedometerDirection(this->right_speedometer, 0);
|
||||
break;
|
||||
|
||||
case DrivingStatus::drive :
|
||||
case Status::Drive :
|
||||
this->left_motor->setTargetPower( (int8_t) this->left_pid_out);
|
||||
this->right_motor->setTargetPower( (int8_t) this->right_pid_out);
|
||||
this->setSpeedometerDirection(this->left_speedometer, this->left_pid_out);
|
||||
this->setSpeedometerDirection(this->right_speedometer, this->right_pid_out);
|
||||
break;
|
||||
|
||||
case DrivingStatus::raw :
|
||||
case Status::Raw :
|
||||
this->left_motor->setTargetPower(this->rawPowerLeft);
|
||||
this->right_motor->setTargetPower(this->rawPowerRight);
|
||||
this->setSpeedometerDirection(this->left_speedometer, this->rawPowerLeft);
|
||||
|
||||
Reference in New Issue
Block a user