mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Don't force public variables to use Hungarian notation (#8774)
People generally have expressed a dislike for the Hungarian notation used in member variables, especially in examples/templates, and our styleguide shouldn't be forced on downstream consumers, so this removes all Hungarian notation from the examples/templates. There are _some_ benefits to Hungarian for private member variables (like knowing what's a member vs. local in a PR review) so we'll keep private member variables the same for now, but public variables should no longer use Hungarian notation, since it looks much worse. A new PMD XPath rule has been added to accomplish this goal. Some other non-compliant variables were fixed for the new rule.
This commit is contained in:
@@ -22,12 +22,12 @@
|
||||
class Drivetrain {
|
||||
public:
|
||||
Drivetrain() {
|
||||
m_imu.ResetYaw();
|
||||
imu.ResetYaw();
|
||||
// We need to invert one side of the drivetrain so that positive voltages
|
||||
// result in both sides moving forward. Depending on how your robot's
|
||||
// gearbox is constructed, you might have to invert the left side instead.
|
||||
m_frontRightMotor.SetInverted(true);
|
||||
m_backRightMotor.SetInverted(true);
|
||||
frontRightMotor.SetInverted(true);
|
||||
backRightMotor.SetInverted(true);
|
||||
}
|
||||
|
||||
wpi::math::MecanumDriveWheelPositions GetCurrentWheelDistances() const;
|
||||
@@ -46,37 +46,37 @@ class Drivetrain {
|
||||
std::numbers::pi}; // 1/2 rotation per second
|
||||
|
||||
private:
|
||||
wpi::PWMSparkMax m_frontLeftMotor{1};
|
||||
wpi::PWMSparkMax m_frontRightMotor{2};
|
||||
wpi::PWMSparkMax m_backLeftMotor{3};
|
||||
wpi::PWMSparkMax m_backRightMotor{4};
|
||||
wpi::PWMSparkMax frontLeftMotor{1};
|
||||
wpi::PWMSparkMax frontRightMotor{2};
|
||||
wpi::PWMSparkMax backLeftMotor{3};
|
||||
wpi::PWMSparkMax backRightMotor{4};
|
||||
|
||||
wpi::Encoder m_frontLeftEncoder{0, 1};
|
||||
wpi::Encoder m_frontRightEncoder{2, 3};
|
||||
wpi::Encoder m_backLeftEncoder{4, 5};
|
||||
wpi::Encoder m_backRightEncoder{6, 7};
|
||||
wpi::Encoder frontLeftEncoder{0, 1};
|
||||
wpi::Encoder frontRightEncoder{2, 3};
|
||||
wpi::Encoder backLeftEncoder{4, 5};
|
||||
wpi::Encoder backRightEncoder{6, 7};
|
||||
|
||||
wpi::math::Translation2d m_frontLeftLocation{0.381_m, 0.381_m};
|
||||
wpi::math::Translation2d m_frontRightLocation{0.381_m, -0.381_m};
|
||||
wpi::math::Translation2d m_backLeftLocation{-0.381_m, 0.381_m};
|
||||
wpi::math::Translation2d m_backRightLocation{-0.381_m, -0.381_m};
|
||||
wpi::math::Translation2d frontLeftLocation{0.381_m, 0.381_m};
|
||||
wpi::math::Translation2d frontRightLocation{0.381_m, -0.381_m};
|
||||
wpi::math::Translation2d backLeftLocation{-0.381_m, 0.381_m};
|
||||
wpi::math::Translation2d backRightLocation{-0.381_m, -0.381_m};
|
||||
|
||||
wpi::math::PIDController m_frontLeftPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController m_frontRightPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController m_backLeftPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController m_backRightPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController frontLeftPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController frontRightPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController backLeftPIDController{1.0, 0.0, 0.0};
|
||||
wpi::math::PIDController backRightPIDController{1.0, 0.0, 0.0};
|
||||
|
||||
wpi::OnboardIMU m_imu{wpi::OnboardIMU::FLAT};
|
||||
wpi::OnboardIMU imu{wpi::OnboardIMU::FLAT};
|
||||
|
||||
wpi::math::MecanumDriveKinematics m_kinematics{
|
||||
m_frontLeftLocation, m_frontRightLocation, m_backLeftLocation,
|
||||
m_backRightLocation};
|
||||
wpi::math::MecanumDriveKinematics kinematics{
|
||||
frontLeftLocation, frontRightLocation, backLeftLocation,
|
||||
backRightLocation};
|
||||
|
||||
wpi::math::MecanumDriveOdometry m_odometry{
|
||||
m_kinematics, m_imu.GetRotation2d(), GetCurrentWheelDistances()};
|
||||
wpi::math::MecanumDriveOdometry odometry{kinematics, imu.GetRotation2d(),
|
||||
GetCurrentWheelDistances()};
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own
|
||||
// robot!
|
||||
wpi::math::SimpleMotorFeedforward<wpi::units::meters> m_feedforward{
|
||||
wpi::math::SimpleMotorFeedforward<wpi::units::meters> feedforward{
|
||||
1_V, 3_V / 1_mps};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user