make autos

This commit is contained in:
Michael Mikovsky
2025-01-20 15:37:37 -07:00
parent e5cdcd0c07
commit 52d7659f3e
5 changed files with 84 additions and 11 deletions
@@ -9,6 +9,18 @@
"data": { "data": {
"pathName": "Example Path" "pathName": "Example Path"
} }
},
{
"type": "named",
"data": {
"name": "AutoGotoPosition"
}
},
{
"type": "path",
"data": {
"pathName": "New Path"
}
} }
] ]
} }
@@ -3,25 +3,25 @@
"waypoints": [ "waypoints": [
{ {
"anchor": { "anchor": {
"x": 2.415049342105263, "x": 15.106960227272728,
"y": 4.785115131578947 "y": 2.120426136363636
}, },
"prevControl": null, "prevControl": null,
"nextControl": { "nextControl": {
"x": 2.905756578947368, "x": 15.101585096858368,
"y": 4.794736842105262 "y": 2.396686756913594
}, },
"isLocked": false, "isLocked": false,
"linkedName": null "linkedName": null
}, },
{ {
"anchor": { "anchor": {
"x": 3.8294407894736837, "x": 15.106960227272728,
"y": 5.862746710526316 "y": 4.005056818181817
}, },
"prevControl": { "prevControl": {
"x": 3.0693256578947365, "x": 15.10799254912145,
"y": 5.872368421052631 "y": 3.6525397317875603
}, },
"nextControl": null, "nextControl": null,
"isLocked": false, "isLocked": false,
@@ -42,13 +42,13 @@
}, },
"goalEndState": { "goalEndState": {
"velocity": 0, "velocity": 0,
"rotation": 0.0 "rotation": -179.09061955080082
}, },
"reversed": false, "reversed": false,
"folder": null, "folder": null,
"idealStartingState": { "idealStartingState": {
"velocity": 0, "velocity": 0,
"rotation": -2.4366482468102095 "rotation": 178.99491399474587
}, },
"useDefaultConstraints": true "useDefaultConstraints": true
} }
@@ -0,0 +1,54 @@
{
"version": "2025.0",
"waypoints": [
{
"anchor": {
"x": 14.398977272727272,
"y": 4.015028409090909
},
"prevControl": null,
"nextControl": {
"x": 13.651107954545454,
"y": 4.005056818181817
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 15.525767045454545,
"y": 5.271448863636363
},
"prevControl": {
"x": 14.857670454545453,
"y": 5.690255681818181
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
"unlimited": false
},
"goalEndState": {
"velocity": 0,
"rotation": 177.06432655357875
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0,
"rotation": -178.8308606720925
},
"useDefaultConstraints": true
}
+3 -1
View File
@@ -354,7 +354,9 @@ public final class Constants {
public static final class FieldConstants { public static final class FieldConstants {
public static final AprilTagFieldLayout kTagLayout = AprilTagFieldLayout.loadField(AprilTagFields.k2025Reefscape); public static final AprilTagFieldLayout kTagLayout = AprilTagFieldLayout.loadField(AprilTagFields.k2025Reefscape);
public static final double HORISONTAL_SCORING_POSITION_OFFSET = Units.inchesToMeters(6.5); public static final double HORISONTAL_SCORING_POSITION_OFFSET = 0;
// public static final double HORISONTAL_SCORING_POSITION_OFFSET = Units.inchesToMeters(6.5); // Positive is Right
public static final double VERTICAL_SCORING_POSITION_OFFSET = Units.inchesToMeters(20); public static final double VERTICAL_SCORING_POSITION_OFFSET = Units.inchesToMeters(20);
@@ -35,6 +35,8 @@ import frc4388.utility.controller.VirtualController;
import frc4388.robot.commands.GotoPositionCommand; import frc4388.robot.commands.GotoPositionCommand;
import frc4388.robot.commands.Swerve.neoJoystickPlayback; import frc4388.robot.commands.Swerve.neoJoystickPlayback;
import frc4388.robot.commands.Swerve.neoJoystickRecorder; import frc4388.robot.commands.Swerve.neoJoystickRecorder;
import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto; import com.pathplanner.lib.commands.PathPlannerAuto;
// Subsystems // Subsystems
// import frc4388.robot.subsystems.LED; // import frc4388.robot.subsystems.LED;
@@ -92,12 +94,15 @@ public class RobotContainer {
() -> autoplaybackName.get(), // lastAutoName () -> autoplaybackName.get(), // lastAutoName
new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()}, new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
true, false); true, false);
private Command AutoGotoPosition = new GotoPositionCommand(m_robotSwerveDrive, m_vision);
/** /**
* The container for the robot. Contains subsystems, OI devices, and commands. * The container for the robot. Contains subsystems, OI devices, and commands.
*/ */
public RobotContainer() { public RobotContainer() {
NamedCommands.registerCommand("AutoGotoPosition", AutoGotoPosition);
configureButtonBindings(); configureButtonBindings();
configureVirtualButtonBindings(); configureVirtualButtonBindings();
new DeferredBlock(() -> m_robotSwerveDrive.resetGyro()); new DeferredBlock(() -> m_robotSwerveDrive.resetGyro());