Merge branch 'main' of git.kleiax.de:kleiax/Projektarbeit-Rover
This commit is contained in:
+13
-9
@@ -44,7 +44,7 @@ MoveControl::MoveControl() {
|
||||
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
||||
|
||||
this->addChildComponent(this->left_motor);
|
||||
this->addChildComponent(this->right_motor);
|
||||
this->addChildComponent(this->right_motor);
|
||||
this->addChildComponent(this->left_speedometer);
|
||||
this->addChildComponent(this->right_speedometer);
|
||||
}
|
||||
@@ -80,11 +80,15 @@ void MoveControl::setDrivingStatus(Status status) {
|
||||
this->driving_status = status;
|
||||
// switch (this->driving_status) {
|
||||
// case Status::Stop :
|
||||
// Serial.println("New drivingState = Stop in MoveControl::setDrivingStatus");
|
||||
// std::cout << "New drivingState = Stop in MoveControl::setDrivingStatus" << std::endl;
|
||||
// break;
|
||||
|
||||
// case Status::Drive :
|
||||
// Serial.println("New drivingState = Drive in MoveControl::setDrivingStatus");
|
||||
// std::cout << "New drivingState = Drive in MoveControl::setDrivingStatus" << std::endl;
|
||||
// break;
|
||||
|
||||
// case Status::Raw :
|
||||
// std::cout << "New drivingState = Raw in MoveControl::setDrivingStatus" << std::endl;
|
||||
// break;
|
||||
|
||||
// default:
|
||||
@@ -169,12 +173,12 @@ void MoveControl::calcTargetWheelSpeed() {
|
||||
\ 1 -b / \ T / \ Xr / */
|
||||
|
||||
// (1 / r) * 1
|
||||
constexpr double A = 15.82278481;
|
||||
constexpr double A = 1.0 / (Settings::wheelDiameter / 2);
|
||||
// (1 / r) * b
|
||||
constexpr double B = 2.096518987;
|
||||
constexpr double B = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
||||
|
||||
this->wheelspeed_right_target = (A * this->drivingSpeeds.x + B * this->drivingSpeeds.rot) * (Settings::wheelDiameter / 2);
|
||||
this->wheelspeed_left_target = (A * this->drivingSpeeds.x + (-B) * this->drivingSpeeds.rot) * (Settings::wheelDiameter / 2);
|
||||
this->wheelspeed_right_target = (A * this->drivingSpeeds.x + B * this->drivingSpeeds.rot);
|
||||
this->wheelspeed_left_target = (A * this->drivingSpeeds.x + (-B) * this->drivingSpeeds.rot);
|
||||
}
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
@@ -207,6 +211,6 @@ void MoveControl::regulateMotors() {
|
||||
}
|
||||
|
||||
void MoveControl::updateCurrentWheelSpeed() {
|
||||
this->wheelspeed_left = this->left_speedometer->getSpeed();
|
||||
this->wheelspeed_right = this->right_speedometer->getSpeed();
|
||||
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
||||
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user