clang-tidy: modernize-use-override (NFC)

Add NOLINT to CommandTestBase due to gmock not adding "override" keyword,
which causes warnings on clang.
This commit is contained in:
Peter Johnson
2020-12-28 00:10:13 -08:00
parent 4cc0706b06
commit d11a3a6380
89 changed files with 156 additions and 151 deletions

View File

@@ -13,7 +13,7 @@ class ReplaceMeSubsystem2 : public frc2::SubsystemBase {
/**
* Will be called periodically whenever the CommandScheduler runs.
*/
void Periodic();
void Periodic() override;
private:
// Components (e.g. motor controllers and sensors) should generally be

View File

@@ -18,7 +18,7 @@ class Robot : public frc::TimedRobot {
frc::Joystick m_stick{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with arcade style
m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX());
}

View File

@@ -19,7 +19,7 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_driverController{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with split arcade style
// That means that the Y axis of the left stick moves forward
// and backward, and the X of the right stick turns left and right.

View File

@@ -63,9 +63,11 @@ class Robot : public frc::TimedRobot {
frc::sim::EncoderSim m_encoderSim{m_encoder};
public:
void RobotInit() { m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse); }
void RobotInit() override {
m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse);
}
void SimulationPeriodic() {
void SimulationPeriodic() override {
// In this method, we update our simulation of what our arm is doing
// First, we set our "inputs" (voltages)
m_armSim.SetInput(frc::MakeMatrix<1, 1>(
@@ -82,7 +84,7 @@ class Robot : public frc::TimedRobot {
frc::sim::BatterySim::Calculate({m_armSim.GetCurrentDraw()}));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
if (m_joystick.GetTrigger()) {
// Here, we run PID control like normal, with a constant setpoint of 30in.
double pidOutput =
@@ -94,7 +96,7 @@ class Robot : public frc::TimedRobot {
}
}
void DisabledInit() {
void DisabledInit() override {
// This just makes sure that our simulation code knows that the motor's off.
m_motor.Set(0.0);
}

View File

@@ -62,9 +62,11 @@ class Robot : public frc::TimedRobot {
frc::sim::EncoderSim m_encoderSim{m_encoder};
public:
void RobotInit() { m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse); }
void RobotInit() override {
m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse);
}
void SimulationPeriodic() {
void SimulationPeriodic() override {
// In this method, we update our simulation of what our elevator is doing
// First, we set our "inputs" (voltages)
m_elevatorSim.SetInput(frc::MakeMatrix<1, 1>(
@@ -81,7 +83,7 @@ class Robot : public frc::TimedRobot {
frc::sim::BatterySim::Calculate({m_elevatorSim.GetCurrentDraw()}));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
if (m_joystick.GetTrigger()) {
// Here, we run PID control like normal, with a constant setpoint of 30in.
double pidOutput =
@@ -93,7 +95,7 @@ class Robot : public frc::TimedRobot {
}
}
void DisabledInit() {
void DisabledInit() override {
// This just makes sure that our simulation code knows that the motor's off.
m_motor.Set(0.0);
}

View File

@@ -28,7 +28,7 @@ class DriveTrain : public frc::Subsystem {
* with
* the joystick.
*/
void InitDefaultCommand();
void InitDefaultCommand() override;
/**
* @param leftAxis Left sides value

View File

@@ -14,7 +14,7 @@ class DoubleButton : public frc::Trigger {
public:
DoubleButton(frc::Joystick* joy, int button1, int button2);
bool Get();
bool Get() override;
private:
frc::Joystick& m_joy;

View File

@@ -93,12 +93,12 @@ class Robot : public frc::TimedRobot {
frc::TrapezoidProfile<units::radians>::State m_lastProfiledReference;
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(
frc::MakeMatrix<2, 1>(m_encoder.GetDistance(), m_encoder.GetRate()));
@@ -107,7 +107,7 @@ class Robot : public frc::TimedRobot {
units::radians_per_second_t(m_encoder.GetRate())};
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target position of our arm. This is similar to setting the
// setpoint of a PID controller.
frc::TrapezoidProfile<units::radians>::State goal;

View File

@@ -90,13 +90,13 @@ class Robot : public frc::TimedRobot {
frc::TrapezoidProfile<units::meters>::State m_lastProfiledReference;
public:
void RobotInit() {
void RobotInit() override {
// Circumference = pi * d, so distance per click = pi * d / counts
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi *
kDrumRadius.to<double>() / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
// Reset our loop to make sure it's in a known state.
m_loop.Reset(
frc::MakeMatrix<2, 1>(m_encoder.GetDistance(), m_encoder.GetRate()));
@@ -105,7 +105,7 @@ class Robot : public frc::TimedRobot {
units::meters_per_second_t(m_encoder.GetRate())};
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target height of our elevator. This is similar to setting the
// setpoint of a PID controller.
frc::TrapezoidProfile<units::meters>::State goal;

View File

@@ -81,16 +81,16 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_joystick{kJoystickPort};
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(frc::MakeMatrix<1, 1>(m_encoder.GetRate()));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target speed of our flywheel. This is similar to setting the
// setpoint of a PID controller.
if (m_joystick.GetBumper(frc::GenericHID::kRightHand)) {

View File

@@ -82,16 +82,16 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_joystick{kJoystickPort};
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(frc::MakeMatrix<1, 1>(m_encoder.GetRate()));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target speed of our flywheel. This is similar to setting the
// setpoint of a PID controller.
if (m_joystick.GetBumper(frc::GenericHID::kRightHand)) {

View File

@@ -19,7 +19,7 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_driverController{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with tank style
m_robotDrive.TankDrive(
m_driverController.GetY(frc::GenericHID::JoystickHand::kLeftHand),