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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called once when autonomous mode is enabled.void
Called periodically during autonomous mode.void
Called once when the robot is disabled.void
Called periodically when the robot is disabled.void
This function is called periodically during all modes.void
Called once when simulation mode is first enabled.void
Called periodically during simulation mode.void
Called once when teleop mode is enabled.void
Called periodically during teleop mode.void
testInit()
Called once when test mode is enabled.void
Called periodically during test mode.Methods inherited from class org.littletonrobotics.junction.LoggedRobot
endCompetition, finalize, setUseTiming, startCompetition
Methods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase
autonomousExit, disabledExit, driverStationConnected, enableLiveWindowInTest, getPeriod, isLiveWindowEnabledInTest, loopFunc, printWatchdogEpochs, robotInit, setNetworkTablesFlushEnabled, teleopExit, testExit
Methods 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:
robotPeriodic
in classIterativeRobotBase
-
disabledInit
public void disabledInit()Called once when the robot is disabled.- Overrides:
disabledInit
in classIterativeRobotBase
-
disabledPeriodic
public void disabledPeriodic()Called periodically when the robot is disabled.- Overrides:
disabledPeriodic
in classIterativeRobotBase
-
autonomousInit
public void autonomousInit()Called once when autonomous mode is enabled. Schedules the autonomous command selected in RobotContainer.- Overrides:
autonomousInit
in classIterativeRobotBase
-
autonomousPeriodic
public void autonomousPeriodic()Called periodically during autonomous mode.- Overrides:
autonomousPeriodic
in classIterativeRobotBase
-
teleopInit
public void teleopInit()Called once when teleop mode is enabled. Cancels the autonomous command if it's still running.- Overrides:
teleopInit
in classIterativeRobotBase
-
teleopPeriodic
public void teleopPeriodic()Called periodically during teleop mode.- Overrides:
teleopPeriodic
in classIterativeRobotBase
-
testInit
public void testInit()Called once when test mode is enabled. Cancels all running commands when entering test mode.- Overrides:
testInit
in classIterativeRobotBase
-
testPeriodic
public void testPeriodic()Called periodically during test mode.- Overrides:
testPeriodic
in classIterativeRobotBase
-
simulationInit
public void simulationInit()Called once when simulation mode is first enabled.- Overrides:
simulationInit
in classIterativeRobotBase
-
simulationPeriodic
public void simulationPeriodic()Called periodically during simulation mode.- Overrides:
simulationPeriodic
in classIterativeRobotBase
-