origin/drive_testing#1
Conversation
whitehml
left a comment
There was a problem hiding this comment.
Took a quick 5 min look, just a few comments, not an exhaustive review.
|
Thanks, Michael. And yes, we do have a native 1800 5-turn servo per Jeff.
He gave it to me and it's on our cart to be installed.
Brenda
…On Monday, December 1, 2025, Michael Whitehurst ***@***.***> wrote:
***@***.**** commented on this pull request.
Took a quick 5 min look, just a few comments, not an exhaustive review.
------------------------------
In TeamCode/src/main/java/org/firstinspires/ftc/teamcode/SpiritTeleop.java
<#1 (comment)>
:
> + double RampUpTimer = 0;
+ boolean ShooterFlag = false;
convention would be to use lower-case to start variables, i.e. rampUpTimer
& shooterFlag. Starting with upper-case is reserved for classes, like MecanumDrive,
Servo, DCMotor, Pose2d, etc.
------------------------------
In TeamCode/src/main/java/org/firstinspires/ftc/teamcode/SpiritTeleop.java
<#1 (comment)>
:
> + }
+//------------------CODE FOR WHEN THE TRIGGERS ARE PRESSED----------------------------------
+
+ if ((gamepad2.left_trigger > 0.25) && (gamepad2.right_trigger < .01)) {
+ if (ShooterFlag == false) {
+ ShooterFlag = true;
+ RampUpTimer = getRuntime() + 2;//set a timer to the length of time the op has been running + 2 seconds
+ shooter.setPower(.6);//ramp up the shooter
+ }
+ //check to see if the shooter has ramped up for the required number of seconds.
+ //if so, reapply power, advance carousel, engage teardrop, reset teardrop,
+ //and count how many times the carousel has advanced (at 3, reset it to original position)
+ if (ShooterFlag == true) {
+ if (getRuntime() > RampUpTimer) {
+ if (carouselCounter < 5) {
+ shooter.setPower(.6);
If this line is needed, which i'm not 100% sure it is, you'd want it to
happen every cycle (i.e. between if (shooterFlag == true) { & if
(getRuntime() > rampUpTimer) {)
------------------------------
In TeamCode/src/main/java/org/firstinspires/ftc/teamcode/SpiritTeleop.java
<#1 (comment)>
:
> + ShooterFlag = true;
+ RampUpTimer = getRuntime() + 2;//set a timer to the length of time the op has been running + 2 seconds
+ shooter.setPower(.6);//ramp up the shooter
+ }
+ //check to see if the shooter has ramped up for the required number of seconds.
+ //if so, reapply power, advance carousel, engage teardrop, reset teardrop,
+ //and count how many times the carousel has advanced (at 3, reset it to original position)
+ if (ShooterFlag == true) {
+ if (getRuntime() > RampUpTimer) {
+ if (carouselCounter < 5) {
+ shooter.setPower(.6);
+ //add code to advance carousel by 120 degrees
+
+ //carousel.flipShooterServo();
+ //carousel.unflipShooterServo();
+ carouselCounter++;
The shooterFlag needs to be reset at some point or carouselCounter will
blow past 5 in the first few miliseconds of rampUpTimer being exceeded.
------------------------------
In TeamCode/src/main/java/org/firstinspires/ftc/teamcode/SpiritTeleop.java
<#1 (comment)>
:
> + if (getRuntime() > RampUpTimer) {
+ if (carouselCounter < 5) {
+ shooter.setPower(.6);
+ //add code to advance carousel by 120 degrees
+
+ //carousel.flipShooterServo();
+ //carousel.unflipShooterServo();
+ carouselCounter++;
+ } else {
+ //add code to reset carousel to original position
+ }
+//this is a loop to make the code "wait" until the require number of seconds has passed (if statement cannot be empty so we gave it a task to do
+ // else {
+ // i = i++;
+ }else {
+ i=i++;
i++ is already shorthand for i = i + 1
—
Reply to this email directly, view it on GitHub
<#1 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDNALE5QYYM2HXFSJTCYSQL37RSVXAVCNFSM6AAAAACNUHKOZCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKMRVGY3TAMJXGE>
.
You are receiving this because you authored the thread.Message ID:
<Mars-Robotics-Association/Spirit-quickstart/pull/1/review/3525670171@
github.com>
--
Brenda Fink
|
| leftFront.setDirection(DcMotorSimple.Direction.REVERSE); | ||
| //leftBack.setDirection(DcMotorSimple.Direction.REVERSE); | ||
| // leftBack.setDirection(DcMotorSimple.Direction.REVERSE); | ||
| rightBack.setDirection(DcMotorSimple.Direction.REVERSE); |
There was a problem hiding this comment.
Unless there is something unique/weird about your wheel motor orientations, this should likely be both left wheels set to reverse & both right wheels set to forward
| //------------------------END OF SHOOTER CONTROL----------------------------------- | ||
|
|
||
|
|
||
| /* THIS CODE IS NOT NEEDED AND WILL BE DELETED AFTER THE CLASS IS REWRITTEN |
There was a problem hiding this comment.
Just an intermediate note, even if we're not ready for it yet. I understand the desire to save old version in comments "just for reference," but this is what git commits are for. We can, at any time, view what the code looked like at a given commit. I can show you & Braelynn how to make those comparisons in Android Studio.
|
|
||
| while (opModeIsActive()) | ||
| { | ||
| if (gamepad2.left_bumper) { |
There was a problem hiding this comment.
Just a readability/organizational thing, although it gets us one step closer to "proper" coding. We can group these intake-based statements into a void function and call that function at the top of this loop instead.
private void process_intake(Intake intake){
if (gamepad2.left_bumper) {
... // The rest of the intake code
}This function belongs to the class, in other words, it needs to be defined inside of the class brackets directly, without being inside of another pair of brackets. (Just like how private enum State is defined)
Then, in the runOpMode while loop, replace the if ladder with one line:
process_intake(intake);Note that we are passing the local variable intake of type Intake into the function. The fact that they function on its end also call's it's parameter intake is not required. Only the types, Intake, have to match, not the name.
|
|
||
| if ((gamepad2.right_trigger >.25) && (gamepad2.left_trigger <.01)) | ||
| { | ||
| shooterPower = nearShooterPower; |
There was a problem hiding this comment.
No need for an intermediate variable here, you can just set shooter.setShooterPower(nearShooterPower) and so on.
| case RAMPING: | ||
| if(getRuntime() > rampUpTimer) { | ||
| shooter.setShooterPower(shooterPower);//set power to shooter | ||
| currentState = State.LAUNCHING; | ||
| } | ||
| break; |
There was a problem hiding this comment.
Excellent, I will mention again that you're not supposed to need to set the motor power continuously. Its supposed to run at x% power until told otherwise. If real behavior is different, it seems likely there is a setPower(0) getting triggered somewhere it isn't supposed to.
| carousel.engageShooterServo(); | ||
| carousel.releaseShooterServo(); | ||
|
|
||
| //carousel.resetCarousel(); | ||
| currentState = State.IDLE; |
There was a problem hiding this comment.
I'd make a boolean function here that handles the servo timings. You'd need a very similar time control to how you handled the rampUpTimer. Just done twice, once for the engage, and then again for the release.
So here in the state machine you'd have:
if carousel.shoot(getRuntime()) { // return false if servos are still moving, true otherwise
currentState = State.IDLE;
}
and then in the Carousel class, you'd declare & define:
public boolean shoot(double runTime){
// setup timer here x2
// check against timer here x2
if ... {
...
// now both servo movements are done
return true;
}
return false; // timers are not done yet.
}
There was a problem hiding this comment.
The alternative is to make the servo manually controlled & set a boolean flag so that when the servo is commanded to be out, the carousel cannot be commanded to rotate.
…of 12/5/2025. Setting up code to tilt and lift teardrop
…itions. Values set for new and far shooter tilt. Code with state engine is working. Bot intakes, shoots, lifts the kicker, tilts the shooter, and drives as of 12/6/2025.
Before issuing a pull request, please see the contributing page.