diff --git a/networktables.json b/networktables.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/networktables.json @@ -0,0 +1 @@ +[] diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 0000000..73cc713 --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,92 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 0000000..5f9d275 --- /dev/null +++ b/simgui.json @@ -0,0 +1,10 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo" + } + }, + "NetworkTables Info": { + "visible": true + } +} diff --git a/src/main/java/com/team841/calliope/Robot.java b/src/main/java/com/team841/calliope/Robot.java index 2bdc0dd..c6ff595 100644 --- a/src/main/java/com/team841/calliope/Robot.java +++ b/src/main/java/com/team841/calliope/Robot.java @@ -19,11 +19,13 @@ public class Robot extends LoggedRobot { private Command m_autonomousCommand; - private RobotContainer m_robotContainer = RobotContainer.getInstance(); + public static RobotContainer m_robotContainer; @Override public void robotInit() { + this.m_robotContainer = RobotContainer.getInstance(); + Logger.recordMetadata("ProjectName", "Calliope-software"); Logger.recordMetadata("TuningMode", Boolean.toString(RC.robotType == RC.RunType.DEV)); Logger.recordMetadata("ProjectName", BuildConstants.MAVEN_NAME); diff --git a/src/main/java/com/team841/calliope/RobotContainer.java b/src/main/java/com/team841/calliope/RobotContainer.java index c7e8dfc..20ef2fa 100644 --- a/src/main/java/com/team841/calliope/RobotContainer.java +++ b/src/main/java/com/team841/calliope/RobotContainer.java @@ -65,11 +65,15 @@ public class RobotContainer { private final Telemetry telemetry = new Telemetry(Swerve.MaxSpeed); - private static RobotContainer instance; + private static volatile RobotContainer instance; public static RobotContainer getInstance() { if (instance == null) { - instance = new RobotContainer(); + synchronized (RobotContainer.class) { + if (instance == null){ + instance = new RobotContainer(); + } + } } return instance; } diff --git a/src/main/java/com/team841/calliope/superstructure/indexer/IndexerIOTalonFX.java b/src/main/java/com/team841/calliope/superstructure/indexer/IndexerIOTalonFX.java index ed34bd4..888d2a7 100644 --- a/src/main/java/com/team841/calliope/superstructure/indexer/IndexerIOTalonFX.java +++ b/src/main/java/com/team841/calliope/superstructure/indexer/IndexerIOTalonFX.java @@ -10,13 +10,15 @@ public class IndexerIOTalonFX implements IndexerIO{ private final TalonFX indexerTalon = new TalonFX(RC.SC_CAN_ID.kIndexerTalon, "rio"); - private DigitalInput rightSensor = new DigitalInput(SC.Indexer.k_RightSensorChannel); - private DigitalInput leftSensor = new DigitalInput(SC.Indexer.k_LeftSensorChannel); + private final DigitalInput rightSensor; + private final DigitalInput leftSensor; private DutyCycleOut output = new DutyCycleOut(0); public IndexerIOTalonFX(){ indexerTalon.getConfigurator().apply(SC.Indexer.k_IndexerConfiguration); + this.rightSensor = new DigitalInput(SC.Indexer.k_RightSensorChannel); + this.leftSensor = new DigitalInput(SC.Indexer.k_LeftSensorChannel); } @Override diff --git a/src/main/java/com/team841/calliope/superstructure/lights/LED.java b/src/main/java/com/team841/calliope/superstructure/lights/LED.java index ed60d28..b7f1405 100644 --- a/src/main/java/com/team841/calliope/superstructure/lights/LED.java +++ b/src/main/java/com/team841/calliope/superstructure/lights/LED.java @@ -1,5 +1,6 @@ package com.team841.calliope.superstructure.lights; +import com.team841.calliope.Robot; import com.team841.calliope.RobotContainer; import com.team841.calliope.superstructure.indexer.Indexer; import com.team841.calliope.superstructure.intake.Intake; @@ -11,9 +12,9 @@ public class LED extends SubsystemBase { private final LEDIO io; private final LedIOInputsAutoLogged inputs = new LedIOInputsAutoLogged(); - private Indexer indexer = RobotContainer.getInstance().indexer; + private Indexer indexer; - private Intake intake = RobotContainer.getInstance().intake; + private Intake intake; private int count = 0; @@ -27,6 +28,11 @@ public void periodic() { io.updateInputs(inputs); Logger.processInputs("LED", inputs); + if (this.indexer == null) + this.indexer = Robot.m_robotContainer.indexer; + if (this.intake == null) + this.intake = Robot.m_robotContainer.intake; + // if (intake.) if (indexer.getRightIndexerSensor() && indexer.getLeftIndexerSensor()) { io.setColor("Green");