fix a few errors
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
f213251b 3import org.usfirst.frc.team3501.robot.commands.driving.DriveDistance;
cca02549 4import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
6f3b6d29 5import org.usfirst.frc.team3501.robot.subsystems.Intake;
079a8cb6 6import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6acd1f1b 7
38a404b3
KZ
8import edu.wpi.first.wpilibj.IterativeRobot;
9import edu.wpi.first.wpilibj.command.Scheduler;
34ffcd03 10import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
38a404b3
KZ
11
12public class Robot extends IterativeRobot {
6acd1f1b 13 private static DriveTrain driveTrain;
414d5638 14 private static Shooter shooter;
6acd1f1b 15 private static OI oi;
6f3b6d29 16 private static Intake intake;
38a404b3
KZ
17
18 @Override
19 public void robotInit() {
6acd1f1b
CZ
20 driveTrain = DriveTrain.getDriveTrain();
21 oi = OI.getOI();
079a8cb6 22 shooter = Shooter.getShooter();
6f3b6d29 23 intake = Intake.getIntake();
cca02549 24 }
6acd1f1b
CZ
25
26 public static DriveTrain getDriveTrain() {
27 return DriveTrain.getDriveTrain();
cca02549 28 }
6acd1f1b 29
414d5638 30 public static Shooter getShooter() {
31 return Shooter.getShooter();
32 }
33
6acd1f1b
CZ
34 public static OI getOI() {
35 return OI.getOI();
38a404b3
KZ
36 }
37
6f3b6d29 38 public static Intake getIntake() {
7992f152
AD
39 return Intake.getIntake();
40 }
41
538715b1
AD
42 // If the gear values do not match in the left and right piston, then they are
43 // both set to high gear
38a404b3
KZ
44 @Override
45 public void autonomousInit() {
202468a5 46 driveTrain.setHighGear();
2fe295a6 47
b69da5bd
MW
48 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_P_Val, 0);
49 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_I_Val, 0);
50 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_D_Val, 0);
51 SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_TARGET_DIST, 50);
51612479 52 SmartDashboard.putNumber(Constants.DriveTrain.MOTOR_VAL, 0.5);
360d51fe 53
38a404b3
KZ
54 }
55
56 @Override
57 public void autonomousPeriodic() {
58 Scheduler.getInstance().run();
7558394d 59
6f5270c9 60 double P = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val,
51612479 61 Constants.DriveTrain.PID_ERROR);
b69da5bd 62 double I = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_I_Val,
51612479 63 Constants.DriveTrain.PID_ERROR);
b69da5bd 64 double D = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val,
51612479 65 Constants.DriveTrain.PID_ERROR);
a96a3537 66 double SPEED = SmartDashboard.getNumber(Constants.DriveTrain.MOTOR_VAL, 0);
f213251b 67
6f5270c9
MW
68 double SETPOINT = SmartDashboard.getNumber(
69 Constants.DriveTrain.DRIVE_TARGET_DIST,
70 Constants.DriveTrain.TARGET_DISTANCE_ERROR);
f213251b 71
0de29669 72 DriveTrain.getDriveTrain().getDriveController().setConstants(P, I, D);
f213251b 73
1f200727 74 new DriveDistance(SETPOINT, SPEED).start();
38a404b3
KZ
75 }
76
77 @Override
78 public void teleopInit() {
538715b1 79
38a404b3
KZ
80 }
81
82 @Override
83 public void teleopPeriodic() {
88ecb8d3 84 Scheduler.getInstance().run();
38a404b3
KZ
85 }
86}