Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent color sensor calls when not needed. #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/subsystems/ColorSensorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,11 @@ public RawColor getRawColor() {
return colorSensor.getRawColor();
}

public boolean isDetected() {
return bDetectedCargo;
}
// public boolean isDetected() {
// return bDetectedCargo;
// }

@Override
public void periodic() {
public boolean isDetected() {

//proximity sensor range: 1cm to 10cm

Expand Down Expand Up @@ -168,5 +167,6 @@ else if(blue > BLUE_THRESHOLD && proximity > BLUE_PROXIMITY_THRESHOLD)
detectBlue.setBoolean(isBlue);

bDetectedCargo = isRed || isBlue;
return bDetectedCargo;
}
}