Class LocalizationFusion
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.alotobots.library.subsystems.vision.localizationfusion.LocalizationFusion
- All Implemented Interfaces:
Sendable,Subsystem,StateTransitionLogger
The LocalizationFusion subsystem manages robot pose estimation by fusing data from multiple
sources. It primarily uses Oculus Quest SLAM for continuous tracking, with AprilTag detection as
a backup and validation source. The system handles initialization, validation, and switching
between sources based on their availability and reliability.
-
Constructor Summary
ConstructorsConstructorDescriptionLocalizationFusion(PoseVisionConsumer poseConsumer, OculusPoseSource oculusSource, AprilTagPoseSource aprilTagSource, org.littletonrobotics.junction.networktables.LoggedDashboardChooser<Command> autoChooser) Creates a new LocalizationFusion subsystem. -
Method Summary
Modifier and TypeMethodDescriptionvoidLogs state transitions with descriptive messages.voidperiodic()Periodic update method called by the command scheduler.booleanrequestResetOculusPose(Pose2d targetPose) Manually triggers a pose reset to a specific pose.booleanManually triggers a pose reset using the current AprilTag pose.Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
LocalizationFusion
public LocalizationFusion(PoseVisionConsumer poseConsumer, OculusPoseSource oculusSource, AprilTagPoseSource aprilTagSource, org.littletonrobotics.junction.networktables.LoggedDashboardChooser<Command> autoChooser) Creates a new LocalizationFusion subsystem.- Parameters:
poseConsumer- The consumer interface that will receive pose updatesoculusSource- The primary pose source using Quest SLAMaprilTagSource- The secondary pose source using AprilTags
-
-
Method Details
-
periodic
public void periodic()Periodic update method called by the command scheduler. Handles system state updates, source initialization, and pose processing. -
requestResetOculusPoseViaAprilTags
public boolean requestResetOculusPoseViaAprilTags()Manually triggers a pose reset using the current AprilTag pose.- Returns:
- true if reset was initiated successfully
-
requestResetOculusPose
Manually triggers a pose reset to a specific pose.- Parameters:
targetPose- The pose to reset to- Returns:
- true if reset was initiated successfully
-
logTransition
Logs state transitions with descriptive messages.- Specified by:
logTransitionin interfaceStateTransitionLogger- Parameters:
from- The previous stateto- The new state
-