From 1d731fb63ee25492382b9665ddf641e918593eba Mon Sep 17 00:00:00 2001 From: NatureNitaso <86992928+NatureNitaso@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:52:53 -0700 Subject: [PATCH] Initial Changes to tankDrive Gives inputs now to both the left power and right power of drive motor --- .../competition/subsystems/drive/DriveSubsystem.java | 1 + .../drive/commands/TankDriveWithJoysticksCommand.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/competition/subsystems/drive/DriveSubsystem.java b/src/main/java/competition/subsystems/drive/DriveSubsystem.java index b9066ba..4548edc 100644 --- a/src/main/java/competition/subsystems/drive/DriveSubsystem.java +++ b/src/main/java/competition/subsystems/drive/DriveSubsystem.java @@ -43,6 +43,7 @@ public void tankDrive(double leftPower, double rightPower) { // to // the value of leftPower: frontLeft.set(leftPower); + frontRight.set(rightPower); } @Override diff --git a/src/main/java/competition/subsystems/drive/commands/TankDriveWithJoysticksCommand.java b/src/main/java/competition/subsystems/drive/commands/TankDriveWithJoysticksCommand.java index 4ac1709..76c535a 100644 --- a/src/main/java/competition/subsystems/drive/commands/TankDriveWithJoysticksCommand.java +++ b/src/main/java/competition/subsystems/drive/commands/TankDriveWithJoysticksCommand.java @@ -34,13 +34,19 @@ public void execute() { // Get values from the joysticks: // Here's how to get how far the left joystick's Y-axis is pushed: double leftValue = operatorInterface.gamepad.getLeftVector().y; - // You'll need to get how far the RIGHT joystick's Y-axis is pushed as well. + double rightValue = operatorInterface.gamepad.getRightVector().y; + // You'll need to get how far the RIGHT joystick's Y-axis is pushed as well + returnVal(leftValue); + returnVal(rightValue); // Pass values into the DriveSubsystem so it can control motors: // right now, this just sends the left power to the left part of the drive. // You'll // need to give it a right power as well. - drive.tankDrive(leftValue, 0); + drive.tankDrive(leftValue, rightValue); } + public double returnVal(double val){ + return val; + } }