Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change units #165

Merged
merged 16 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed firmware/okapilib.a
Binary file not shown.
Binary file removed firmware/pros-grafana-lib.a
Binary file not shown.
1 change: 0 additions & 1 deletion firmware/squiggles.mk

This file was deleted.

95 changes: 0 additions & 95 deletions include/auton/autonSelector.hpp

This file was deleted.

6 changes: 3 additions & 3 deletions include/chassis/abstractHolonomicDrivetrain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ namespace Pronounce
class AbstractHolonomicDrivetrain : public AbstractDrivetrain {
private:
public:
AbstractHolonomicDrivetrain();
AbstractHolonomicDrivetrain() {}

virtual double getSpeed() { return 0; }
virtual QSpeed getSpeed() { return 0.0; }

virtual void setDriveVectorVelocity(Vector vector) {}
virtual void setDriveVectorVelocity(Vector vector, double rotation) {}

~AbstractHolonomicDrivetrain();
~AbstractHolonomicDrivetrain() {}
};

} // namespace Pronounce
3 changes: 2 additions & 1 deletion include/chassis/abstractTankDrivetrain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "abstractDrivetrain.hpp"
#include "utils/utils.hpp"
#include "units/units.hpp"
#include <iostream>

namespace Pronounce {
Expand All @@ -12,7 +13,7 @@ namespace Pronounce {
AbstractTankDrivetrain();
AbstractTankDrivetrain(double trackWidth);

virtual double getSpeed() { return 0; }
virtual QSpeed getSpeed() { return 0.0; }

double getTrackWidth() {
return trackWidth;
Expand Down
4 changes: 1 addition & 3 deletions include/chassis/drivetrain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ namespace Pronounce {
*/
virtual double getSpeed() { return 0; }

~Drivetrain() {

}
~Drivetrain() {}
};
} // namespace Pronounce

107 changes: 0 additions & 107 deletions include/chassis/mecanumDrivetrain.hpp

This file was deleted.

44 changes: 0 additions & 44 deletions include/chassis/simDrivetrain.hpp

This file was deleted.

38 changes: 0 additions & 38 deletions include/chassis/simTankDrivetrain.hpp

This file was deleted.

31 changes: 26 additions & 5 deletions include/chassis/xdrive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "utils/vector.hpp"

namespace Pronounce {
class XDrive : public Drivetrain, AbstractHolonomicDrivetrain {
class XDrive : public Drivetrain, public AbstractHolonomicDrivetrain {
private:

pros::Motor* frontLeftMotor;
Expand Down Expand Up @@ -43,10 +43,29 @@ namespace Pronounce {
}

void setDriveVectorVelocity(Vector vector, double rotation) {
this->frontLeftMotor->move_velocity(vector.getCartesian().getY() + vector.getCartesian().getX() + rotation);
this->frontRightMotor->move_velocity(vector.getCartesian().getY() - vector.getCartesian().getX() - rotation);
this->backLeftMotor->move_velocity(vector.getCartesian().getY() - vector.getCartesian().getX() + rotation);
this->backRightMotor->move_velocity(vector.getCartesian().getY() + vector.getCartesian().getX() - rotation);
double frontLeftVelocity = (vector.getCartesian().getY() + vector.getCartesian().getX()).getValue() + rotation;
double frontRightVelocity = (vector.getCartesian().getY() - vector.getCartesian().getX()).getValue() - rotation;
double backLeftVelocity = (vector.getCartesian().getY() - vector.getCartesian().getX()).getValue() + rotation;
double backRightVelocity = (vector.getCartesian().getY() + vector.getCartesian().getX()).getValue() - rotation;

double maxVal = abs(frontLeftVelocity);
maxVal = maxVal > abs(frontRightVelocity) ? maxVal : abs(frontRightVelocity);
maxVal = maxVal > abs(backLeftVelocity) ? maxVal : abs(backLeftVelocity);
maxVal = maxVal > abs(backRightVelocity) ? maxVal : abs(backRightVelocity);

if (maxVal > 200.0) {
double adjustment = maxVal/200.0;

frontLeftVelocity *= adjustment;
frontRightVelocity *= adjustment;
backLeftVelocity *= adjustment;
backRightVelocity *= adjustment;
}

this->frontLeftMotor->move_velocity(frontLeftVelocity);
this->frontRightMotor->move_velocity(frontRightVelocity);
this->backLeftMotor->move_velocity(backLeftVelocity);
this->backRightMotor->move_velocity(backRightVelocity);
}

void setDriveVectorVelocity(Vector vector) {
Expand All @@ -66,5 +85,7 @@ namespace Pronounce {
return total / 4;
}

~XDrive() {}

};
}
Loading