Skip to content

Commit eda9954

Browse files
committed
Both hatchbot examples updated and added invert
1 parent ca31989 commit eda9954

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

HatchbotInlined/subsystems/drivesubsystem.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ def __init__(self) -> None:
2020
self.right1 = wpilib.PWMVictorSPX(constants.kRightMotor1Port)
2121
self.right2 = wpilib.PWMVictorSPX(constants.kRightMotor2Port)
2222

23+
self.left1.addFollower(self.left2)
24+
self.right1.addFollower(self.right2)
25+
26+
# We need to invert one side of the drivetrain so that positive speeds
27+
# result in both sides moving forward. Depending on how your robot's
28+
# drivetrain is constructed, you might have to invert the left side instead.
29+
self.right1.setInverted(True)
30+
2331
# The robot's drive
2432
self.drive = wpilib.drive.DifferentialDrive(
25-
wpilib.MotorControllerGroup(self.left1, self.left2),
26-
wpilib.MotorControllerGroup(self.right1, self.right2),
33+
self.left1,
34+
self.right1
2735
)
2836

2937
# The left-side drive encoder

HatchbotTraditional/subsystems/drivesubsystem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ def __init__(self) -> None:
2020
self.right1 = wpilib.PWMVictorSPX(constants.kRightMotor1Port)
2121
self.right2 = wpilib.PWMVictorSPX(constants.kRightMotor2Port)
2222

23-
self.left1.addFollower(self.left2)
24-
self.right1.addFollower(self.right2)
23+
# We need to invert one side of the drivetrain so that positive speeds
24+
# result in both sides moving forward. Depending on how your robot's
25+
# drivetrain is constructed, you might have to invert the left side instead.
26+
self.right1.setInverted(True)
2527

2628
# The robot's drive
2729
self.drive = wpilib.drive.DifferentialDrive(
2830
self.left1,
29-
self.right1,
31+
self.right1
3032
)
3133

3234
# The left-side drive encoder

0 commit comments

Comments
 (0)