Add setting to invert the right side of the drive (#1045)

This commit is contained in:
Austin Shalit
2018-05-19 04:22:20 -04:00
committed by Peter Johnson
parent 73439d8213
commit 17401e10f0
6 changed files with 135 additions and 29 deletions

View File

@@ -115,6 +115,9 @@ class DifferentialDrive : public RobotDriveBase {
void SetQuickStopThreshold(double threshold);
void SetQuickStopAlpha(double alpha);
bool IsRightSideInverted() const;
void SetRightSideInverted(bool rightSideInverted);
void StopMotor() override;
void GetDescription(wpi::raw_ostream& desc) const override;
@@ -127,6 +130,7 @@ class DifferentialDrive : public RobotDriveBase {
double m_quickStopThreshold = kDefaultQuickStopThreshold;
double m_quickStopAlpha = kDefaultQuickStopAlpha;
double m_quickStopAccumulator = 0.0;
double m_rightSideInvertMultiplier = -1.0;
};
} // namespace frc

View File

@@ -76,6 +76,9 @@ class MecanumDrive : public RobotDriveBase {
double gyroAngle = 0.0);
void DrivePolar(double magnitude, double angle, double zRotation);
bool IsRightSideInverted() const;
void SetRightSideInverted(bool rightSideInverted);
void StopMotor() override;
void GetDescription(wpi::raw_ostream& desc) const override;
@@ -87,6 +90,8 @@ class MecanumDrive : public RobotDriveBase {
SpeedController& m_frontRightMotor;
SpeedController& m_rearRightMotor;
double m_rightSideInvertMultiplier = -1.0;
bool reported = false;
};