Skip to content

Commit

Permalink
Merge pull request #165 from alexDickhans/ad-odometry
Browse files Browse the repository at this point in the history
Change units
  • Loading branch information
alexDickhans authored Jul 26, 2022
2 parents 2a4dba5 + a05256c commit e979bea
Show file tree
Hide file tree
Showing 221 changed files with 1,961 additions and 40,885 deletions.
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

0 comments on commit e979bea

Please sign in to comment.