Package frc.robot
Class Robot
- java.lang.Object
-
- edu.wpi.first.wpilibj.RobotBase
-
- edu.wpi.first.wpilibj.IterativeRobotBase
-
- edu.wpi.first.wpilibj.TimedRobot
-
- frc.robot.Robot
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Robot extends edu.wpi.first.wpilibj.TimedRobotThe VM is configured to automatically run this class, and to call the functions corresponding to each mode, as described in the TimedRobot documentation. If you change the name of this class or the package after creating this project, you must also update the build.gradle file in the project.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringactiveModeprivate AutonomousInterfaceautonomousProgramprivate edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String>autonomousProgramsprivate Gamepad1gamepad1private Gamepad2gamepad2private doubleperiodprivate ProgramFetcherprogramFetcherprivate RobotHardwarerobotprivate TeleopInterfaceteleopProgramprivate edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String>teleopProgramsprivate TestInterfacetestProgramprivate edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String>testPrograms
-
Constructor Summary
Constructors Constructor Description Robot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautonomousInit()This autonomous (along with the chooser code above) shows how to select between different autonomous modes using the dashboard.voidautonomousPeriodic()This function is called periodically during autonomous.voiddisabledInit()This function is called once when the robot is disabled.voiddisabledPeriodic()This function is called periodically when disabled.voidrobotInit()This function is run when the robot is first started up and should be used for any initialization code.voidrobotPeriodic()This function is called every robot packet, no matter the mode.voidteleopInit()This function is called once when teleop is enabled.voidteleopPeriodic()This function is called periodically during operator control.voidtestInit()This function is called once when test mode is enabled.voidtestPeriodic()This function is called periodically during test mode.-
Methods inherited from class edu.wpi.first.wpilibj.TimedRobot
addPeriodic, addPeriodic, endCompetition, finalize, startCompetition
-
Methods inherited from class edu.wpi.first.wpilibj.IterativeRobotBase
autonomousExit, disabledExit, getPeriod, loopFunc, setNetworkTablesFlushEnabled, simulationInit, simulationPeriodic, teleopExit, testExit
-
Methods inherited from class edu.wpi.first.wpilibj.RobotBase
close, getBooleanProperty, getMainThreadId, getRuntimeType, isAutonomous, isAutonomousEnabled, isDisabled, isEnabled, isNewDataAvailable, isOperatorControl, isOperatorControlEnabled, isReal, isSimulation, isTeleop, isTeleopEnabled, isTest, startRobot, suppressExitWarning
-
-
-
-
Field Detail
-
period
private double period
-
teleopPrograms
private final edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String> teleopPrograms
-
autonomousPrograms
private final edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String> autonomousPrograms
-
testPrograms
private final edu.wpi.first.wpilibj.smartdashboard.SendableChooser<java.lang.String> testPrograms
-
robot
private RobotHardware robot
-
programFetcher
private ProgramFetcher programFetcher
-
gamepad1
private Gamepad1 gamepad1
-
gamepad2
private Gamepad2 gamepad2
-
activeMode
private java.lang.String activeMode
-
autonomousProgram
private AutonomousInterface autonomousProgram
-
teleopProgram
private TeleopInterface teleopProgram
-
testProgram
private TestInterface testProgram
-
-
Method Detail
-
robotInit
public void robotInit()
This function is run when the robot is first started up and should be used for any initialization code.- Overrides:
robotInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
robotPeriodic
public void robotPeriodic()
This function is called every robot packet, no matter the mode. Use this for items like diagnostics that you want ran during disabled, autonomous, teleoperated and test.This runs after the mode specific periodic functions, but before LiveWindow and SmartDashboard integrated updating.
- Overrides:
robotPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
autonomousInit
public void autonomousInit()
This autonomous (along with the chooser code above) shows how to select between different autonomous modes using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW Dashboard, remove all of the chooser code and uncomment the getString line to get the auto name from the text box below the GyroYou can add additional auto modes by adding additional comparisons to the switch structure below with additional strings. If using the SendableChooser make sure to add them to the chooser code above as well.
- Overrides:
autonomousInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
autonomousPeriodic
public void autonomousPeriodic()
This function is called periodically during autonomous.- Overrides:
autonomousPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopInit
public void teleopInit()
This function is called once when teleop is enabled.- Overrides:
teleopInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
teleopPeriodic
public void teleopPeriodic()
This function is called periodically during operator control.- Overrides:
teleopPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testInit
public void testInit()
This function is called once when test mode is enabled.- Overrides:
testInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
testPeriodic
public void testPeriodic()
This function is called periodically during test mode.- Overrides:
testPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledInit
public void disabledInit()
This function is called once when the robot is disabled.- Overrides:
disabledInitin classedu.wpi.first.wpilibj.IterativeRobotBase
-
disabledPeriodic
public void disabledPeriodic()
This function is called periodically when disabled.- Overrides:
disabledPeriodicin classedu.wpi.first.wpilibj.IterativeRobotBase
-
-