diff --git a/src/main/java/frc/lib/hardware/Motors/Motor.java b/src/main/java/frc/lib/hardware/Motors/Motor.java index 1af7b13..c8d052f 100644 --- a/src/main/java/frc/lib/hardware/Motors/Motor.java +++ b/src/main/java/frc/lib/hardware/Motors/Motor.java @@ -44,7 +44,7 @@ private ControllerType(MotorController mController) { } public MotorController config(int canID) { - return mController.config(canID); + return mController.build(canID); } } diff --git a/src/main/java/frc/lib/hardware/Motors/Motor2.java b/src/main/java/frc/lib/hardware/Motors/Motor2.java index 82d4994..04c5308 100644 --- a/src/main/java/frc/lib/hardware/Motors/Motor2.java +++ b/src/main/java/frc/lib/hardware/Motors/Motor2.java @@ -34,19 +34,7 @@ protected DCMotor config() { } } - public enum ControllerType { - TallonSRX(new Talon_SRX()); - MotorController mController; - - private ControllerType(MotorController mController) { - this.mController = mController; - } - - public MotorController config(int canID) { - return mController.config(canID); - } - } // ----------------------------------------- private final MotorController mController; diff --git a/src/main/java/frc/lib/hardware/Motors/MotorControllers/MotorController.java b/src/main/java/frc/lib/hardware/Motors/MotorControllers/MotorController.java index 42ce678..22c4e28 100644 --- a/src/main/java/frc/lib/hardware/Motors/MotorControllers/MotorController.java +++ b/src/main/java/frc/lib/hardware/Motors/MotorControllers/MotorController.java @@ -4,17 +4,28 @@ public interface MotorController extends HardwareRequirements { - MotorController config(int canID); + MotorController build(int canID); + // Setting void runVolts(double num); void brakeMode(boolean enable); - void setInverted(boolean enable); + void disable(); + // Getting int getCanID(); - void disable(); + double getAppliedVolts(); + + double getCurentAmps(); + + double getBusVoltage(); + + // Config + MotorController setInverted(boolean enable); + + MotorController setCurrentLimit(double CurrentLimit); - void currentLimit(); + MotorController setSimulated(double simulated); } diff --git a/src/main/java/frc/lib/hardware/Motors/MotorControllers/Talon_SRX.java b/src/main/java/frc/lib/hardware/Motors/MotorControllers/Talon_SRX.java index f4c5a79..08201d7 100644 --- a/src/main/java/frc/lib/hardware/Motors/MotorControllers/Talon_SRX.java +++ b/src/main/java/frc/lib/hardware/Motors/MotorControllers/Talon_SRX.java @@ -10,7 +10,7 @@ public class Talon_SRX implements MotorController { private TalonSRX motor; - public MotorController config(int canID) { + public MotorController build(int canID) { this.canID = canID; motor = new TalonSRX(canID); @@ -25,21 +25,19 @@ public void runVolts(double num) { @Override public void brakeMode(boolean enable) { - if (enable) motor.setNeutralMode(NeutralMode.Brake); - else motor.setNeutralMode(NeutralMode.Coast); + if (enable) + motor.setNeutralMode(NeutralMode.Brake); + else + motor.setNeutralMode(NeutralMode.Coast); } - /** true inverts it */ - @Override - public void setInverted(boolean enable) { - motor.setInverted(enable); - } public void disable() { motor.set(ControlMode.Disabled, 0); } - public void currentLimit() {} + public void currentLimit() { + } // ---------------------------------------------------------- @Override @@ -59,5 +57,43 @@ public boolean connected() { // Unit Testing @Override - public void close() throws Exception {} + public void close() throws Exception { + } + + @Override + public double getAppliedVolts() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getAppliedVolts'"); + } + + @Override + public double getCurentAmps() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getCurentAmps'"); + } + + @Override + public double getBusVoltage() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getBusVoltage'"); + } + + @Override + public MotorController setInverted(boolean enable) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setInverted'"); + } + + @Override + public MotorController setCurrentLimit(double CurrentLimit) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setCurrentLimit'"); + } + + @Override + public MotorController setSimulated(double simulated) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setSimulated'"); + } + } diff --git a/src/main/java/frc/lib/hardware/sensor/encoders/Encoder.java b/src/main/java/frc/lib/hardware/sensor/encoders/Encoder.java index 27c7ec0..adf4e09 100644 --- a/src/main/java/frc/lib/hardware/sensor/encoders/Encoder.java +++ b/src/main/java/frc/lib/hardware/sensor/encoders/Encoder.java @@ -4,11 +4,15 @@ public interface Encoder extends HardwareRequirements { - Encoder config(); + void zero(); double getPosition(); double getVelocity(); - void setGearRatio(double gearRatio); + Encoder setGearRatio(double gearRatio); + + Encoder setInverted(boolean inverted); + + Encoder setOffset(double offset); } diff --git a/src/main/java/frc/lib/hardware/sensor/encoders/REVBoreEncoder.java b/src/main/java/frc/lib/hardware/sensor/encoders/REVBoreEncoder.java index c45fac6..aff6ee7 100644 --- a/src/main/java/frc/lib/hardware/sensor/encoders/REVBoreEncoder.java +++ b/src/main/java/frc/lib/hardware/sensor/encoders/REVBoreEncoder.java @@ -14,11 +14,6 @@ public double getVelocity() { return 20; } - @Override - public void setGearRatio(double gearRatio) { - // TODO Auto-generated method stub - } - // ---------------------------------------------------------- @Override public void toLog(LogTable table) { @@ -35,8 +30,26 @@ public boolean connected() { public void close() throws Exception {} @Override - public Encoder config() { + public void zero() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'zero'"); + } + + @Override + public Encoder setInverted(boolean inverted) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setInverted'"); + } + + @Override + public Encoder setOffset(double offset) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setOffset'"); + } - return this; + @Override + public Encoder setGearRatio(double gearRatio) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'setGearRatio'"); } }