update code
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
cca02549 3import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
6f3b6d29 4import org.usfirst.frc.team3501.robot.subsystems.Intake;
079a8cb6 5import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6acd1f1b 6
38a404b3
KZ
7import edu.wpi.first.wpilibj.IterativeRobot;
8import edu.wpi.first.wpilibj.command.Scheduler;
34ffcd03 9import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
38a404b3
KZ
10
11public class Robot extends IterativeRobot {
6acd1f1b 12 private static DriveTrain driveTrain;
414d5638 13 private static Shooter shooter;
6acd1f1b 14 private static OI oi;
6f3b6d29 15 private static Intake intake;
38a404b3
KZ
16
17 @Override
18 public void robotInit() {
6acd1f1b
CZ
19 driveTrain = DriveTrain.getDriveTrain();
20 oi = OI.getOI();
079a8cb6 21 shooter = Shooter.getShooter();
6f3b6d29 22 intake = Intake.getIntake();
cca02549 23 }
6acd1f1b
CZ
24
25 public static DriveTrain getDriveTrain() {
26 return DriveTrain.getDriveTrain();
cca02549 27 }
6acd1f1b 28
414d5638 29 public static Shooter getShooter() {
30 return Shooter.getShooter();
31 }
32
6acd1f1b
CZ
33 public static OI getOI() {
34 return OI.getOI();
38a404b3
KZ
35 }
36
6f3b6d29 37 public static Intake getIntake() {
7992f152
AD
38 return Intake.getIntake();
39 }
40
538715b1
AD
41 // If the gear values do not match in the left and right piston, then they are
42 // both set to high gear
38a404b3
KZ
43 @Override
44 public void autonomousInit() {
202468a5 45 driveTrain.setHighGear();
2fe295a6 46
b69da5bd
MW
47 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_P_Val, 0);
48 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_I_Val, 0);
49 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_D_Val, 0);
50 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_TARGET_DIST, 50);
e483bc7a 51 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_MOTOR_VAL, 0.5);
01ea2879 52
5817adb0
ES
53 SmartDashboard.putNumber(Constants.DriveTrain.GYRO_P_Val, 0);
54 SmartDashboard.putNumber(Constants.DriveTrain.GYRO_I_Val, 0);
55 SmartDashboard.putNumber(Constants.DriveTrain.GYRO_D_Val, 0);
38a404b3
KZ
56 }
57
58 @Override
59 public void autonomousPeriodic() {
60 Scheduler.getInstance().run();
7558394d 61
90b435ce 62 double driveP = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val,
51612479 63 Constants.DriveTrain.PID_ERROR);
90b435ce 64 double driveI = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_I_Val,
51612479 65 Constants.DriveTrain.PID_ERROR);
90b435ce 66 double driveD = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val,
ee032bc2 67 Constants.DriveTrain.PID_ERROR);
542234fe 68
90b435ce 69 double gyroP = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_P_Val,
ee032bc2 70 Constants.DriveTrain.PID_ERROR);
90b435ce 71 double gyroI = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_I_Val,
ee032bc2 72 Constants.DriveTrain.PID_ERROR);
90b435ce 73 double gyroD = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_D_Val,
51612479 74 Constants.DriveTrain.PID_ERROR);
f213251b 75
90b435ce
ES
76 DriveTrain.getDriveTrain().getDriveController().setConstants(driveP, driveI,
77 driveD);
78
542234fe
E
79 DriveTrain.getDriveTrain().getGyroController().setConstants(gyroP, gyroI,
80 gyroD);
f213251b 81
01ea2879 82 // new DriveDistance(SETPOINT, SPEED).start();
664dae74 83
542234fe 84 // new TurnForAngle(0, Direction.FORWARD, 5).start();
38a404b3
KZ
85 }
86
87 @Override
88 public void teleopInit() {
538715b1 89
38a404b3
KZ
90 }
91
92 @Override
93 public void teleopPeriodic() {
88ecb8d3 94 Scheduler.getInstance().run();
38a404b3
KZ
95 }
96}