From b9cd443ebe6f6ec4f23c603842ab1d5d9153d59e Mon Sep 17 00:00:00 2001 From: eileha Date: Sat, 31 Jan 2026 11:44:55 -0800 Subject: [PATCH] trying stuff --- .../pathplanner/paths/Example Path.path | 77 +++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 8 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/main/deploy/pathplanner/paths/Example Path.path diff --git a/src/main/deploy/pathplanner/paths/Example Path.path b/src/main/deploy/pathplanner/paths/Example Path.path new file mode 100644 index 0000000..8cb5742 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/Example Path.path @@ -0,0 +1,77 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 6.73143534994069, + "y": 6.514994068801898 + }, + "prevControl": null, + "nextControl": { + "x": 7.0757295373665485, + "y": 5.621981020166073 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 7.710521945432978, + "y": 4.8795966785290625 + }, + "prevControl": { + "x": 7.1295255041518395, + "y": 5.6112218268090155 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [ + { + "name": "Index", + "waypointRelativePos": 0.5894263217097863, + "endWaypointRelativePos": 1.0, + "command": { + "type": "named", + "data": { + "name": "Intake" + } + } + }, + { + "name": "Index", + "waypointRelativePos": 0.589426321709788, + "endWaypointRelativePos": 1.0, + "command": { + "type": "named", + "data": { + "name": "Index" + } + } + } + ], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": 0.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -6.7298911483521735 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3dff779..5f0e062 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,6 +7,7 @@ import org.json.simple.parser.ParseException; import org.littletonrobotics.junction.Logger; import com.pathplanner.lib.auto.AutoBuilder; +import com.pathplanner.lib.auto.NamedCommands; import com.pathplanner.lib.commands.PathPlannerAuto; import edu.wpi.first.math.geometry.Pose3d; @@ -15,6 +16,7 @@ import edu.wpi.first.wpilibj.RobotController; import edu.wpi.first.wpilibj.livewindow.LiveWindow; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.InstantCommand; import frc.robot.commands.DoNothing; import frc.robot.commands.drive_comm.DefaultDriveCommand; import frc.robot.commands.vision.ShutdownAllPis; @@ -26,6 +28,7 @@ import frc.robot.controls.Operator; import frc.robot.controls.PS5ControllerDriverConfig; import frc.robot.subsystems.drivetrain.Drivetrain; import frc.robot.subsystems.drivetrain.GyroIOPigeon2; +import frc.robot.subsystems.indexer.Spindexer; import frc.robot.util.PathGroupLoader; import frc.robot.util.Vision.DetectedObject; import frc.robot.util.Vision.Vision; @@ -44,6 +47,7 @@ public class RobotContainer { private Drivetrain drive = null; private Vision vision = null; private Command auto = new DoNothing(); + private Spindexer spindexer = null; // Controllers are defined here private BaseDriverConfig driver = null; @@ -81,6 +85,8 @@ public class RobotContainer { drive = new Drivetrain(vision, new GyroIOPigeon2()); driver = new PS5ControllerDriverConfig(drive); operator = new Operator(drive); + // added indexer here for now + spindexer = new Spindexer(); // Detected objects need access to the drivetrain DetectedObject.setDrive(drive); @@ -142,7 +148,7 @@ public class RobotContainer { } public void registerCommands() { - + NamedCommands.registerCommand("Index", new InstantCommand(() -> spindexer.run())); } public static BooleanSupplier getAllianceColorBooleanSupplier() { -- 2.39.5