-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aea82cd
commit b36b3ef
Showing
6 changed files
with
62 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package frc.team5115; | ||
|
||
import frc.team5115.subsystems.sensor.Sensor; | ||
import frc.team5115.subsystems.sensor.SensorIO; | ||
import frc.team5115.subsystems.sensor.SensorIOPololu; | ||
|
||
public class RobotContainer { | ||
private final Sensor sensor; | ||
|
||
public RobotContainer() { | ||
switch (Constants.currentMode) { | ||
case REAL: | ||
sensor = new Sensor(new SensorIOPololu()); | ||
break; | ||
|
||
case SIM: | ||
sensor = new Sensor(new SensorIO() {}); | ||
break; | ||
|
||
default: | ||
sensor = new Sensor(new SensorIO() {}); | ||
break; | ||
} | ||
sensor.setDefaultCommand(sensor.printState()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
package frc.team5115.subsystems.sensor; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import org.littletonrobotics.junction.Logger; | ||
|
||
public class Sensor extends SubsystemBase { | ||
private final SensorIO io; | ||
private final SensorIO io; | ||
private final SensorIOInputsAutoLogged inputs = new SensorIOInputsAutoLogged(); | ||
|
||
public Sensor (SensorIO io) { | ||
this.io = io; | ||
} | ||
public Sensor(SensorIO io) { | ||
this.io = io; | ||
} | ||
|
||
|
||
@Override | ||
public void periodic() { | ||
io.updateInputs(inputs); | ||
Logger.processInputs(getName(), inputs); | ||
} | ||
|
||
public Command printState() { | ||
return Commands.print("Something Detected?" + inputs.somethingDetected); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters