Skip to content

Commit 381b2dc

Browse files
author
Robotics
committed
more lab changes
1 parent c3da1da commit 381b2dc

File tree

10 files changed

+32
-37
lines changed

10 files changed

+32
-37
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.53 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

FRC2020/src/main/java/frc/robot/Robot.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void robotInit() {
5353
RobotMap.colorMatcher.addColorMatch(kGreenTarget);
5454
RobotMap.colorMatcher.addColorMatch(kRedTarget);
5555
RobotMap.colorMatcher.addColorMatch(kYellowTarget);
56-
/*
56+
5757
if (DriverStation.Alliance.valueOf("Blue") == blueTeam) {
5858
Scheduler.getInstance().add(new Detector(true));
5959
teamColor = "Blue";
@@ -63,9 +63,7 @@ public void robotInit() {
6363
} else {
6464
teamColor = "Invalid";
6565
}
66-
6766
SmartDashboard.putString("Team Color", teamColor);
68-
*/
6967
}
7068

7169
@Override

FRC2020/src/main/java/frc/robot/commands/Detector.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ protected void initialize(boolean color) {
2727
}
2828

2929
protected void execute() {
30-
31-
int script_choice = get_script_choice();
32-
obj.update_choice(script_choice);
33-
34-
// Store networktables output
35-
double[] output = new double[2];
36-
output = obj.get_output_of_selected_action();
37-
38-
// If stop signal is received, end command
39-
if (output[0] == 0) {
40-
//As of now, if theres no script we just dont control motors
41-
42-
} else {
43-
// PID
44-
double[] speeds = PID(output[0]);
45-
46-
// If ball is closer than threshold, stop
47-
if (output[2] < setpointWidth && error < 100) {
48-
speeds[0] = 0;
49-
speeds[1] = 0;
30+
if (false) {
31+
int script_choice = get_script_choice();
32+
obj.update_choice(script_choice);
33+
34+
// Store networktables output
35+
double[] output = new double[2];
36+
output = obj.get_output_of_selected_action();
37+
38+
// If stop signal is received, end command
39+
if (output[0] == 0) {
40+
//As of now, if theres no script we just dont control motors
41+
42+
} else {
43+
// PID
44+
double[] speeds = PID(output[0]);
45+
46+
// If ball is closer than threshold, stop
47+
if (output[2] < setpointWidth && error < 100) {
48+
speeds[0] = 0;
49+
speeds[1] = 0;
50+
}
51+
52+
// Actuate motors
53+
Robot.driveTrain.tankDrive(speeds[0], speeds[1]); // Turns each motor according to the error.
5054
}
51-
52-
// Actuate motors
53-
Robot.driveTrain.tankDrive(speeds[0], speeds[1]); // Turns each motor according to the error.
54-
5555
}
5656
}
5757

FRC2020/src/main/java/frc/robot/subsystems/ColorCycle.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ public void initDefaultCommand() {
1616
public static void colorCycleStart() {
1717
RobotMap.Spinner.set(1);
1818

19-
while (colorCycleValue < 3) {
20-
21-
Color firstColor = RobotMap.colorSensor.getColor();
22-
ColorMatchResult matched = RobotMap.colorMatcher.matchClosestColor(firstColor);
23-
while (RobotMap.colorMatcher.matchClosestColor(RobotMap.colorSensor.getColor()) == matched) {
24-
// nothing
25-
}
26-
27-
colorCycleValue = colorCycleValue + 0.125;
28-
colorsPassedValue = colorsPassedValue + 1;
19+
Color firstColor = RobotMap.colorSensor.getColor();
20+
ColorMatchResult matched = RobotMap.colorMatcher.matchClosestColor(firstColor);
21+
while (RobotMap.colorMatcher.matchClosestColor(RobotMap.colorSensor.getColor()) == matched) {
22+
// nothing
2923
}
24+
25+
colorCycleValue = colorCycleValue + 0.125;
26+
colorsPassedValue = colorsPassedValue + 1;
3027
}
3128

3229
public static void colorCycleStop() {

0 commit comments

Comments
 (0)