Added light?
This commit is contained in:
@@ -25,6 +25,8 @@ import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
|
|||||||
import org.firstinspires.ftc.teamcode.constants.StateEnums;
|
import org.firstinspires.ftc.teamcode.constants.StateEnums;
|
||||||
import org.firstinspires.ftc.teamcode.libs.RR.MecanumDrive;
|
import org.firstinspires.ftc.teamcode.libs.RR.MecanumDrive;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Spindexer {
|
public class Spindexer {
|
||||||
|
|
||||||
Robot robot;
|
Robot robot;
|
||||||
@@ -284,35 +286,65 @@ public class Spindexer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double prevLight = 0.0;
|
public double getRearCenterLight() {
|
||||||
public void ballCounterLight(){
|
BallColor color = GetRearCenterColor();
|
||||||
|
if (Objects.equals(color, BallColor.GREEN)) {
|
||||||
|
return LightGreen;
|
||||||
|
} else if (Objects.equals(color, BallColor.PURPLE)) {
|
||||||
|
return LightPurple;
|
||||||
|
} else {
|
||||||
|
return LightOrange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getDriverLight() {
|
||||||
|
BallColor color = GetFrontDriverColor();
|
||||||
|
if (Objects.equals(color, BallColor.GREEN)) {
|
||||||
|
return LightGreen;
|
||||||
|
} else if (Objects.equals(color, BallColor.PURPLE)) {
|
||||||
|
return LightPurple;
|
||||||
|
} else {
|
||||||
|
return LightOrange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPassengerLight() {
|
||||||
|
BallColor color = GetFrontPassengerColor();
|
||||||
|
if (Objects.equals(color, BallColor.GREEN)) {
|
||||||
|
return LightGreen;
|
||||||
|
} else if (Objects.equals(color, BallColor.PURPLE)) {
|
||||||
|
return LightPurple;
|
||||||
|
} else {
|
||||||
|
return LightOrange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double ballCounterLight() {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
if (!ballPositions[0].isEmpty){
|
if (!ballPositions[0].isEmpty) {
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
if (!ballPositions[1].isEmpty){
|
if (!ballPositions[1].isEmpty) {
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
if (!ballPositions[2].isEmpty){
|
if (!ballPositions[2].isEmpty) {
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
double light;
|
if (counter == 3) {
|
||||||
if (counter == 3){
|
return Light3;
|
||||||
light = Light3;
|
} else if (counter == 2) {
|
||||||
} else if (counter == 2){
|
return Light2;
|
||||||
light = Light2;
|
} else if (counter == 1) {
|
||||||
} else if (counter == 1){
|
return Light1;
|
||||||
light = Light1;
|
|
||||||
} else {
|
} else {
|
||||||
light = Light0;
|
return Light0;
|
||||||
}
|
}
|
||||||
if (light != prevLight){
|
|
||||||
robot.light.setPosition(light);
|
|
||||||
}
|
|
||||||
prevLight = light;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean slotIsEmpty(int slot){
|
public boolean slotIsEmpty(int slot){
|
||||||
return !ballPositions[slot].isEmpty;
|
return !ballPositions[slot].isEmpty;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user