Skip to content

Commit

Permalink
Added alliance tracking to the core for use with auto programs
Browse files Browse the repository at this point in the history
  • Loading branch information
fruzyna committed Jan 2, 2025
1 parent a1d2d37 commit 9256cbf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/main/java/org/wildstang/framework/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.wildstang.framework.subsystems.Subsystem;
import org.wildstang.framework.subsystems.SubsystemManager;

import edu.wpi.first.wpilibj.DriverStation.Alliance;

/**
* Core of robot framework.
*/
Expand All @@ -29,6 +31,7 @@ public class Core {

private Class<?> m_inputFactoryClass;
private Class<?> m_outputFactoryClass;
private static Alliance s_alliance;

/**
* Constructor collects I/O factory and initialized framework components.
Expand Down Expand Up @@ -150,6 +153,31 @@ public void createAutoPrograms(AutoPrograms[] p_programs) {
}
}

/**
* Getter for the alliance assigned to the robot.
* @return The alliance type or null if unassigned.
*/
public static Alliance getAlliance() {
return s_alliance;
}

/**
* Statically sets the alliance for the robot, used in AutoSetupStep.
* @param alliance Alliance that the current/last auto program is designed for.
*/
public static void setAlliance(Alliance alliance) {
// TODO: do we want to prevent this from being reassigned?
s_alliance = alliance;
}

/**
* Determines if the assigned alliance is the blue alliance.
* @return Boolean representation of the alliance.
*/
public static boolean isBlue() {
return s_alliance == Alliance.Blue;
}

/**
* Returns the framework's InputManager.
* @return InputManager belonging to the framework.
Expand Down

0 comments on commit 9256cbf

Please sign in to comment.