Skip to content

Commit

Permalink
publishes intake sensor values to NT
Browse files Browse the repository at this point in the history
  • Loading branch information
6kn4eakfr4s committed Apr 3, 2024
1 parent e041eb2 commit 34c1e58
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import javax.imageio.plugins.tiff.TIFFDirectory;

import org.apache.commons.math3.ml.neuralnet.Network;

import com.ctre.phoenix.motorcontrol.TalonSRXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.revrobotics.CANSparkLowLevel.MotorType;
Expand All @@ -19,6 +21,7 @@

import edu.wpi.first.networktables.BooleanPublisher;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.AnalogPotentiometer;
import edu.wpi.first.wpilibj.DigitalInput;
Expand Down Expand Up @@ -47,6 +50,11 @@ public class IntakeRollerSubsystem extends SubsystemBase {
private BooleanPublisher ntFrontPublisher;
private BooleanPublisher ntBackPublisher;

private NetworkTable intakeNTTable;
private NetworkTableEntry frontSensorEntry;
private NetworkTableEntry rockwellSensorEntry;
private NetworkTableEntry ampSenSorEntry;

private final LightBarSubsystem lightBarSubsystem;

private Timer colorResetTimer;
Expand All @@ -66,6 +74,10 @@ public IntakeRollerSubsystem(LightBarSubsystem lightBarSubsystem) {

ntInstance = NetworkTableInstance.getDefault();
ntTable = ntInstance.getTable("RobotStatus");
intakeNTTable = ntInstance.getTable("Intake");
frontSensorEntry = intakeNTTable.getEntry("FrontSensor");
rockwellSensorEntry = intakeNTTable.getEntry("Rockwell");
ampSenSorEntry - intakeNTTable.getEntry("AMPSensor");
ntFrontPublisher = ntTable.getBooleanTopic("frontSensor").publish();
ntBackPublisher = ntTable.getBooleanTopic("backSensor").publish();

Expand Down Expand Up @@ -133,6 +145,9 @@ public boolean getAmpSensor() {

@Override
public void periodic() {
frontSensorEntry.setBoolean(getFrontSensorReached());
rockwellSensorEntry.setBoolean(getRockwellSensorValue());
ampSenSorEntry.setBoolean(getAmpSensor());

ntFrontPublisher.set(getFrontSensorReached());
prevFrontSensorValue = getFrontSensorValue();
Expand Down

0 comments on commit 34c1e58

Please sign in to comment.