Package frc.alotobots
Class Robot
java.lang.Object
edu.wpi.first.wpilibj.RobotBase
edu.wpi.first.wpilibj.IterativeRobotBase
org.littletonrobotics.junction.LoggedRobot
frc.alotobots.Robot
- All Implemented Interfaces:
AutoCloseable
public class Robot
extends org.littletonrobotics.junction.LoggedRobot
Main robot class that handles robot lifecycle and mode transitions. This class extends
LoggedRobot to integrate with AdvantageKit logging framework. It manages the robot's different
operating modes (autonomous, teleop, test) and handles the scheduling of commands.
-
Field Summary
Fields inherited from class org.littletonrobotics.junction.LoggedRobot
defaultPeriodSecs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled once when autonomous mode is enabled.voidCalled periodically during autonomous mode.voidCalled once when the robot is disabled.voidCalled periodically when the robot is disabled.voidThis function is called periodically during all modes.voidCalled once when simulation mode is first enabled.voidCalled periodically during simulation mode.voidCalled once when teleop mode is enabled.voidCalled periodically during teleop mode.voidtestInit()Called once when test mode is enabled.voidCalled periodically during test mode.Methods inherited from class org.littletonrobotics.junction.LoggedRobot
endCompetition, finalize, setUseTiming, startCompetitionMethods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase
autonomousExit, disabledExit, driverStationConnected, enableLiveWindowInTest, getPeriod, isLiveWindowEnabledInTest, loopFunc, printWatchdogEpochs, robotInit, setNetworkTablesFlushEnabled, teleopExit, testExitMethods inherited from class edu.wpi.first.wpilibj.RobotBase
close, getMainThreadId, getRuntimeType, isAutonomous, isAutonomousEnabled, isDisabled, isEnabled, isReal, isSimulation, isTeleop, isTeleopEnabled, isTest, isTestEnabled, startRobot, suppressExitWarning
-
Constructor Details
-
Robot
public Robot()Constructor for the Robot class. Initializes AdvantageKit logging and sets up the robot container. Different logging configurations are used based on whether the robot is running in real, simulation, or replay mode.
-
-
Method Details
-
robotPeriodic
public void robotPeriodic()This function is called periodically during all modes. It runs the command scheduler with high priority to ensure consistent timing.- Overrides:
robotPeriodicin classIterativeRobotBase
-
disabledInit
public void disabledInit()Called once when the robot is disabled.- Overrides:
disabledInitin classIterativeRobotBase
-
disabledPeriodic
public void disabledPeriodic()Called periodically when the robot is disabled.- Overrides:
disabledPeriodicin classIterativeRobotBase
-
autonomousInit
public void autonomousInit()Called once when autonomous mode is enabled. Schedules the autonomous command selected in RobotContainer.- Overrides:
autonomousInitin classIterativeRobotBase
-
autonomousPeriodic
public void autonomousPeriodic()Called periodically during autonomous mode.- Overrides:
autonomousPeriodicin classIterativeRobotBase
-
teleopInit
public void teleopInit()Called once when teleop mode is enabled. Cancels the autonomous command if it's still running.- Overrides:
teleopInitin classIterativeRobotBase
-
teleopPeriodic
public void teleopPeriodic()Called periodically during teleop mode.- Overrides:
teleopPeriodicin classIterativeRobotBase
-
testInit
public void testInit()Called once when test mode is enabled. Cancels all running commands when entering test mode.- Overrides:
testInitin classIterativeRobotBase
-
testPeriodic
public void testPeriodic()Called periodically during test mode.- Overrides:
testPeriodicin classIterativeRobotBase
-
simulationInit
public void simulationInit()Called once when simulation mode is first enabled.- Overrides:
simulationInitin classIterativeRobotBase
-
simulationPeriodic
public void simulationPeriodic()Called periodically during simulation mode.- Overrides:
simulationPeriodicin classIterativeRobotBase
-