From 26eb03f8fc2d90cbbc58233e43a85bd291574d10 Mon Sep 17 00:00:00 2001 From: Finn Frankis Date: Sun, 14 Oct 2018 16:58:38 -0700 Subject: [PATCH] Add getters and correct visibility issues in DrivetrainSubsystem --- .../subsystems/DrivetrainSubsystem.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/harkerrobolib/subsystems/DrivetrainSubsystem.java b/src/harkerrobolib/subsystems/DrivetrainSubsystem.java index 6d4cbc7..385d624 100644 --- a/src/harkerrobolib/subsystems/DrivetrainSubsystem.java +++ b/src/harkerrobolib/subsystems/DrivetrainSubsystem.java @@ -21,7 +21,7 @@ public abstract class DrivetrainSubsystem extends Subsystem { private IMotorController rightFollower; private boolean hasFollowers; - private DrivetrainSubsystem (TalonSRXWrapper leftMaster, TalonSRXWrapper rightMaster, IMotorController leftFollower, + public DrivetrainSubsystem (TalonSRXWrapper leftMaster, TalonSRXWrapper rightMaster, IMotorController leftFollower, IMotorController rightFollower) { this.leftMaster = leftMaster; this.rightMaster = rightMaster; @@ -30,7 +30,7 @@ private DrivetrainSubsystem (TalonSRXWrapper leftMaster, TalonSRXWrapper rightMa hasFollowers = true; } - private DrivetrainSubsystem (TalonSRXWrapper leftMaster, TalonSRXWrapper rightMaster) { + public DrivetrainSubsystem (TalonSRXWrapper leftMaster, TalonSRXWrapper rightMaster) { this(leftMaster, rightMaster, null, null); hasFollowers = false; } @@ -52,6 +52,7 @@ public void applyToAll (Consumer consumer) { public void initializeSubsystem() { followMasters(); } + public void followMasters () { if (hasFollowers) { leftFollower.follow(leftMaster); @@ -79,6 +80,19 @@ public void setCurrentLimit (int peakLimit, int peakTime, int continuousLimit) { setCurrentLimit(peakLimit, peakTime, continuousLimit, -1); } - public abstract DrivetrainSubsystem getInstance(); - + public TalonSRXWrapper getLeftTalon() { + return leftMaster; + } + + public TalonSRXWrapper getRightMaster() { + return rightMaster; + } + + public IMotorController getLeftFollower() { + return leftFollower; + } + + public IMotorController getRightFollower() { + return rightFollower; + } }