-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good! Thanks, George.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we want the viper slides to move in sync?
Would you like me to separate them?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, just a couple changes. :)
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
public void setViperSlidePos() { | ||
telemetry.addData("Scoring Status", "Setting VS Pos"); | ||
// Setting ViperSlidePoses based on Targets. | ||
while (robot.<DcMotor>get("rightViperSlideMotor").getCurrentPosition() != viperSlideTargetPos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're mimicking a .setTargetPosition
command for all of these. Either way, I think you need to adjust this to let us run both viper slides simultaneously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also might need to make this use tolerance (eg. Math.abs(currentPosition - targetPosition) < tolerance
), since exactly hitting it's target is unlikely, esp with your current system that only lets the viper slides move one way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing throughout your code
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a couple fixes
} | ||
|
||
public void resetPos() { | ||
telemetry.addData("Scoring Status1` ", "Resetting Pos"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what happened here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you didn't fix this. try not to mark things as resolved if you don't address them.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
|
||
setArmPos(); | ||
|
||
setJointPos(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the random line breaks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't mark it as resolved if you don't do it lmao-
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
progress!
@@ -17,8 +17,12 @@ public class ScoringAlgorithm extends OpMode { | |||
boolean pixelsInClaw = false; | |||
double armStartPos = 0.0; | |||
double armTargetPos = 0.0; | |||
double armStartTolerance = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tolerance doesn't work if the tolerance is set to zero...
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
|
||
setArmPos(); | ||
|
||
setJointPos(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't mark it as resolved if you don't do it lmao-
// Setting ViperSlidePoses based on Targets. | ||
while (Math.abs(robot.<DcMotor>get("leftViperSlideMotor").getCurrentPosition() - viperSlideTargetPos) > viperSlideTolerance) { | ||
|
||
robot.<DcMotor>get("rightViperSlideMotor").setPower(0.4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix this indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is.
public void setViperSlidePos() { | ||
telemetry.addData("Scoring Status", "Setting VS Pos"); | ||
// Setting ViperSlidePoses based on Targets. | ||
while (Math.abs(robot.<DcMotor>get("leftViperSlideMotor").getCurrentPosition() - viperSlideTargetPos) > viperSlideTolerance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the left viper slide values to run both slides is a bad way to do this; if there's any difference in the speeds of the motors, then the difference is going to compound and you're going to end up with inaccurate parts at best, broken parts at worst.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed...
|
||
while (Math.abs(robot.<DcMotor>get("armMotor").getCurrentPosition() - armStartPos) > armStartTolerance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing as above
there's a chance you might want to add a condition to catch if it would ever miss your entire section. you can solve this by either changing the while condition to be while (robot.get("armMotor").getCurrentPosition < armTargetPos){} which would work well to catch it as soon as it passes that threshold
however, if you're more concerned with accuracy and willing to sacrifice some time, you can do something that's basically inside of your while loop that checks if (robot.get("armMotor").getCurrentPosition < armTargetPos - armTolerance){} and add an else if to check else if (robot.get("armMotor").getCurrentPosition > armTargetPos + armTolerance){} which would basically let it self correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above....
} | ||
robot.<DcMotor>get("armMotor").setPower(0); | ||
|
||
while (Math.abs(robot.<DcMotor>get("leftViperSlideMotor").getCurrentPosition() - viperSlideStartPos) > viperSlideStartTolerance) { | ||
|
||
robot.<DcMotor>get("rightViperSlideMotor").setPower(0.4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here, right motor is based off of left motor values and cannot run on its own (eg. left motor cannot be stopped while right motor is running)
private void scoring() { | ||
|
||
|
||
public void scoring() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't functional as a proof of concept if you don't call this method anywhere
|
||
private Hardware robot; | ||
|
||
public void init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove line breaks within init()
} | ||
|
||
telemetry.addData("CRServo", "Running"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
someone else should probably look over this seeing as i wrote it...
private Hardware robot; | ||
// TODO: Get values for variables. | ||
boolean pixelsInClaw = false; | ||
double armStartPos = 0.0; | ||
double armTargetPos = 0.0; | ||
double armStartTolerance = 0.0; | ||
double armTolerance = 0.0; | ||
double armTolerance = 2.5; | ||
double viperSlideStartPos = 0.0; | ||
double viperSlideTargetPos = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's get values for this
@@ -11,28 +11,27 @@ | |||
|
|||
@Autonomous(name = "Scoring Algorithm", group = "auton") | |||
public class ScoringAlgorithm extends OpMode { | |||
|
|||
private Hardware robot; | |||
// TODO: Get values for variables. | |||
boolean pixelsInClaw = false; | |||
double armStartPos = 0.0; | |||
double armTargetPos = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's get a value for this
double viperSlideStartPos = 0.0; | ||
double viperSlideTargetPos = 0.0; | ||
double viperSlideStartTolerance = 0.0; | ||
double viperSlideTolerance = 0; | ||
double jointStartPos = 0.0; | ||
double jointTargetPos = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set this to not zero :)
} | ||
|
||
public void setViperSlidePos() { | ||
// If this is not true, the rest of the code will not function. | ||
assert viperSlideTargetPos > viperSlideStartPos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be >=
telemetry.addData("Scoring Status", "VS Pos Set"); | ||
} | ||
|
||
public void setArmPos() { | ||
// If this is not true, the rest of the code will not function. | ||
assert armTargetPos > armStartPos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be >=
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the stuff, and come up with more creative method names.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/ScoringAlgorithm.java
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/Tests/CRServoTest.java
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/Tests/CRServoTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deferring to Rayne.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you :)
Changes:
-Changed Claw Values