Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
Add getters and correct visibility issues in DrivetrainSubsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnitoProductions committed Oct 14, 2018
1 parent ef26776 commit 26eb03f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/harkerrobolib/subsystems/DrivetrainSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -52,6 +52,7 @@ public void applyToAll (Consumer<IMotorController> consumer) {
public void initializeSubsystem() {
followMasters();
}

public void followMasters () {
if (hasFollowers) {
leftFollower.follow(leftMaster);
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 26eb03f

Please sign in to comment.