73 lines
1.5 KiB
Java
73 lines
1.5 KiB
Java
// 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() {}
|
|
}
|