Initial Commit of new gen branch
This commit is contained in:
72
src/main/java/first/robot/Robot.java
Normal file
72
src/main/java/first/robot/Robot.java
Normal file
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package first.robot;
|
||||
|
||||
import org.wpilib.command2.Command;
|
||||
import org.wpilib.command2.CommandScheduler;
|
||||
import org.wpilib.framework.TimedRobot;
|
||||
|
||||
public class Robot extends TimedRobot {
|
||||
private Command autonomousCommand;
|
||||
|
||||
private final RobotContainer robotContainer;
|
||||
|
||||
public Robot() {
|
||||
robotContainer = new RobotContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
CommandScheduler.getInstance().run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disabledInit() {}
|
||||
|
||||
@Override
|
||||
public void disabledPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void disabledExit() {}
|
||||
|
||||
@Override
|
||||
public void autonomousInit() {
|
||||
autonomousCommand = robotContainer.getAutonomousCommand();
|
||||
|
||||
if (autonomousCommand != null) {
|
||||
CommandScheduler.getInstance().schedule(autonomousCommand);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autonomousPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void autonomousExit() {
|
||||
if (autonomousCommand != null) {
|
||||
autonomousCommand.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopInit() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void teleopExit() {}
|
||||
|
||||
@Override
|
||||
public void utilityInit() {
|
||||
CommandScheduler.getInstance().cancelAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void utilityPeriodic() {}
|
||||
|
||||
@Override
|
||||
public void utilityExit() {}
|
||||
}
|
||||
Reference in New Issue
Block a user