001/************************* PROJECT RON *************************/
002/* Copyright (c) 2026 StuyPulse Robotics. All rights reserved. */
003/* Use of this source code is governed by an MIT-style license */
004/* that can be found in the repository LICENSE file.           */
005/***************************************************************/
006package com.stuypulse.robot.commands.swerve;
007
008import com.stuypulse.robot.subsystems.swerve.CommandSwerveDrivetrain;
009import edu.wpi.first.wpilibj2.command.Command;
010
011public class SwerveDriveDriveWithRobotRelativeSpeeds extends Command {
012
013    private final CommandSwerveDrivetrain swerve;
014
015    private double velocityX;
016
017    private double velocityY;
018
019    private double angularVelocity;
020
021    public SwerveDriveDriveWithRobotRelativeSpeeds(
022            double velocityX, double velocityY, double angularVelocity) {
023        this.swerve = CommandSwerveDrivetrain.getInstance();
024        this.velocityX = velocityX;
025        this.velocityY = velocityY;
026        this.angularVelocity = angularVelocity;
027        addRequirements(swerve);
028    }
029
030    @Override
031    public void execute() {
032        swerve.setControl(
033                swerve
034                        .getRobotCentricSwerveRequest()
035                        .withVelocityX(velocityX)
036                        .withVelocityY(velocityY)
037                        .withRotationalRate(angularVelocity));
038    }
039}