1
|
|
|
package org.usfirst.frc.team3695.robot.subsystems;
|
2
|
|
|
|
3
|
|
|
import org.usfirst.frc.team3695.robot.Constants;
|
4
|
|
|
import org.usfirst.frc.team3695.robot.commands.ButtonCommandSpit;
|
5
|
|
|
import org.usfirst.frc.team3695.robot.commands.ManualCommandDrive;
|
6
|
|
|
import org.usfirst.frc.team3695.robot.enumeration.Direction;
|
7
|
|
|
import org.usfirst.frc.team3695.robot.util.Util;
|
8
|
|
|
import org.usfirst.frc.team3695.robot.util.Xbox;
|
9
|
|
|
|
10
|
|
|
import com.ctre.CANTalon;
|
11
|
|
|
import com.ctre.phoenix.motorcontrol.ControlMode;
|
12
|
|
|
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
|
13
|
|
|
|
14
|
|
|
import edu.wpi.first.wpilibj.Joystick;
|
15
|
|
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
16
|
|
|
|
17
|
|
|
/** VROOM VROOM */
|
18
|
|
|
public class SubsystemManipulator extends Subsystem {
|
19
|
|
|
|
20
|
|
|
|
21
|
|
|
private TalonSRX armLeft;
|
22
|
|
|
private TalonSRX armRight;
|
23
|
|
|
|
24
|
|
|
|
25
|
|
|
/** runs at robot boot */
|
26
|
|
|
public void initDefaultCommand() {}
|
27
|
|
|
|
28
|
|
|
/** gives birth to the CANTalons */
|
29
|
|
|
public SubsystemManipulator(){
|
30
|
|
|
armLeft = new TalonSRX(Constants.LEFT_ARM);
|
31
|
|
|
armRight = new TalonSRX(Constants.LEFT_ARM);
|
32
|
|
|
}
|
33
|
|
|
|
34
|
|
|
/** eat the power cube */
|
35
|
|
|
public void eat(double speed) {
|
36
|
|
|
speed *= -1;
|
37
|
|
|
armLeft.set(ControlMode.PercentOutput, speed);
|
38
|
|
|
armRight.set(ControlMode.PercentOutput, speed);
|
39
|
|
|
}
|
40
|
|
|
|
41
|
|
|
/** spit out the power cube */
|
42
|
|
|
public void spit(double speed) {
|
43
|
|
|
armLeft.set(ControlMode.PercentOutput, speed);
|
44
|
|
|
armRight.set(ControlMode.PercentOutput, speed);
|
45
|
|
|
}
|
46
|
|
|
|
47
|
|
|
/** STOP SPINNING ME RIGHT ROUND, BABY RIGHT ROUND */
|
48
|
|
|
public void stopSpinning() {
|
49
|
|
|
armLeft.set(ControlMode.PercentOutput, 0);
|
50
|
|
|
armRight.set(ControlMode.PercentOutput, 0);
|
51
|
|
|
}
|
52
|
|
|
|
53
|
|
|
/** configures the voltage of each CANTalon */
|
54
|
|
|
private void voltage(TalonSRX talon) {
|
|
|
|
|
55
|
|
|
// talon.configNominalOutputVoltage(0f, 0f);
|
56
|
|
|
// talon.configPeakOutputVoltage(12.0f, -12.0f);
|
57
|
|
|
// talon.enableCurrentLimit(true);
|
58
|
|
|
// talon.configContinuousCurrentLimit(30, 3000);
|
59
|
|
|
}
|
60
|
|
|
|
61
|
|
|
|
62
|
|
|
|
63
|
|
|
}
|
64
|
|
|
|
65
|
|
|
|