From de04d8a385610eeeb55e3fdcb808953fdaaf5365 Mon Sep 17 00:00:00 2001 From: Saar Date: Sun, 12 Sep 2021 18:02:40 +0300 Subject: [PATCH] Sunday --- .../subsystems/colorwheel/ColorWheel.java | 22 +++++++++++-------- .../colorwheel/commands/RotationControl.java | 3 +-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/colorwheel/ColorWheel.java b/src/main/java/frc/robot/subsystems/colorwheel/ColorWheel.java index 0ade559..c4f271a 100644 --- a/src/main/java/frc/robot/subsystems/colorwheel/ColorWheel.java +++ b/src/main/java/frc/robot/subsystems/colorwheel/ColorWheel.java @@ -16,12 +16,15 @@ public class ColorWheel extends SubsystemBase { private String lastColor = ""; - public String whatColor() { - Color color = sensor.getColor(); + public ColorWheel() { match.addColorMatch(Color.kYellow); // yellow match.addColorMatch(Color.kGreen); // green match.addColorMatch(Color.kRed); // red match.addColorMatch(Color.kBlue); // blue + } + + public String whatColor() { + Color color = sensor.getColor(); ColorMatchResult result = match.matchClosestColor(color); Color resultColor = result.color; @@ -35,13 +38,14 @@ public String whatColor() { return "blue"; } } - public String rotationColor () { - return ""; - } - - public void setPower (double powerMotor){ - motor.set(ControlMode.PercentOutput, powerMotor); - } + public String rotationColor() { + return ""; + } + public void setPower(double powerMotor) { + motor.set(ControlMode.PercentOutput, powerMotor); } + + +} diff --git a/src/main/java/frc/robot/subsystems/colorwheel/commands/RotationControl.java b/src/main/java/frc/robot/subsystems/colorwheel/commands/RotationControl.java index 0d93342..9d97a95 100644 --- a/src/main/java/frc/robot/subsystems/colorwheel/commands/RotationControl.java +++ b/src/main/java/frc/robot/subsystems/colorwheel/commands/RotationControl.java @@ -20,7 +20,6 @@ public RotationControl(ColorWheel colorWheel) { public void initialize() { startingColor = colorWheel.whatColor(); lastColor = colorWheel.whatColor(); - currentColor = colorWheel.whatColor(); } @@ -49,6 +48,6 @@ public boolean isFinished() { @Override public void end(boolean interrupted) { - colorWheel.setpower(0); + colorWheel.setPower(0); } }