Completed
Push — master ( 6b018e...519662 )
by John
33s
created

pinionate(double)   A

Complexity

Conditions 2

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 2
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.commands.ManualCommandGrow;
7
import org.usfirst.frc.team3695.robot.enumeration.Direction;
8
import org.usfirst.frc.team3695.robot.util.Util;
9
import org.usfirst.frc.team3695.robot.util.Xbox;
10
11
import com.ctre.CANTalon;
12
import com.ctre.phoenix.motorcontrol.ControlMode;
13
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
14
15
import edu.wpi.first.wpilibj.Joystick;
16
import edu.wpi.first.wpilibj.command.Subsystem;
17
18
/** the big, metal pole */
19
public class SubsystemMast extends Subsystem {
20
	
21
	
22
	private TalonSRX pinionMast;
23
	private TalonSRX screwMast;
24
25
	
26
	/** runs at robot boot */
27
    public void initDefaultCommand() {
28
    	setDefaultCommand(new ManualCommandGrow()); }
29
	
30
	/** gives birth to the CANTalons */
31
    public SubsystemMast(){
32
    	pinionMast = new TalonSRX(Constants.PINION_MOTOR);
33
    	screwMast = new TalonSRX(Constants.SCREW_MOTOR);
34
    }
35
    
36
    /** apply screw motor invert */
37
   	public static final double screwify(double right) {
38
   		return right * (Constants.SCREW_MOTOR_INVERT ? -1.0 : 1.0);
39
   	}
40
   	
41
   	/** apply pinion motor invert */
42
   	public static final double pinionate(double right) {
43
   		return right * (Constants.PINION_MOTOR_INVERT ? -1.0 : 1.0);
44
   	}
45
    
46
   	/** raise the mast at RT-LR trigger speed */
47
    public void moveBySpeed(Joystick joy) {
48
    	double speed = Xbox.RT(joy) - Xbox.LT(joy);
49
    	pinionMast.set(ControlMode.PercentOutput, pinionate(speed));
50
    	screwMast.set(ControlMode.PercentOutput, screwify(speed));
51
    }
52
53
    /** configures the voltage of each CANTalon */
54
    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...
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