Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Fully implement IR detection system
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Apr 4, 2022
1 parent d6d1c6c commit ea9ffc2
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@
package frc.robot.superstructure.cargo_detector;

import edu.wpi.first.wpilibj.DigitalInput;
import frc.robot.Constants;
import frc.robot.misc.exceptions.UnsupportedSubsystemException;

public class CargoDetectorIOIR implements CargoDetectorIO {
private final DigitalInput leftSensor = new DigitalInput(0);
private final DigitalInput rightSensor = new DigitalInput(1);
private final DigitalInput leftSensor;
private final DigitalInput rightSensor;

public CargoDetectorIOIR() {
switch (Constants.getRobot()) {
case TEST_2020_BOT:
leftSensor = new DigitalInput(9);
// TODO: Wire this sensor
rightSensor = new DigitalInput(25);
break;
default:
throw new UnsupportedSubsystemException(this);
}
}

@Override
public void updateInputs(Inputs inputs) {
inputs.hasLeftCargo = leftSensor.get();
inputs.hasRightCargo = rightSensor.get();
// The sensor outputs an off signal when it triggers, so we invert the return value
inputs.hasLeftCargo = !leftSensor.get();
inputs.hasRightCargo = !rightSensor.get();
}
}

0 comments on commit ea9ffc2

Please sign in to comment.