diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index b06da58..907caf3 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -3,6 +3,7 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.button.JoystickButton; +import frc.robot.Robot.ControlMode; import frc.robot.commands.TeleopSwerve; import frc.robot.subsystems.*; import frc.robot.util.*; @@ -89,8 +90,14 @@ private void configureButtonBindings() { new RunCommand(() -> ShooterSubsystem.ampShot(true), ShooterSubsystem)); } + public Command getAutonomousCommand() { + // Load the path you want to follow using its name in the GUI + PathPlannerPath path = PathPlannerPath.fromPathFile("Path 1"); - public Command getAutonomousCommand() { + // Create a path following command using AutoBuilder. This will also trigger event markers. + return AutoBuilder.followPathWithEvents(path);} + + /*public Command getAutonomousCommand() { return AutonomousManager.getCommand(); - } + }*/ } diff --git a/src/main/java/frc/robot/subsystems/SwerveSubsystem.java b/src/main/java/frc/robot/subsystems/SwerveSubsystem.java index 90cb356..9c67c9d 100644 --- a/src/main/java/frc/robot/subsystems/SwerveSubsystem.java +++ b/src/main/java/frc/robot/subsystems/SwerveSubsystem.java @@ -15,6 +15,10 @@ import com.ctre.phoenix6.hardware.Pigeon2; import com.ctre.phoenix6.configs.Pigeon2Configuration; +import com.pathplanner.lib.auto.AutoBuilder; +import com.pathplanner.lib.util.PathPlannerLogging; + + public class SwerveSubsystem extends SubsystemBase { public Pigeon2 gyro = new Pigeon2(Constants.Swerve.PIGEON2_ID, "rio"); private SwerveDriveOdometry swerveOdometry; // Odometry class helps track where the robot is relative to where it started