Test Failed
Push — master ( d9c046...9db1c9 )
by John
04:04 queued 01:56
created

SubsystemHook()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
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.ManualCommandHook;
5
import org.usfirst.frc.team3695.robot.util.Xbox;
6
7
import com.ctre.phoenix.motorcontrol.ControlMode;
8
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
9
10
import edu.wpi.first.wpilibj.Joystick;
11
import edu.wpi.first.wpilibj.command.Subsystem;
12
13
/** VROOM VROOM */
14
public class SubsystemHook extends Subsystem {
15
	
16
	
17
	private TalonSRX hook;
18
	
19
	/** applies left arm motor invert */
20
	public static final double hookify(double hook) {
21
		return hook * (Constants.HOOK_MOTOR_INVERT ? -1.0 : 1.0);
22
	}
23
	
24
	/** runs at robot boot */
25
    public void initDefaultCommand() {
26
    	setDefaultCommand(new ManualCommandHook());
27
    }
28
	
29
	/** gives birth to the CANTalons */
30
    public SubsystemHook(){
31
    	hook = new TalonSRX(Constants.HOOK);
32
    }
33
34
    public void swing(Joystick joy) {
35
    	double speed = 0;
36
    	speed = joy.getRawButton(Xbox.A) ? speed++ : speed; 
0 ignored issues
show
Code Smell introduced by
Increment or decrement operators should not be mixed with other operators for the sake of readability. You should extract this operator into a separate statement.
Loading history...
37
    	speed = joy.getRawButton(Xbox.B) ? speed-- : speed;
0 ignored issues
show
Code Smell introduced by
Increment or decrement operators should not be mixed with other operators for the sake of readability. You should extract this operator into a separate statement.
Loading history...
38
    	hook.set(ControlMode.PercentOutput, speed);
39
    }
40
    
41
    /** configures the voltage of each CANTalon */
42
    private void voltage(TalonSRX talon) {
0 ignored issues
show
Unused Code introduced by
Your method has more parameters than it evaluates. Consider removing talon.
Loading history...
43
    	// talon.configNominalOutputVoltage(0f, 0f);
44
    	// talon.configPeakOutputVoltage(12.0f, -12.0f);
45
    	// talon.enableCurrentLimit(true);
46
    	// talon.configContinuousCurrentLimit(30, 3000);
47
    }
48
           
49
    
50
51
}
52
53