make those autos

This commit is contained in:
Michael Mikovsky
2025-01-23 19:32:12 -07:00
parent 52d7659f3e
commit 4a45243828
26 changed files with 1137 additions and 54 deletions
@@ -16,6 +16,8 @@ import java.util.List;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import frc4388.utility.controller.XboxController;
import frc4388.utility.controller.DeadbandedXboxController;
import frc4388.robot.Constants.OIConstants;
@@ -36,6 +38,8 @@ import frc4388.robot.commands.GotoPositionCommand;
import frc4388.robot.commands.Swerve.neoJoystickPlayback;
import frc4388.robot.commands.Swerve.neoJoystickRecorder;
import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto;
// Subsystems
@@ -89,6 +93,7 @@ public class RobotContainer {
// ! /* Autos */
private String lastAutoName = "defualt.auto";
private final SendableChooser<Command> autoChooser;
private ConfigurableString autoplaybackName = new ConfigurableString("Auto Playback Name", lastAutoName);
private neoJoystickPlayback autoPlayback = new neoJoystickPlayback(m_robotSwerveDrive,
() -> autoplaybackName.get(), // lastAutoName
@@ -120,6 +125,8 @@ public class RobotContainer {
.withName("SwerveDrive DefaultCommand"));
m_robotSwerveDrive.setToSlow();
autoChooser = AutoBuilder.buildAutoChooser();
SmartDashboard.putData("Auto Chooser", autoChooser);
// this.subsystems.add(m_robotSwerveDrive);
// this.subsystems.add(m_robotMap.leftFront);
// this.subsystems.add(m_robotMap.rightFront);
@@ -270,15 +277,17 @@ public class RobotContainer {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
//return autoPlayback;
//return new GotoPositionCommand(m_robotSwerveDrive, m_vision);
try{
// Load the path you want to follow using its name in the GUI
return new PathPlannerAuto("New Auto");
} catch (Exception e) {
DriverStation.reportError("Path planner error: " + e.getMessage(), e.getStackTrace());
return Commands.none();
}
//return new GotoPositionCommand(m_robotSwerveDrive, m_vision)
return autoChooser.getSelected();
// try{
// // Load the path you want to follow using its name in the GUI
// return new PathPlannerAuto("New Auto");
// } catch (Exception e) {
// DriverStation.reportError("Path planner error: " + e.getMessage(), e.getStackTrace());
// return Commands.none();
// }
// zach told me to do the below comment
//return new GotoPositionCommand(m_robotSwerveDrive, m_vision);
// return new GotoPositionCommand(m_robotSwerveDrive, m_vision, AutoConstants.targetpos);