Skip to content

Commit

Permalink
Fixed the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Anhysteretic committed Sep 22, 2024
1 parent 35ff2f7 commit 6d458c7
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 7 deletions.
1 change: 1 addition & 0 deletions networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
92 changes: 92 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
10 changes: 10 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo"
}
},
"NetworkTables Info": {
"visible": true
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/team841/calliope/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/team841/calliope/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand All @@ -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");
Expand Down

0 comments on commit 6d458c7

Please sign in to comment.