Skip to content

Commit

Permalink
"Smart-Auto Tuning V1.1"
Browse files Browse the repository at this point in the history
SmartBlue2 & SmartRed2 - Fine tuned some variables and code

SmartXXXX# - Decreased delay of refresh on failed for color detection. Improved level result pull system to pull quicker/sooner.
  • Loading branch information
acastellar committed Feb 18, 2022
1 parent ffe6211 commit 22a1bf4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,25 @@ public void runOpMode() throws InterruptedException {

/// WAIT FOR SUCCESSFUL COMPUTER VISION RESULT ///
// Run until opMode starts
outer:
while (opModeIsActive() == false) {
// Wait 5 seconds to check for result
runtime.reset();
while (runtime.seconds() < 5) {
if (isStopRequested()) {
return;
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break outer;
}
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break;
}
// Tell driver team that no level results yet (QUITE BAD, MOVE ROBOT IF CHANCE GIVEN?)
telemetry.addData("Passed 5 Seconds", "No Level Results Yet");
// Tell driver team that no successful level results yet (Not optimal, but will still work if it fails)
telemetry.addData("Passed 5 Seconds", "No Successful Level Results Yet");
telemetry.update();
}

Expand Down Expand Up @@ -470,7 +471,7 @@ class ColorDensityPipelineBLUE extends OpenCvPipeline
private final int threshold = 35;
private final int levelCount = 3;
private final double thresholdConfirm = 0.7;
private int failedDelayDefault = 10;
private int failedDelayDefault = 7;
// Instance Variables
private Telemetry telemetry;
private int levelResult = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,25 @@ public void runOpMode() throws InterruptedException {

/// WAIT FOR SUCCESSFUL COMPUTER VISION RESULT ///
// Run until opMode starts
outer:
while (opModeIsActive() == false) {
// Wait 5 seconds to check for result
runtime.reset();
while (runtime.seconds() < 5) {
if (isStopRequested()) {
return;
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break outer;
}
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break;
}
// Tell driver team that no level results yet (QUITE BAD, MOVE ROBOT IF CHANCE GIVEN?)
telemetry.addData("Passed 5 Seconds", "No Level Results Yet");
// Tell driver team that no successful level results yet (Not optimal, but will still work if it fails)
telemetry.addData("Passed 5 Seconds", "No Successful Level Results Yet");
telemetry.update();
}

Expand Down Expand Up @@ -197,7 +198,7 @@ public void runOpMode() throws InterruptedException {
moveClaws(false, 1000);
finishedScoring = true;
}).start();
moveForward(0.1,4);
moveForward(0.2,4);
rotate(0.1,-30);
moveForward(0.1,17);
finishedDriving1 = true;
Expand All @@ -213,8 +214,7 @@ public void runOpMode() throws InterruptedException {
moveForward(0.3,-8);
setArm(1, 6,0.25);
rotate(0.3, 120);
moveForward(0.75, 40);
moveForward(0.2, 10);
moveForward(0.75, 50);
setArm(1, 3,0);

while(opModeIsActive()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,25 @@ public void runOpMode() throws InterruptedException {

/// WAIT FOR SUCCESSFUL COMPUTER VISION RESULT ///
// Run until opMode starts
outer:
while (opModeIsActive() == false) {
// Wait 5 seconds to check for result
runtime.reset();
while (runtime.seconds() < 5) {
if (isStopRequested()) {
return;
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break outer;
}
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break;
}
// Tell driver team that no level results yet (QUITE BAD, MOVE ROBOT IF CHANCE GIVEN?)
telemetry.addData("Passed 5 Seconds", "No Level Results Yet");
// Tell driver team that no successful level results yet (Not optimal, but will still work if it fails)
telemetry.addData("Passed 5 Seconds", "No Successful Level Results Yet");
telemetry.update();
}

Expand Down Expand Up @@ -476,7 +477,7 @@ class ColorDensityPipelineRED extends OpenCvPipeline
private final int threshold = 35;
private final int levelCount = 3;
private final double thresholdConfirm = 0.7;
private int failedDelayDefault = 10;
private int failedDelayDefault = 9;
// Instance Variables
private Telemetry telemetry;
private int levelResult = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.openftc.easyopencv.OpenCvCameraRotation;


@Autonomous(name = "Blue Side #2 - Smart")
@Autonomous(name = "Red Side #2 - Smart")
public class SmartRed2 extends LinearOpMode {

/// CONSTANTS ///
Expand Down Expand Up @@ -109,24 +109,25 @@ public void runOpMode() throws InterruptedException {

/// WAIT FOR SUCCESSFUL COMPUTER VISION RESULT ///
// Run until opMode starts
outer:
while (opModeIsActive() == false) {
// Wait 5 seconds to check for result
runtime.reset();
while (runtime.seconds() < 5) {
if (isStopRequested()) {
return;
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break outer;
}
}
// Check if pipeline was success, if so escape.
if (pipeline.getLevel() != -1) {
level = pipeline.getLevel();
telemetry.addData("Pipeline Successful Level", level);
telemetry.addData("Status", "Breaking Loop Successfully");
telemetry.update();
break;
}
// Tell driver team that no level results yet (QUITE BAD, MOVE ROBOT IF CHANCE GIVEN?)
telemetry.addData("Passed 5 Seconds", "No Level Results Yet");
// Tell driver team that no successful level results yet (Not optimal, but will still work if it fails)
telemetry.addData("Passed 5 Seconds", "No Successful Level Results Yet");
telemetry.update();
}

Expand Down Expand Up @@ -191,8 +192,8 @@ public void runOpMode() throws InterruptedException {
finishedScoring = true;
}).start();
moveForward(0.1,4);
rotate(0.1,30);
moveForward(0.1,17);
rotate(0.1,50);
moveForward(0.2,17);
finishedDriving1 = true;

runtime.reset();
Expand All @@ -206,8 +207,7 @@ public void runOpMode() throws InterruptedException {
moveForward(0.3,-8);
setArm(1, 6,0.25);
rotate(0.3, -120);
moveForward(0.75, 40);
moveForward(0.2, 10);
moveForward(0.75, 50);
setArm(1, 3,0);

while(opModeIsActive()){
Expand Down

0 comments on commit 22a1bf4

Please sign in to comment.