Skip to content

Commit

Permalink
Merge pull request strongback#31 from Team3132/ballDetection
Browse files Browse the repository at this point in the history
Change the source for the beam breaks.
  • Loading branch information
mrwaldron authored Feb 29, 2020
2 parents 92a286b + b33843c commit 69b8e1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ private Constants() {
*/
public static final int LOADER_SPINNER_MOTOR_CAN_ID = 12;
public static final int LOADER_PASSTHROUGH_MOTOR_CAN_ID = 11;
public static final int IN_BALL_DETECTOR_DIO_PORT = 0;
public static final int OUT_BALL_DETECTOR_DIO_PORT = 1;
public static final int PADDLE_SOLENOID_PORT = 2;
public static final double LOADER_MOTOR_RPM = 600;
public static final double PASSTHROUGH_MOTOR_CURRENT = 1.0;
public static final int PADDLE_SOLENOID_PORT = 2;
public static final double LOADER_MAIN_MOTOR_SCALE = 4096/10; // ticks per rotation
public static final double LOADER_SPINNER_P = 0.4;
public static final double LOADER_SPINNER_I = 0;
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/frc/robot/subsystems/Subsystems.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.strongback.hardware.Hardware;
import org.strongback.mock.Mock;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.I2C;

import frc.robot.Constants;
Expand Down Expand Up @@ -453,11 +454,14 @@ public void createLoader() {
}

Motor spinnerMotor = MotorFactory.getLoaderSpinnerMotor(config.loaderSpinnerCanID, false, Constants.LOADER_SPINNER_P, Constants.LOADER_SPINNER_I, Constants.LOADER_SPINNER_D, Constants.LOADER_SPINNER_F, log);
//TODO: replace with appropriate subsystem PIDF values.
// TODO: replace with appropriate subsystem PIDF values.
Motor loaderPassthroughMotor = MotorFactory.getLoaderPassthroughMotor(config.loaderPassthroughCanID, false, 0, 0, 0, 0, log);
Solenoid paddleSolenoid = Hardware.Solenoids.singleSolenoid(config.pcmCanId, Constants.PADDLE_SOLENOID_PORT, 0.1, 0.1);
BooleanSupplier loaderInSensor = () -> spinnerMotor.isAtForwardLimit();
BooleanSupplier loaderOutSensor = () -> spinnerMotor.isAtReverseLimit();
// The ball sensors are connected to the DIO ports on the rio.
DigitalInput inBallSensor = new DigitalInput(Constants.IN_BALL_DETECTOR_DIO_PORT);
DigitalInput outBallSensor = new DigitalInput(Constants.OUT_BALL_DETECTOR_DIO_PORT);
BooleanSupplier loaderInSensor = () -> inBallSensor.get();
BooleanSupplier loaderOutSensor = () -> outBallSensor.get();
loader = new Loader(spinnerMotor, loaderPassthroughMotor, paddleSolenoid, loaderInSensor, loaderOutSensor, ledStrip, dashboard, log);
Strongback.executor().register(loader, Priority.LOW);

Expand Down

0 comments on commit 69b8e1c

Please sign in to comment.