Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
cca02549 | 3 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
6f3b6d29 | 4 | import org.usfirst.frc.team3501.robot.subsystems.Intake; |
079a8cb6 | 5 | import org.usfirst.frc.team3501.robot.subsystems.Shooter; |
6acd1f1b | 6 | |
38a404b3 KZ |
7 | import edu.wpi.first.wpilibj.IterativeRobot; |
8 | import edu.wpi.first.wpilibj.command.Scheduler; | |
34ffcd03 | 9 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
38a404b3 KZ |
10 | |
11 | public 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() { | |
d7f60251 | 19 | driveTrain = driveTrain; |
6acd1f1b | 20 | oi = OI.getOI(); |
079a8cb6 | 21 | shooter = Shooter.getShooter(); |
6f3b6d29 | 22 | intake = Intake.getIntake(); |
cca02549 | 23 | } |
6acd1f1b CZ |
24 | |
25 | public static DriveTrain getDriveTrain() { | |
cdb67f48 | 26 | return driveTrain; |
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); | |
5817adb0 ES |
51 | SmartDashboard.putNumber(Constants.DriveTrain.GYRO_P_Val, 0); |
52 | SmartDashboard.putNumber(Constants.DriveTrain.GYRO_I_Val, 0); | |
53 | SmartDashboard.putNumber(Constants.DriveTrain.GYRO_D_Val, 0); | |
7a65d2ce ES |
54 | SmartDashboard.putNumber(Constants.DriveTrain.P_Val, 0); |
55 | SmartDashboard.putNumber(Constants.DriveTrain.I_Val, 0); | |
56 | SmartDashboard.putNumber(Constants.DriveTrain.D_Val, 0); | |
7a65d2ce | 57 | SmartDashboard.putNumber(Constants.DriveTrain.MOTOR_VAL, 0.5); |
ffa8cfd5 | 58 | |
21df72de | 59 | SmartDashboard.putNumber(Constants.DriveTrain.DRIVE_MOTOR_VAL, 0.5); |
f9b52969 E |
60 | |
61 | double driveP = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val, | |
62 | Constants.DriveTrain.PID_ERROR); | |
63 | double driveI = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_I_Val, | |
64 | Constants.DriveTrain.PID_ERROR); | |
65 | double driveD = SmartDashboard.getNumber(Constants.DriveTrain.DRIVE_D_Val, | |
66 | Constants.DriveTrain.PID_ERROR); | |
67 | ||
68 | double gyroP = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_P_Val, | |
69 | Constants.DriveTrain.PID_ERROR); | |
70 | double gyroI = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_I_Val, | |
71 | Constants.DriveTrain.PID_ERROR); | |
72 | double gyroD = SmartDashboard.getNumber(Constants.DriveTrain.GYRO_D_Val, | |
73 | Constants.DriveTrain.PID_ERROR); | |
74 | ||
75 | double Setpoint = SmartDashboard.getNumber( | |
76 | Constants.DriveTrain.DRIVE_TARGET_DIST, Constants.DriveTrain.PID_ERROR); | |
77 | double Speed = SmartDashboard.getNumber( | |
78 | Constants.DriveTrain.DRIVE_MOTOR_VAL, Constants.DriveTrain.PID_ERROR); | |
79 | ||
80 | driveTrain.getDriveController().setName("Drive"); | |
81 | driveTrain.getGyroController().setName("Gyro"); | |
82 | ||
83 | driveTrain.getDriveController().setConstants(driveP, driveI, driveD); | |
84 | ||
85 | driveTrain.getGyroController().setConstants(gyroP, gyroI, gyroD); | |
09ee7387 | 86 | |
38a404b3 KZ |
87 | } |
88 | ||
89 | @Override | |
90 | public void autonomousPeriodic() { | |
91 | Scheduler.getInstance().run(); | |
93698237 | 92 | |
38a404b3 KZ |
93 | } |
94 | ||
95 | @Override | |
96 | public void teleopInit() { | |
538715b1 | 97 | |
38a404b3 KZ |
98 | } |
99 | ||
100 | @Override | |
101 | public void teleopPeriodic() { | |
88ecb8d3 | 102 | Scheduler.getInstance().run(); |
38a404b3 KZ |
103 | } |
104 | } |