Class Robot
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class org.littletonrobotics.junction.LoggedRobot
defaultPeriodSecs -
Constructor Summary
ConstructorsConstructorDescriptionRobot()Creates the robot and initializes logging, replay, and container wiring. -
Method Summary
Modifier and TypeMethodDescriptionvoidRuns once when the robot exits autonomous mode; no-op by default.voidSeeds the robot pose and schedules the selected autonomous routine.voidRuns each loop during autonomous; command scheduler handles execution.voidRuns once when the robot exits the disabled state; no-op by default.voidRuns once when the robot enters the disabled state; no-op by default.voidRuns each loop while the robot is disabled.voidRuns once every scheduler cycle regardless of robot mode.voidRuns once when the simulator first starts.voidRuns once when the robot exits teleop mode; no-op by default.voidSeeds the robot pose and cancels any lingering autonomous command when teleop begins.voidRuns each loop during teleop; command scheduler handles execution.voidtestExit()Runs once when the robot exits test mode; no-op by default.voidtestInit()Cancels all active commands when test mode begins.voidRuns each loop during test mode; no-op by default.Methods inherited from class org.littletonrobotics.junction.LoggedRobot
close, endCompetition, setUseTiming, startCompetitionMethods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase
driverStationConnected, enableLiveWindowInTest, getPeriod, isLiveWindowEnabledInTest, loopFunc, printWatchdogEpochs, robotInit, setNetworkTablesFlushEnabled, simulationPeriodicMethods inherited from class edu.wpi.first.wpilibj.RobotBase
getMainThreadId, getRuntimeType, isAutonomous, isAutonomousEnabled, isDisabled, isEnabled, isReal, isSimulation, isTeleop, isTeleopEnabled, isTest, isTestEnabled, startRobot, suppressExitWarning
-
Constructor Details
-
Robot
public Robot()Creates the robot and initializes logging, replay, and container wiring.
-
-
Method Details
-
robotPeriodic
public void robotPeriodic()Runs once every scheduler cycle regardless of robot mode.Refreshes the cached environment state so all code this cycle uses the same snapshot, then advances the command scheduler.
- Overrides:
robotPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledInit
public void disabledInit()Runs once when the robot enters the disabled state; no-op by default.- Overrides:
disabledInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledPeriodic
public void disabledPeriodic()Runs each loop while the robot is disabled.In simulation, detects alliance or station changes and resets the robot pose so the simulated robot moves to the correct start location immediately.
- Overrides:
disabledPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledExit
public void disabledExit()Runs once when the robot exits the disabled state; no-op by default.- Overrides:
disabledExitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
simulationInit
public void simulationInit()Runs once when the simulator first starts.Seeds the drivebase with a computed start pose so the simulated robot appears at a realistic field location rather than the origin.
- Overrides:
simulationInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
autonomousInit
public void autonomousInit()Seeds the robot pose and schedules the selected autonomous routine.On a real robot the pose is reset from the latest vision measurement so the autonomous path starts at the correct field location. In simulation a computed start pose is used instead since cameras are not present.
- Overrides:
autonomousInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
autonomousPeriodic
public void autonomousPeriodic()Runs each loop during autonomous; command scheduler handles execution.- Overrides:
autonomousPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
autonomousExit
public void autonomousExit()Runs once when the robot exits autonomous mode; no-op by default.- Overrides:
autonomousExitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopInit
public void teleopInit()Seeds the robot pose and cancels any lingering autonomous command when teleop begins.In simulation a computed start pose is used. On real hardware without FMS, the pose is reset from the latest vision measurement so driver-relative controls start from an accurate field position. During competition (FMS attached), the vision subsystem's automatic odometry reset handles pose seeding, so an explicit reset here is skipped to avoid overwriting the already-converged estimate.
- Overrides:
teleopInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopPeriodic
public void teleopPeriodic()Runs each loop during teleop; command scheduler handles execution.- Overrides:
teleopPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopExit
public void teleopExit()Runs once when the robot exits teleop mode; no-op by default.- Overrides:
teleopExitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testInit
public void testInit()Cancels all active commands when test mode begins.- Overrides:
testInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testPeriodic
public void testPeriodic()Runs each loop during test mode; no-op by default.- Overrides:
testPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testExit
public void testExit()Runs once when the robot exits test mode; no-op by default.- Overrides:
testExitin classedu.wpi.first.wpilibj.IterativeRobotBase
-