Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auton selector #75

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static frc.robot.Constants.VisionConstants.BACK_RIGHT_CAMERA;
import static frc.robot.Constants.VisionConstants.NOTE_CAMERA;

import java.util.EnumSet;
import java.util.function.BooleanSupplier;

import com.choreo.lib.ChoreoTrajectory;
Expand All @@ -25,6 +26,10 @@
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableEvent;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.util.PixelFormat;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.GenericHID;
Expand Down Expand Up @@ -160,15 +165,25 @@ public class RobotContainer {
private boolean isNoteTrapReady = false;
private boolean noteInBack = false;

private NetworkTableInstance ntInstance;
private NetworkTable autonTable;
private String autonValue;
private int autonHandle;
private String autoName = "A145";




/**
* The container for the robot. Contains subsystems, OI devices, and commands.
*/
public RobotContainer() {
ntInstance = NetworkTableInstance.getDefault();
autonTable = ntInstance.getTable("Auton");
// try{
autonTable.addListener("Auton", EnumSet.of(NetworkTableEvent.Kind.kValueAll), (table, key, event) -> {
this.autonValue = event.valueData.value.getString();
System.out.print("New auton value: " + this.autonValue);
});
// } catch (Exception e) {
// System.out.print(e);
// }
fmsSubsystem = new FieldManagementSubsystem();
lightBarSubsystem = new LightBarSubsystem();
superstructureSubsystem = new SuperstructureSubsystem(lightBarSubsystem, fmsSubsystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public ShooterPivotSubsystem(DoubleSupplier distanceSupplier, BooleanSupplier re

ntInstance = NetworkTableInstance.getDefault();
motorsTable = ntInstance.getTable("Motors");
shooter12CurrentEntry = motorsTable.getEntry("Shooter12CurrentEntry");
shooter12CurrentEntry = motorsTable.getEntry("Shooter12Current");
shooter12VoltageEntry = motorsTable.getEntry("Shooter12Voltage");
shooter12TemperatureEntry = motorsTable.getEntry("Shooter12Temperature");
}
Expand Down
Loading