|
1
|
|
|
package org.usfirst.frc.team3695.robot.commands;
|
|
2
|
|
|
|
|
3
|
|
|
import edu.wpi.first.wpilibj.command.Command;
|
|
4
|
|
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
|
5
|
|
|
import org.usfirst.frc.team3695.robot.OI;
|
|
6
|
|
|
import org.usfirst.frc.team3695.robot.Robot;
|
|
7
|
|
|
import org.usfirst.frc.team3695.robot.util.Util;
|
|
8
|
|
|
|
|
9
|
|
|
/** manually command the robot with joysticks */
|
|
10
|
|
|
public class ManualCommandDrive extends Command {
|
|
11
|
|
|
|
|
12
|
|
|
public ManualCommandDrive() {
|
|
13
|
|
|
requires(Robot.SUB_DRIVE);
|
|
14
|
|
|
}
|
|
15
|
|
|
|
|
16
|
|
|
protected void initialize() {}
|
|
17
|
|
|
|
|
18
|
|
|
protected void execute() {
|
|
19
|
|
|
SmartDashboard.putNumber("Tilt Angle", Robot.SUB_DRIVE.getYAngle());
|
|
20
|
|
|
SmartDashboard.putBoolean("Docked", Robot.SUB_DRIVE.docking);
|
|
21
|
|
|
SmartDashboard.putBoolean("Reversed", Robot.SUB_DRIVE.reversing);
|
|
22
|
|
|
SmartDashboard.putNumber("Right Encoder Inches", Robot.SUB_DRIVE.pid.getRightInches());
|
|
23
|
|
|
SmartDashboard.putNumber("Left Encoder Inches", Robot.SUB_DRIVE.pid.getLeftInches());
|
|
24
|
|
|
|
|
25
|
|
|
switch (Robot.SUB_DRIVE.drivetrain) {
|
|
26
|
|
|
case ROCKET_LEAGUE:
|
|
27
|
|
|
Robot.SUB_DRIVE.driveRLTank(OI.DRIVER, Util.getAndSetDouble("Rocket Ramp", .75), Util.getAndSetDouble("Drive Inhibitor", 1));
|
|
|
|
|
|
|
28
|
|
|
break;
|
|
29
|
|
|
case FORZA:
|
|
30
|
|
|
Robot.SUB_DRIVE.driveForza(OI.DRIVER, Util.getAndSetDouble("Forza Ramp", .75), Util.getAndSetDouble("Radius", 1), Util.getAndSetDouble("Drive Inhibitor", 1));
|
|
|
|
|
|
|
31
|
|
|
break;
|
|
32
|
|
|
}
|
|
33
|
|
|
}
|
|
34
|
|
|
|
|
35
|
|
|
protected boolean isFinished() {
|
|
36
|
|
|
return false;
|
|
37
|
|
|
}
|
|
38
|
|
|
|
|
39
|
|
|
protected void end() {}
|
|
40
|
|
|
|
|
41
|
|
|
protected void interrupted() {}
|
|
42
|
|
|
}
|
|
43
|
|
|
|
Using constants for hard-coded numbers is a best practice. A constant’s name can explain the rationale behind this magic number. It is also easier to find if you ever need to change it.