execute()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
2
package org.usfirst.frc.team3695.robot.commands;
3
4
import edu.wpi.first.wpilibj.DriverStation;
5
import edu.wpi.first.wpilibj.command.Command;
6
import org.usfirst.frc.team3695.robot.Robot;
7
import org.usfirst.frc.team3695.robot.util.Util;
8
9
public class CyborgCommandDriveDirect extends Command {
10
11
    public static final long TIME_WAIT = 1000;
12
    public double percent;
13
    private long time;
0 ignored issues
show
Unused Code introduced by
Consider removing the unused private field time.
Loading history...
14
    private boolean inRange;
0 ignored issues
show
Unused Code introduced by
Consider removing the unused private field inRange.
Loading history...
15
16
    public CyborgCommandDriveDirect(double percent) {
17
        this.percent = percent;
18
        requires(Robot.SUB_DRIVE);
19
    }
20
21
    protected void initialize() {
22
    	DriverStation.reportWarning("DRIVING BY POWER", false);
23
        Robot.SUB_DRIVE.pid.reset();
24
        time = System.currentTimeMillis() + TIME_WAIT;
25
    }
26
27
    protected void execute() {
28
    	percent = Util.getAndSetDouble("Drive Direct Power", 0);
29
        Robot.SUB_DRIVE.driveDirect(percent, percent);
30
    }
31
32
    protected boolean isFinished() {
33
        return false;
34
    }
35
36
    protected void end() {
37
        DriverStation.reportWarning("CyborgCommandDriveDirect finished", false);
38
        Robot.SUB_DRIVE.driveDirect(0, 0);
39
    }
40
41
    protected void interrupted() {
42
        end();
43
    }
44
}