From fcc9d3bdda3f833a7decad626e7ad904d8ac3268 Mon Sep 17 00:00:00 2001 From: Aarav Shah Date: Mon, 27 Feb 2023 18:25:14 -0700 Subject: [PATCH] Delete DriveWithInput.java --- .../robot/commands/DriveWithInput.java | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/main/java/frc4388/robot/commands/DriveWithInput.java diff --git a/src/main/java/frc4388/robot/commands/DriveWithInput.java b/src/main/java/frc4388/robot/commands/DriveWithInput.java deleted file mode 100644 index 3b4d638..0000000 --- a/src/main/java/frc4388/robot/commands/DriveWithInput.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc4388.robot.commands; - -import java.util.function.Supplier; - -import edu.wpi.first.math.MathUtil; -import edu.wpi.first.math.filter.SlewRateLimiter; -import edu.wpi.first.math.util.Units; -import edu.wpi.first.wpilibj2.command.CommandBase; -import frc4388.robot.Constants.SwerveDriveConstants; -import frc4388.robot.subsystems.SwerveDrive; - -public class DriveWithInput extends CommandBase { - - private final SwerveDrive swerve; - - private final Supplier xSpeed; - private final Supplier ySpeed; - private final Supplier rot; - private final boolean fieldRelative; - - private final SlewRateLimiter xLimiter, yLimiter, rotLimiter; - - /** Creates a new DriveWithInput. */ - public DriveWithInput(SwerveDrive swerve, Supplier xSpeed, Supplier ySpeed, Supplier rot, boolean fieldRelative) { - // Use addRequirements() here to declare subsystem dependencies. - this.swerve = swerve; - this.xSpeed = xSpeed; - this.ySpeed = ySpeed; - this.rot = rot; - this.fieldRelative = fieldRelative; - - this.xLimiter = new SlewRateLimiter(3); - this.yLimiter = new SlewRateLimiter(3); - this.rotLimiter = new SlewRateLimiter(3); - - addRequirements(swerve); - } - - // Called when the command is initially scheduled. - @Override - public void initialize() {} - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - double x = xSpeed.get(); - double y = ySpeed.get(); - double r = rot.get(); - - x = -xLimiter.calculate(MathUtil.applyDeadband(x * -0.3, 0.02) * Units.feetToMeters(SwerveDriveConstants.MAX_SPEED_FEET_PER_SECOND)); - y = -yLimiter.calculate(MathUtil.applyDeadband(y * 0.3, 0.02) * Units.feetToMeters(SwerveDriveConstants.MAX_SPEED_FEET_PER_SECOND)); - r = -rotLimiter.calculate(MathUtil.applyDeadband(r * 0.3, 0.02) * Units.feetToMeters(5*Math.PI)); - - swerve.drive(x, y, r, fieldRelative); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - System.out.println("----------------------------------------------------------------"); - System.out.println("DriveWithInput ended"); - System.out.println("Interrupted: " + interrupted); - System.out.println("----------------------------------------------------------------"); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -}