Package frc.robot

Class Robot

java.lang.Object
edu.wpi.first.wpilibj.RobotBase
edu.wpi.first.wpilibj.IterativeRobotBase
org.littletonrobotics.junction.LoggedRobot
frc.robot.Robot
All Implemented Interfaces:
AutoCloseable

public class Robot extends org.littletonrobotics.junction.LoggedRobot
Main robot class that owns the command scheduler and logging setup.
  • Field Summary

    Fields inherited from class org.littletonrobotics.junction.LoggedRobot

    defaultPeriodSecs
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the robot and initializes logging, replay, and container wiring.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs once when the robot exits autonomous mode; no-op by default.
    void
    Seeds the robot pose and schedules the selected autonomous routine.
    void
    Runs each loop during autonomous; command scheduler handles execution.
    void
    Runs once when the robot exits the disabled state; no-op by default.
    void
    Runs once when the robot enters the disabled state; no-op by default.
    void
    Runs each loop while the robot is disabled.
    void
    Runs once every scheduler cycle regardless of robot mode.
    void
    Runs once when the simulator first starts.
    void
    Runs once when the robot exits teleop mode; no-op by default.
    void
    Seeds the robot pose and cancels any lingering autonomous command when teleop begins.
    void
    Runs each loop during teleop; command scheduler handles execution.
    void
    Runs once when the robot exits test mode; no-op by default.
    void
    Cancels all active commands when test mode begins.
    void
    Runs each loop during test mode; no-op by default.

    Methods inherited from class org.littletonrobotics.junction.LoggedRobot

    close, endCompetition, setUseTiming, startCompetition

    Methods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase

    driverStationConnected, enableLiveWindowInTest, getPeriod, isLiveWindowEnabledInTest, loopFunc, printWatchdogEpochs, robotInit, setNetworkTablesFlushEnabled, simulationPeriodic

    Methods inherited from class edu.wpi.first.wpilibj.RobotBase

    getMainThreadId, getRuntimeType, isAutonomous, isAutonomousEnabled, isDisabled, isEnabled, isReal, isSimulation, isTeleop, isTeleopEnabled, isTest, isTestEnabled, startRobot, suppressExitWarning

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      robotPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
    • disabledInit

      public void disabledInit()
      Runs once when the robot enters the disabled state; no-op by default.
      Overrides:
      disabledInit in class edu.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:
      disabledPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
    • disabledExit

      public void disabledExit()
      Runs once when the robot exits the disabled state; no-op by default.
      Overrides:
      disabledExit in class edu.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:
      simulationInit in class edu.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:
      autonomousInit in class edu.wpi.first.wpilibj.IterativeRobotBase
    • autonomousPeriodic

      public void autonomousPeriodic()
      Runs each loop during autonomous; command scheduler handles execution.
      Overrides:
      autonomousPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
    • autonomousExit

      public void autonomousExit()
      Runs once when the robot exits autonomous mode; no-op by default.
      Overrides:
      autonomousExit in class edu.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:
      teleopInit in class edu.wpi.first.wpilibj.IterativeRobotBase
    • teleopPeriodic

      public void teleopPeriodic()
      Runs each loop during teleop; command scheduler handles execution.
      Overrides:
      teleopPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
    • teleopExit

      public void teleopExit()
      Runs once when the robot exits teleop mode; no-op by default.
      Overrides:
      teleopExit in class edu.wpi.first.wpilibj.IterativeRobotBase
    • testInit

      public void testInit()
      Cancels all active commands when test mode begins.
      Overrides:
      testInit in class edu.wpi.first.wpilibj.IterativeRobotBase
    • testPeriodic

      public void testPeriodic()
      Runs each loop during test mode; no-op by default.
      Overrides:
      testPeriodic in class edu.wpi.first.wpilibj.IterativeRobotBase
    • testExit

      public void testExit()
      Runs once when the robot exits test mode; no-op by default.
      Overrides:
      testExit in class edu.wpi.first.wpilibj.IterativeRobotBase