Class LocalizationState
java.lang.Object
frc.alotobots.library.subsystems.vision.localizationfusion.LocalizationState
Manages the state machine for the robot localization system.
This class implements a hierarchical state machine that controls transitions between different pose estimation sources based on their availability and reliability. The system follows this hierarchy:
1. Quest SLAM as primary source (120Hz updates) 2. AprilTags as backup source 3. Odometry as emergency fallback
State transitions are logged for debugging and monitoring purposes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the possible states of the localization system. -
Constructor Summary
ConstructorDescriptionCreates a new LocalizationState instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isInState
(LocalizationState.State... states) Checks if the system is currently in any of the specified states.void
transitionTo
(LocalizationState.State newState) Attempts to transition to a new state.
-
Constructor Details
-
LocalizationState
Creates a new LocalizationState instance.- Parameters:
logger
- Logger to record state transitions
-
-
Method Details
-
transitionTo
Attempts to transition to a new state. The transition will be logged through the StateTransitionLogger. Invalid transitions will be logged but not executed.- Parameters:
newState
- The target state to transition to
-
isInState
Checks if the system is currently in any of the specified states. This is useful for checking multiple valid states at once.- Parameters:
states
- Variable number of states to check against- Returns:
- true if current state matches any of the specified states
-