mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +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:
@@ -17,7 +17,7 @@ class MyRobot(wpilib.TimedRobot):
|
||||
super().__init__()
|
||||
|
||||
self.inst = ntcore.NetworkTableInstance.getDefault()
|
||||
self.doubleArrayTopic = self.inst.getDoubleArrayTopic("m_doubleArrayTopic")
|
||||
self.doubleArrayTopic = self.inst.getDoubleArrayTopic("doubleArrayTopic")
|
||||
|
||||
self.controller = wpilib.NiDsXboxController(0)
|
||||
self.drive = Drivetrain(self.doubleArrayTopic)
|
||||
|
||||
@@ -112,21 +112,17 @@ class SwerveModule:
|
||||
encoderRotation
|
||||
)
|
||||
|
||||
# Calculate the drive output from the drive PID controller.
|
||||
# Calculate the drive output from the drive PID controller and feedforward.
|
||||
driveOutput = self.drivePIDController.calculate(
|
||||
self.driveEncoder.getRate(), velocity.velocity
|
||||
)
|
||||
) + self.driveFeedforward.calculate(velocity.velocity)
|
||||
|
||||
driveFeedforward = self.driveFeedforward.calculate(velocity.velocity)
|
||||
|
||||
# Calculate the turning motor output from the turning PID controller.
|
||||
# Calculate the turning motor output from the turning PID controller and feedforward.
|
||||
turnOutput = self.turningPIDController.calculate(
|
||||
self.turningEncoder.getDistance(), velocity.angle.radians()
|
||||
)
|
||||
|
||||
turnFeedforward = self.turnFeedforward.calculate(
|
||||
) + self.turnFeedforward.calculate(
|
||||
self.turningPIDController.getSetpoint().velocity
|
||||
)
|
||||
|
||||
self.driveMotor.setVoltage(driveOutput + driveFeedforward)
|
||||
self.turningMotor.setVoltage(turnOutput + turnFeedforward)
|
||||
self.driveMotor.setVoltage(driveOutput)
|
||||
self.turningMotor.setVoltage(turnOutput)
|
||||
|
||||
Reference in New Issue
Block a user