mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpilib] Use inclusive language where practical (#2533)
Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -48,9 +48,9 @@ class ExampleSmartMotorController : public frc::SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
void Follow(ExampleSmartMotorController master) {}
|
||||
void Follow(ExampleSmartMotorController leader) {}
|
||||
|
||||
/**
|
||||
* Returns the encoder distance.
|
||||
|
||||
@@ -60,13 +60,13 @@ class Drivetrain {
|
||||
static constexpr double kWheelRadius = 0.0508; // meters
|
||||
static constexpr int kEncoderResolution = 4096;
|
||||
|
||||
frc::PWMVictorSPX m_leftMaster{1};
|
||||
frc::PWMVictorSPX m_leftLeader{1};
|
||||
frc::PWMVictorSPX m_leftFollower{2};
|
||||
frc::PWMVictorSPX m_rightMaster{3};
|
||||
frc::PWMVictorSPX m_rightLeader{3};
|
||||
frc::PWMVictorSPX m_rightFollower{4};
|
||||
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftMaster, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightMaster, m_rightFollower};
|
||||
frc::SpeedControllerGroup m_leftGroup{m_leftLeader, m_leftFollower};
|
||||
frc::SpeedControllerGroup m_rightGroup{m_rightLeader, m_rightFollower};
|
||||
|
||||
frc::Encoder m_leftEncoder{0, 1};
|
||||
frc::Encoder m_rightEncoder{2, 3};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -10,16 +10,16 @@
|
||||
using namespace DriveConstants;
|
||||
|
||||
DriveSubsystem::DriveSubsystem()
|
||||
: m_leftMaster{kLeftMotor1Port},
|
||||
m_leftSlave{kLeftMotor2Port},
|
||||
m_rightMaster{kRightMotor1Port},
|
||||
m_rightSlave{kRightMotor2Port},
|
||||
: m_leftLeader{kLeftMotor1Port},
|
||||
m_leftFollower{kLeftMotor2Port},
|
||||
m_rightLeader{kRightMotor1Port},
|
||||
m_rightFollower{kRightMotor2Port},
|
||||
m_feedforward{ks, kv, ka} {
|
||||
m_leftSlave.Follow(m_leftMaster);
|
||||
m_rightSlave.Follow(m_rightMaster);
|
||||
m_leftFollower.Follow(m_leftLeader);
|
||||
m_rightFollower.Follow(m_rightLeader);
|
||||
|
||||
m_leftMaster.SetPID(kp, 0, 0);
|
||||
m_rightMaster.SetPID(kp, 0, 0);
|
||||
m_leftLeader.SetPID(kp, 0, 0);
|
||||
m_rightLeader.SetPID(kp, 0, 0);
|
||||
}
|
||||
|
||||
void DriveSubsystem::Periodic() {
|
||||
@@ -29,10 +29,10 @@ void DriveSubsystem::Periodic() {
|
||||
void DriveSubsystem::SetDriveStates(
|
||||
frc::TrapezoidProfile<units::meters>::State left,
|
||||
frc::TrapezoidProfile<units::meters>::State right) {
|
||||
m_leftMaster.SetSetpoint(ExampleSmartMotorController::PIDMode::kPosition,
|
||||
m_leftLeader.SetSetpoint(ExampleSmartMotorController::PIDMode::kPosition,
|
||||
left.position.to<double>(),
|
||||
m_feedforward.Calculate(left.velocity) / 12_V);
|
||||
m_rightMaster.SetSetpoint(ExampleSmartMotorController::PIDMode::kPosition,
|
||||
m_rightLeader.SetSetpoint(ExampleSmartMotorController::PIDMode::kPosition,
|
||||
right.position.to<double>(),
|
||||
m_feedforward.Calculate(right.velocity) / 12_V);
|
||||
}
|
||||
@@ -42,16 +42,16 @@ void DriveSubsystem::ArcadeDrive(double fwd, double rot) {
|
||||
}
|
||||
|
||||
void DriveSubsystem::ResetEncoders() {
|
||||
m_leftMaster.ResetEncoder();
|
||||
m_rightMaster.ResetEncoder();
|
||||
m_leftLeader.ResetEncoder();
|
||||
m_rightLeader.ResetEncoder();
|
||||
}
|
||||
|
||||
units::meter_t DriveSubsystem::GetLeftEncoderDistance() {
|
||||
return units::meter_t(m_leftMaster.GetEncoderDistance());
|
||||
return units::meter_t(m_leftLeader.GetEncoderDistance());
|
||||
}
|
||||
|
||||
units::meter_t DriveSubsystem::GetRightEncoderDistance() {
|
||||
return units::meter_t(m_rightMaster.GetEncoderDistance());
|
||||
return units::meter_t(m_rightLeader.GetEncoderDistance());
|
||||
}
|
||||
|
||||
void DriveSubsystem::SetMaxOutput(double maxOutput) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -48,9 +48,9 @@ class ExampleSmartMotorController : public frc::SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
void Follow(ExampleSmartMotorController master) {}
|
||||
void Follow(ExampleSmartMotorController leader) {}
|
||||
|
||||
/**
|
||||
* Returns the encoder distance.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -77,14 +77,14 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
// The motor controllers
|
||||
ExampleSmartMotorController m_leftMaster;
|
||||
ExampleSmartMotorController m_leftSlave;
|
||||
ExampleSmartMotorController m_rightMaster;
|
||||
ExampleSmartMotorController m_rightSlave;
|
||||
ExampleSmartMotorController m_leftLeader;
|
||||
ExampleSmartMotorController m_leftFollower;
|
||||
ExampleSmartMotorController m_rightLeader;
|
||||
ExampleSmartMotorController m_rightFollower;
|
||||
|
||||
// A feedforward component for the drive
|
||||
frc::SimpleMotorFeedforward<units::meters> m_feedforward;
|
||||
|
||||
// The robot's drive
|
||||
frc::DifferentialDrive m_drive{m_leftMaster, m_rightMaster};
|
||||
frc::DifferentialDrive m_drive{m_leftLeader, m_rightLeader};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -48,9 +48,9 @@ class ExampleSmartMotorController : public frc::SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
void Follow(ExampleSmartMotorController master) {}
|
||||
void Follow(ExampleSmartMotorController leader) {}
|
||||
|
||||
/**
|
||||
* Returns the encoder distance.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -53,9 +53,9 @@ public class ExampleSmartMotorController implements SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
public void follow(ExampleSmartMotorController master) {
|
||||
public void follow(ExampleSmartMotorController leader) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,18 +31,18 @@ public class Drivetrain {
|
||||
private static final double kWheelRadius = 0.0508; // meters
|
||||
private static final int kEncoderResolution = 4096;
|
||||
|
||||
private final SpeedController m_leftMaster = new PWMVictorSPX(1);
|
||||
private final SpeedController m_leftLeader = new PWMVictorSPX(1);
|
||||
private final SpeedController m_leftFollower = new PWMVictorSPX(2);
|
||||
private final SpeedController m_rightMaster = new PWMVictorSPX(3);
|
||||
private final SpeedController m_rightLeader = new PWMVictorSPX(3);
|
||||
private final SpeedController m_rightFollower = new PWMVictorSPX(4);
|
||||
|
||||
private final Encoder m_leftEncoder = new Encoder(0, 1);
|
||||
private final Encoder m_rightEncoder = new Encoder(2, 3);
|
||||
|
||||
private final SpeedControllerGroup m_leftGroup
|
||||
= new SpeedControllerGroup(m_leftMaster, m_leftFollower);
|
||||
= new SpeedControllerGroup(m_leftLeader, m_leftFollower);
|
||||
private final SpeedControllerGroup m_rightGroup
|
||||
= new SpeedControllerGroup(m_rightMaster, m_rightFollower);
|
||||
= new SpeedControllerGroup(m_rightLeader, m_rightFollower);
|
||||
|
||||
private final AnalogGyro m_gyro = new AnalogGyro(0);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -53,9 +53,9 @@ public class ExampleSmartMotorController implements SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
public void follow(ExampleSmartMotorController master) {
|
||||
public void follow(ExampleSmartMotorController leader) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -17,16 +17,16 @@ import edu.wpi.first.wpilibj.examples.drivedistanceoffboard.ExampleSmartMotorCon
|
||||
|
||||
public class DriveSubsystem extends SubsystemBase {
|
||||
// The motors on the left side of the drive.
|
||||
private final ExampleSmartMotorController m_leftMaster =
|
||||
private final ExampleSmartMotorController m_leftLeader =
|
||||
new ExampleSmartMotorController(DriveConstants.kLeftMotor1Port);
|
||||
|
||||
private final ExampleSmartMotorController m_leftSlave =
|
||||
private final ExampleSmartMotorController m_leftFollower =
|
||||
new ExampleSmartMotorController(DriveConstants.kLeftMotor2Port);
|
||||
|
||||
private final ExampleSmartMotorController m_rightMaster =
|
||||
private final ExampleSmartMotorController m_rightLeader =
|
||||
new ExampleSmartMotorController(DriveConstants.kRightMotor1Port);
|
||||
|
||||
private final ExampleSmartMotorController m_rightSlave =
|
||||
private final ExampleSmartMotorController m_rightFollower =
|
||||
new ExampleSmartMotorController(DriveConstants.kRightMotor2Port);
|
||||
|
||||
private final SimpleMotorFeedforward m_feedforward =
|
||||
@@ -35,17 +35,17 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
DriveConstants.kaVoltSecondsSquaredPerMeter);
|
||||
|
||||
// The robot's drive
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftMaster, m_rightMaster);
|
||||
private final DifferentialDrive m_drive = new DifferentialDrive(m_leftLeader, m_rightLeader);
|
||||
|
||||
/**
|
||||
* Creates a new DriveSubsystem.
|
||||
*/
|
||||
public DriveSubsystem() {
|
||||
m_leftSlave.follow(m_leftMaster);
|
||||
m_rightSlave.follow(m_rightMaster);
|
||||
m_leftFollower.follow(m_leftLeader);
|
||||
m_rightFollower.follow(m_rightLeader);
|
||||
|
||||
m_leftMaster.setPID(DriveConstants.kp, 0, 0);
|
||||
m_rightMaster.setPID(DriveConstants.kp, 0, 0);
|
||||
m_leftLeader.setPID(DriveConstants.kp, 0, 0);
|
||||
m_rightLeader.setPID(DriveConstants.kp, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,10 +65,10 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
* @param right The right wheel state.
|
||||
*/
|
||||
public void setDriveStates(TrapezoidProfile.State left, TrapezoidProfile.State right) {
|
||||
m_leftMaster.setSetpoint(ExampleSmartMotorController.PIDMode.kPosition,
|
||||
m_leftLeader.setSetpoint(ExampleSmartMotorController.PIDMode.kPosition,
|
||||
left.position,
|
||||
m_feedforward.calculate(left.velocity));
|
||||
m_rightMaster.setSetpoint(ExampleSmartMotorController.PIDMode.kPosition,
|
||||
m_rightLeader.setSetpoint(ExampleSmartMotorController.PIDMode.kPosition,
|
||||
right.position,
|
||||
m_feedforward.calculate(right.velocity));
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
* @return the left encoder distance
|
||||
*/
|
||||
public double getLeftEncoderDistance() {
|
||||
return m_leftMaster.getEncoderDistance();
|
||||
return m_leftLeader.getEncoderDistance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,15 +88,15 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
* @return the right encoder distance
|
||||
*/
|
||||
public double getRightEncoderDistance() {
|
||||
return m_rightMaster.getEncoderDistance();
|
||||
return m_rightLeader.getEncoderDistance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the drive encoders.
|
||||
*/
|
||||
public void resetEncoders() {
|
||||
m_leftMaster.resetEncoder();
|
||||
m_rightMaster.resetEncoder();
|
||||
m_leftLeader.resetEncoder();
|
||||
m_rightLeader.resetEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -53,9 +53,9 @@ public class ExampleSmartMotorController implements SpeedController {
|
||||
/**
|
||||
* Places this motor controller in follower mode.
|
||||
*
|
||||
* @param master The master to follow.
|
||||
* @param leader The leader to follow.
|
||||
*/
|
||||
public void follow(ExampleSmartMotorController master) {
|
||||
public void follow(ExampleSmartMotorController leader) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.fixtures;
|
||||
import edu.wpi.first.wpilibj.test.TestBench;
|
||||
|
||||
/**
|
||||
* Master interface for all test fixtures. This ensures that all test fixtures have setup and
|
||||
* Common interface for all test fixtures. This ensures that all test fixtures have setup and
|
||||
* teardown methods, to ensure that the tests run properly. Test fixtures should be modeled around
|
||||
* the content of a test, rather than the actual physical layout of the testing board. They should
|
||||
* obtain references to hardware from the {@link TestBench} class, which is a singleton. Testing
|
||||
|
||||
Reference in New Issue
Block a user