Skip to content

Extra auto w/o roadrunner#24

Open
Glowdisk wants to merge 5 commits into
auto-testingfrom
extraAuto
Open

Extra auto w/o roadrunner#24
Glowdisk wants to merge 5 commits into
auto-testingfrom
extraAuto

Conversation

@Glowdisk
Copy link
Copy Markdown
Contributor

@Glowdisk Glowdisk commented Nov 5, 2025

Before issuing a pull request, please see the contributing page.

@Glowdisk Glowdisk changed the title Extra auto Extra auto w/o roadrunner Nov 5, 2025
@NormalDuck NormalDuck changed the base branch from master to auto-testing November 8, 2025 01:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new emergency autonomous mode that operates without the RoadRunner library, providing a fallback option for autonomous operation. The implementation uses basic encoder-based positioning and time-based movement commands.

Key Changes

  • New RedEmergencyAutoNonRR class implementing a basic autonomous routine using encoder targets and timed movements
  • Updated MeepMeepTesting trajectories to test different starting positions and paths
  • Modified red alliance starting coordinates and path waypoints in the testing configuration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auto/nonRoadrunner/RedEmergencyAutoNonRR.java New emergency autonomous OpMode with encoder-based initial movement followed by time-based directional movements
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.java Updated red alliance trajectory testing with new starting position and refined waypoints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

frontLeftDrive.setPower(.5);

while(frontLeftDrive.isBusy() && frontRightDrive.isBusy() && backLeftDrive.isBusy() && backRightDrive.isBusy()) {
telemetry.addData("Positions", "frontLeft (%d), backLeft (%d), frontRight (%d), backRight (%d)", frontLeftDrive.getCurrentPosition(), frontRightDrive.getCurrentPosition(), backLeftDrive.getCurrentPosition(), backRightDrive.getCurrentPosition());
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The telemetry data format string has incorrect parameter order. The format shows "frontLeft, backLeft, frontRight, backRight" but the parameters are ordered as "frontLeft, frontRight, backLeft, backRight". This will display misleading position data. Either fix the format string or reorder the parameters to match.

Suggested change
telemetry.addData("Positions", "frontLeft (%d), backLeft (%d), frontRight (%d), backRight (%d)", frontLeftDrive.getCurrentPosition(), frontRightDrive.getCurrentPosition(), backLeftDrive.getCurrentPosition(), backRightDrive.getCurrentPosition());
telemetry.addData("Positions", "frontLeft (%d), backLeft (%d), frontRight (%d), backRight (%d)", frontLeftDrive.getCurrentPosition(), backLeftDrive.getCurrentPosition(), frontRightDrive.getCurrentPosition(), backRightDrive.getCurrentPosition());

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +108
moveLinear(.3,2000, "forward");
moveRotation(3,2000, "right");
moveLinear(.3,2000, "forward");
moveLinear(.3,2000, "left");
moveLinear(.3,2000, "backward");
moveStop();
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After switching motors to RUN_TO_POSITION mode (lines 88-91), the motors should have their mode reset before the subsequent moveLinear and moveRotation calls which use direct power control. The motors are still in RUN_TO_POSITION mode, which will cause the subsequent movement commands to not work as expected. Add code to reset the motors to RUN_USING_ENCODER or RUN_WITHOUT_ENCODER mode after line 102.

Copilot uses AI. Check for mistakes.
if (direction.equalsIgnoreCase("Right")) {
setPower(speed, -speed, speed, -speed);
}
Thread.sleep(time);
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Thread.sleep() in FTC autonomous code is not a best practice. The OpMode doesn't check for opModeIsActive() during the sleep, which means the robot will continue to move even if the OpMode is stopped. Use an ElapsedTime timer with a loop that checks opModeIsActive() instead.

Copilot uses AI. Check for mistakes.
Comment on lines +115 to +129
public void moveLinear(double speed, int time, String direction) throws InterruptedException {
if (direction.equalsIgnoreCase("Forward")) {
setPower(speed, speed, speed, speed);
}
if (direction.equalsIgnoreCase("Backward")) {
setPower(-speed, -speed, -speed, -speed);
}
if (direction.equalsIgnoreCase("Left")) {
setPower(-speed, speed, speed, -speed);
}
if (direction.equalsIgnoreCase("Right")) {
setPower(speed, -speed, -speed, speed);
}
Thread.sleep(time);
}
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moveLinear and moveRotation methods don't call moveStop() after the movement completes. This means motors will continue running after the time delay unless explicitly stopped. Consider adding moveStop() at the end of these methods to ensure motors stop after each movement.

Copilot uses AI. Check for mistakes.
Comment on lines +78 to +82
double FLposition = frontLeftDrive.getCurrentPosition();
double FRposition = frontRightDrive.getCurrentPosition();
double BLposition = backLeftDrive.getCurrentPosition();
double BRposition = backRightDrive.getCurrentPosition();

Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These position variables are declared but never used. The encoder positions are reset to 0 on lines 68-71, making these initial readings unnecessary. Consider removing these unused variables.

Suggested change
double FLposition = frontLeftDrive.getCurrentPosition();
double FRposition = frontRightDrive.getCurrentPosition();
double BLposition = backLeftDrive.getCurrentPosition();
double BRposition = backRightDrive.getCurrentPosition();

Copilot uses AI. Check for mistakes.
if (direction.equalsIgnoreCase("Right")) {
setPower(speed, -speed, -speed, speed);
}
Thread.sleep(time);
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Thread.sleep() in FTC autonomous code is not a best practice. The OpMode doesn't check for opModeIsActive() during the sleep, which means the robot will continue to move even if the OpMode is stopped. Use an ElapsedTime timer with a loop that checks opModeIsActive() instead, similar to the pattern on lines 98-101.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +40
* This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
* the autonomous or the teleop period of an Fh * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to be truncated or malformed. The sentence is incomplete: "the autonomous or the teleop period of an Fh * Remove or comment out...". This should be fixed to provide clear documentation.

Suggested change
* This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
* the autonomous or the teleop period of an Fh * Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list
* This file contains a minimal example of a Linear "OpMode". An OpMode is a 'program' that runs during either
* the autonomous or the teleop period of an FTC match.
* Remove or comment out the @Disabled line to add this OpMode to the Driver Station OpMode list.

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +67
waitForStart();

frontLeftDrive.setDirection(DcMotor.Direction.REVERSE);
frontRightDrive.setDirection(DcMotor.Direction.FORWARD);
backLeftDrive.setDirection(DcMotor.Direction.REVERSE);
backRightDrive.setDirection(DcMotor.Direction.FORWARD);

Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motor directions should be set before calling waitForStart(). Currently, if the OpMode is stopped between waitForStart() and the direction configuration, the motors may operate with incorrect directions. Move lines 63-66 before line 61.

Suggested change
waitForStart();
frontLeftDrive.setDirection(DcMotor.Direction.REVERSE);
frontRightDrive.setDirection(DcMotor.Direction.FORWARD);
backLeftDrive.setDirection(DcMotor.Direction.REVERSE);
backRightDrive.setDirection(DcMotor.Direction.FORWARD);
frontLeftDrive.setDirection(DcMotor.Direction.REVERSE);
frontRightDrive.setDirection(DcMotor.Direction.FORWARD);
backLeftDrive.setDirection(DcMotor.Direction.REVERSE);
backRightDrive.setDirection(DcMotor.Direction.FORWARD);
waitForStart();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants