summaryrefslogtreecommitdiff
path: root/src/main/java/frc/robot/Robot.java
blob: 7afe5f81f891b1367560388995edbc3bba149289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// 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 frc.robot;

import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkLowLevel.MotorType;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

public class Robot extends TimedRobot {
  private Command m_autonomousCommand;

  private RobotContainer m_robotContainer;

  @Override
  public void robotInit() {
    m_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() {
    m_autonomousCommand = m_robotContainer.getAutonomousCommand();

    if (m_autonomousCommand != null) {
      m_autonomousCommand.schedule();
    }
  }

  @Override
  public void autonomousPeriodic() {}

  @Override
  public void autonomousExit() {}

  @Override
  public void teleopInit() {
    if (m_autonomousCommand != null) {
      m_autonomousCommand.cancel();
    }
  }

  // GenericHID controller = Constants.controller;
  // CANSparkMax shooter_top = new CANSparkMax(21, MotorType.kBrushless);
  // CANSparkMax shooter_bottom = new CANSparkMax(22, MotorType.kBrushless);
  // CANSparkMax intakeL = new CANSparkMax(31, MotorType.kBrushless);
  // CANSparkMax intakeR = new CANSparkMax(32, MotorType.kBrushless);

  @Override
  public void teleopPeriodic() 
  {
    // shooter_top.setInverted(true);
    // shooter_bottom.setInverted(true);
    // shooter_top.set(controller.getRawAxis(1));
    // shooter_bottom.set(controller.getRawAxis(3));
    // intakeL.set(controller.getRawAxis(1));
    // intakeR.set(controller.getRawAxis(3));
  }

  @Override
  public void teleopExit() {}

  @Override
  public void testInit() {
    CommandScheduler.getInstance().cancelAll();
  }

  @Override
  public void testPeriodic() {}

  @Override
  public void testExit() {}
}