finished speed and sensor menu in modes
This commit is contained in:
+11
-6
@@ -105,20 +105,25 @@ void MoveControl::emergencyStop() {
|
||||
|
||||
void MoveControl::setSpeed(double speed) {
|
||||
if (speed < 0.2 && speed > -0.2) {
|
||||
this->x_speed = 0;
|
||||
this->drivingSpeeds.x = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
this->x_speed = speed;
|
||||
this->drivingSpeeds.x = speed;
|
||||
}
|
||||
|
||||
void MoveControl::setRotationSpeed(double speed) {
|
||||
if (speed < 0.1 && speed > -0.1){
|
||||
this->rotation_speed = 0;
|
||||
this->drivingSpeeds.rot = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
this->rotation_speed = speed;
|
||||
this->drivingSpeeds.rot = speed;
|
||||
}
|
||||
|
||||
void MoveControl::setSpeeds(DrivingSpeeds drivingSpeeds) {
|
||||
this->setSpeed(drivingSpeeds.x);
|
||||
this->setRotationSpeed(drivingSpeeds.rot);
|
||||
}
|
||||
|
||||
void MoveControl::setRawPowerLeft(int16_t power) {
|
||||
@@ -169,8 +174,8 @@ void MoveControl::calcTargetWheelSpeed() {
|
||||
// (1 / r) * b
|
||||
constexpr double B = 2.096518987;
|
||||
|
||||
this->wheelspeed_right_target = (A * this->x_speed + B * this->rotation_speed) * (Settings::wheelDiameter / 2);
|
||||
this->wheelspeed_left_target = (A * this->x_speed + (-B) * this->rotation_speed) * (Settings::wheelDiameter / 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);
|
||||
}
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
|
||||
Reference in New Issue
Block a user