xdytfchbjn m

This commit is contained in:
samuel desharnais
2023-10-24 19:47:28 -04:00
parent dfbedc1b46
commit 2834bb691b
9 changed files with 182 additions and 1 deletions

View File

@ -5,14 +5,31 @@
package frc.robot.subsystems;
import java.io.File;
import java.io.IOException;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import swervelib.SwerveDrive;
import swervelib.parser.SwerveParser;
public class Drive extends SubsystemBase {
SwerveDrive swerveDrive;
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
public void drive(double x, double y, double zRotation){
swerveDrive.drive(new Translation2d(x, y), zRotation, true, true);
}
/** Creates a new Drive. */
public Drive() {}
public Drive() {
try {
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void periodic() {