diff --git a/src/main/java/com/team1816/season/subsystems/Climber.java b/src/main/java/com/team1816/season/subsystems/Climber.java index 21cc82e..810fc1d 100644 --- a/src/main/java/com/team1816/season/subsystems/Climber.java +++ b/src/main/java/com/team1816/season/subsystems/Climber.java @@ -24,8 +24,8 @@ public class Climber extends SubsystemBase implements ITestableSubsystem { private CLIMBER_STATE previousWantedState = CLIMBER_STATE.IDLING; //MOTORS - private final IMotor flipMotor = (IMotor)factory.getDevice(NAME, "flipMotor"); - private final IMotor linearSlideMotor = (IMotor)factory.getDevice(NAME, "linearSlideMotor"); + private final IMotor flipMotor; + private final IMotor linearSlideMotor; private final PositionVoltage positionReq = new PositionVoltage(0); @@ -45,6 +45,9 @@ public class Climber extends SubsystemBase implements ITestableSubsystem { public Climber () { super(); SmartDashboard.putData("Climber", climberMech); + + flipMotor = (IMotor)factory.getDevice(NAME, "flipMotor"); + linearSlideMotor = (IMotor)factory.getDevice(NAME, "linearSlideMotor"); } @Override diff --git a/src/main/java/com/team1816/season/subsystems/Feeder.java b/src/main/java/com/team1816/season/subsystems/Feeder.java index f8cf235..a691b96 100644 --- a/src/main/java/com/team1816/season/subsystems/Feeder.java +++ b/src/main/java/com/team1816/season/subsystems/Feeder.java @@ -19,7 +19,7 @@ public class Feeder extends SubsystemBase implements ITestableSubsystem { private FEEDER_STATE previousWantedState = FEEDER_STATE.IDLING; //MOTORS - private final IMotor feedMotor = (IMotor)factory.getDevice(NAME, "feedMotor"); + private final IMotor feedMotor; private final VelocityVoltage velocityReq = new VelocityVoltage(0); @@ -27,6 +27,9 @@ public class Feeder extends SubsystemBase implements ITestableSubsystem { private static final double MIN_FEED_MOTOR_CLAMP = -80; private static final double MAX_FEED_MOTOR_CLAMP = 80; + public Feeder () { + feedMotor = (IMotor)factory.getDevice(NAME, "feedMotor"); + } @Override public void periodic() { readFromHardware(); diff --git a/src/main/java/com/team1816/season/subsystems/Gatekeeper.java b/src/main/java/com/team1816/season/subsystems/Gatekeeper.java index 7a7f9ed..17955de 100644 --- a/src/main/java/com/team1816/season/subsystems/Gatekeeper.java +++ b/src/main/java/com/team1816/season/subsystems/Gatekeeper.java @@ -18,8 +18,8 @@ public class Gatekeeper extends SubsystemBase implements ITestableSubsystem { private GATEKEEPER_STATE previousWantedState = GATEKEEPER_STATE.CLOSED; //MOTORS - private final IMotor topMotor = (IMotor)factory.getDevice(NAME, "topMotor"); - private final IMotor bottomMotor = (IMotor)factory.getDevice(NAME, "bottomMotor"); + private final IMotor topMotor; + private final IMotor bottomMotor; private final VelocityVoltage voltageReq = new VelocityVoltage(0); @@ -29,6 +29,11 @@ public class Gatekeeper extends SubsystemBase implements ITestableSubsystem { private static final double MIN_BOTTOM_MOTOR_CLAMP = 0; private static final double MAX_BOTTOM_MOTOR_CLAMP = 80; + public Gatekeeper () { + topMotor = (IMotor) factory.getDevice(NAME, "topMotor"); + bottomMotor = (IMotor) factory.getDevice(NAME, "bottomMotor"); + } + @Override public void periodic() { readFromHardware(); diff --git a/src/main/java/com/team1816/season/subsystems/Intake.java b/src/main/java/com/team1816/season/subsystems/Intake.java index f91e9b8..10534c6 100644 --- a/src/main/java/com/team1816/season/subsystems/Intake.java +++ b/src/main/java/com/team1816/season/subsystems/Intake.java @@ -23,8 +23,8 @@ public class Intake extends SubsystemBase implements ITestableSubsystem { private INTAKE_STATE previousWantedState = INTAKE_STATE.INTAKE_UP; //MOTORS - private final IMotor intakeMotor = (IMotor) factory.getDevice(NAME, "intakeMotor"); - private final IMotor flipperMotor = (IMotor) factory.getDevice(NAME, "flipperMotor"); + private final IMotor intakeMotor; + private final IMotor flipperMotor; private final VelocityVoltage velocityControl = new VelocityVoltage(0); private final PositionVoltage positionControl = new PositionVoltage(0); @@ -46,6 +46,8 @@ public class Intake extends SubsystemBase implements ITestableSubsystem { public Intake () { super(); SmartDashboard.putData("Intake", intakeMech); + intakeMotor = (IMotor) factory.getDevice(NAME, "intakeMotor"); + flipperMotor = (IMotor) factory.getDevice(NAME, "flipperMotor"); } @Override diff --git a/src/main/java/com/team1816/season/subsystems/Shooter.java b/src/main/java/com/team1816/season/subsystems/Shooter.java index 7452f33..99a1908 100644 --- a/src/main/java/com/team1816/season/subsystems/Shooter.java +++ b/src/main/java/com/team1816/season/subsystems/Shooter.java @@ -35,10 +35,10 @@ public class Shooter extends SubsystemBase implements ITestableSubsystem { private SHOOTER_STATE previousWantedState = SHOOTER_STATE.IDLE; //MOTORS - private final IMotor topLaunchMotor = (IMotor) factory.getDevice(NAME, "topLaunchMotor"); - private final IMotor bottomLaunchMotor = (IMotor) factory.getDevice(NAME, "bottomLaunchMotor"); - private final IMotor launchAngleMotor = (IMotor) factory.getDevice(NAME, "launchAngleMotor"); - private final IMotor rotationAngleMotor = (IMotor) factory.getDevice(NAME, "rotationAngleMotor"); + private final IMotor topLaunchMotor; + private final IMotor bottomLaunchMotor; + private final IMotor launchAngleMotor; + private final IMotor rotationAngleMotor; private final VelocityVoltage velocityControl = new VelocityVoltage(0); private final PositionVoltage positionControl = new PositionVoltage(0); @@ -138,6 +138,11 @@ public enum SHOOTER_STATE { public Shooter(){ super(); + topLaunchMotor = (IMotor) factory.getDevice(NAME, "topLaunchMotor"); + bottomLaunchMotor = (IMotor) factory.getDevice(NAME, "bottomLaunchMotor"); + launchAngleMotor = (IMotor) factory.getDevice(NAME, "launchAngleMotor"); + rotationAngleMotor = (IMotor) factory.getDevice(NAME, "rotationAngleMotor"); + MOTOR_ROTATIONS_PER_LAUNCH_ANGLE_DEGREE = factory.getConstant(NAME, "motorRotationsPerLaunchAngleDegree", 0); //TODO WHEN PHYSICAL SUBSYSTEM EXISTS, set this. MOTOR_ROTATIONS_PER_ROTATION_ANGLE_DEGREE = factory.getConstant(NAME, "motorRotationsPerRotationAngleDegree", 0); //TODO WHEN PHYSICAL SUBSYSTEM EXISTS, set this. SHOOTER_OFFSET = new Translation3d(factory.getConstant(NAME, "initialShooterOffsetX",0), factory.getConstant(NAME, "initialShooterOffsetY",0), factory.getConstant(NAME, "initialShooterOffsetZ",0)); //TODO WHEN PHYSICAL SUBSYSTEM EXISTS, set this.