Skip to content

Bloomkd46/just-drive#27

Merged
pauldalyii merged 2 commits into
mainfrom
bloomkd46/just-drive
Nov 22, 2025
Merged

Bloomkd46/just-drive#27
pauldalyii merged 2 commits into
mainfrom
bloomkd46/just-drive

Conversation

@bloomkd46

Copy link
Copy Markdown
Collaborator

It does just that. It drives

Copilot AI review requested due to automatic review settings November 8, 2025 21:03

Copilot AI left a comment

Copy link
Copy Markdown

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 teleop program called "Just Drive" that provides basic driving functionality for an FTC robot. The program allows a driver to control the robot's movement using gamepad inputs with speed modulation via triggers.

  • New teleop operation mode focused solely on drive control
  • Implements gamepad-based drive control with trigger-based speed adjustment
  • Uses the existing Robot hardware abstraction for drive commands

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

@@ -0,0 +1,69 @@
package org.firstinspires.ftc.teamcode.programs.teleop;

import com.qualcomm.robotcore.eventloop.opmode.Disabled;

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

The Disabled import is unused and should be removed. Unlike the similar Decode.java file, this class does not have the @disabled annotation.

Suggested change
import com.qualcomm.robotcore.eventloop.opmode.Disabled;

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

The imports DcMotor and DcMotorEx are unused in this class and should be removed.

Suggested change
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;

Copilot uses AI. Check for mistakes.
public class JustDrive extends OpMode {
public Robot robot;

//

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

Empty comment should be removed as it provides no value.

Suggested change
//

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +57
double x = gamepad1.left_stick_x / 3;
x *= 2;
x += gamepad1.right_trigger * (gamepad1.left_stick_x / 3);
x -= gamepad1.left_trigger * (gamepad1.left_stick_x / 3);
double y = -gamepad1.left_stick_y / 3;
y *= 2;
y += gamepad1.right_trigger * (-gamepad1.left_stick_y / 3);
y -= gamepad1.left_trigger * (-gamepad1.left_stick_y / 3);
double z = gamepad1.right_stick_x / 3;
z *= 2;
z += gamepad1.right_trigger * (gamepad1.right_stick_x / 3);
z -= gamepad1.left_trigger * (gamepad1.right_stick_x / 3);

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

The stick input values (e.g., gamepad1.left_stick_x / 3) are recomputed multiple times. Store these values in local variables to improve readability and avoid redundant calculations. For example: double leftStickXScaled = gamepad1.left_stick_x / 3;

Suggested change
double x = gamepad1.left_stick_x / 3;
x *= 2;
x += gamepad1.right_trigger * (gamepad1.left_stick_x / 3);
x -= gamepad1.left_trigger * (gamepad1.left_stick_x / 3);
double y = -gamepad1.left_stick_y / 3;
y *= 2;
y += gamepad1.right_trigger * (-gamepad1.left_stick_y / 3);
y -= gamepad1.left_trigger * (-gamepad1.left_stick_y / 3);
double z = gamepad1.right_stick_x / 3;
z *= 2;
z += gamepad1.right_trigger * (gamepad1.right_stick_x / 3);
z -= gamepad1.left_trigger * (gamepad1.right_stick_x / 3);
double leftStickXScaled = gamepad1.left_stick_x / 3;
double leftStickYScaled = -gamepad1.left_stick_y / 3;
double rightStickXScaled = gamepad1.right_stick_x / 3;
double x = leftStickXScaled;
x *= 2;
x += gamepad1.right_trigger * leftStickXScaled;
x -= gamepad1.left_trigger * leftStickXScaled;
double y = leftStickYScaled;
y *= 2;
y += gamepad1.right_trigger * leftStickYScaled;
y -= gamepad1.left_trigger * leftStickYScaled;
double z = rightStickXScaled;
z *= 2;
z += gamepad1.right_trigger * rightStickXScaled;
z -= gamepad1.left_trigger * rightStickXScaled;

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +47
double x = gamepad1.left_stick_x / 3;
x *= 2;

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

The magic numbers /3 and *2 appear throughout the code without explanation. These should be extracted as named constants (e.g., STICK_SCALE_FACTOR and BASE_SPEED_MULTIPLIER) to clarify their purpose and make them easier to tune.

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +58
x += gamepad1.right_trigger * (gamepad1.left_stick_x / 3);
x -= gamepad1.left_trigger * (gamepad1.left_stick_x / 3);
double y = -gamepad1.left_stick_y / 3;
y *= 2;
y += gamepad1.right_trigger * (-gamepad1.left_stick_y / 3);
y -= gamepad1.left_trigger * (-gamepad1.left_stick_y / 3);
double z = gamepad1.right_stick_x / 3;
z *= 2;
z += gamepad1.right_trigger * (gamepad1.right_stick_x / 3);
z -= gamepad1.left_trigger * (gamepad1.right_stick_x / 3);

Copilot AI Nov 8, 2025

Copy link

Choose a reason for hiding this comment

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

The logic appears incorrect. After multiplying by 2 on line 47, lines 48-49 add/subtract the original scaled value, which seems unintended. If the right trigger is meant to increase speed, it should multiply the current value of x, not add to it based on the original stick position. The intended behavior is unclear but the current implementation will produce unexpected results.

Suggested change
x += gamepad1.right_trigger * (gamepad1.left_stick_x / 3);
x -= gamepad1.left_trigger * (gamepad1.left_stick_x / 3);
double y = -gamepad1.left_stick_y / 3;
y *= 2;
y += gamepad1.right_trigger * (-gamepad1.left_stick_y / 3);
y -= gamepad1.left_trigger * (-gamepad1.left_stick_y / 3);
double z = gamepad1.right_stick_x / 3;
z *= 2;
z += gamepad1.right_trigger * (gamepad1.right_stick_x / 3);
z -= gamepad1.left_trigger * (gamepad1.right_stick_x / 3);
x *= (1 + gamepad1.right_trigger - gamepad1.left_trigger);
double y = -gamepad1.left_stick_y / 3;
y *= 2;
y *= (1 + gamepad1.right_trigger - gamepad1.left_trigger);
double z = gamepad1.right_stick_x / 3;
z *= 2;
z *= (1 + gamepad1.right_trigger - gamepad1.left_trigger);

Copilot uses AI. Check for mistakes.
@pauldalyii
pauldalyii enabled auto-merge (rebase) November 22, 2025 23:15
@pauldalyii
pauldalyii merged commit d61a80c into main Nov 22, 2025
1 check passed
@pauldalyii
pauldalyii deleted the bloomkd46/just-drive branch November 22, 2025 23:17
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.

3 participants