-
Notifications
You must be signed in to change notification settings - Fork 0
Seed start position in auto #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
64b6653
42fea26
298d1a0
2f1732e
af8f0c2
47ddb4f
7e25262
d0f90dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| { | ||
| "version": "2025.0", | ||
| "waypoints": [ | ||
| { | ||
| "anchor": { | ||
| "x": 6.341931818174691, | ||
| "y": 6.502940340914731 | ||
| }, | ||
| "prevControl": null, | ||
| "nextControl": { | ||
| "x": 5.574119318174691, | ||
| "y": 6.173877840914731 | ||
| }, | ||
| "isLocked": false, | ||
| "linkedName": null | ||
| }, | ||
| { | ||
| "anchor": { | ||
| "x": 10.619744318174691, | ||
| "y": 6.502940340914731 | ||
| }, | ||
| "prevControl": { | ||
| "x": 11.317753813036703, | ||
| "y": 5.944528914045714 | ||
| }, | ||
| "nextControl": { | ||
| "x": 9.92173482331268, | ||
| "y": 7.061351767783748 | ||
| }, | ||
| "isLocked": false, | ||
| "linkedName": null | ||
| }, | ||
| { | ||
| "anchor": { | ||
| "x": 11.198096590901963, | ||
| "y": 2.2550426136420048 | ||
| }, | ||
| "prevControl": { | ||
| "x": 10.639687499992872, | ||
| "y": 2.544218750005635 | ||
| }, | ||
| "nextControl": null, | ||
| "isLocked": false, | ||
| "linkedName": null | ||
| } | ||
| ], | ||
| "rotationTargets": [ | ||
| { | ||
| "waypointRelativePos": 0.46003552397868663, | ||
| "rotationDegrees": -140.0 | ||
| }, | ||
| { | ||
| "waypointRelativePos": 0.5648312611012444, | ||
| "rotationDegrees": -40.0 | ||
| } | ||
| ], | ||
| "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": -53.67317404787988 | ||
| }, | ||
| "reversed": false, | ||
| "folder": null, | ||
| "idealStartingState": { | ||
| "velocity": 0, | ||
| "rotation": -154.85521436932117 | ||
| }, | ||
| "useDefaultConstraints": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package frc.robot; | ||
|
|
||
| import edu.wpi.first.math.geometry.Pose2d; | ||
| import edu.wpi.first.math.geometry.Rotation2d; | ||
| import edu.wpi.first.networktables.BooleanPublisher; | ||
| import edu.wpi.first.networktables.DoublePublisher; | ||
| import edu.wpi.first.networktables.DoubleSubscriber; | ||
|
|
@@ -8,13 +10,16 @@ | |
| import edu.wpi.first.networktables.StringPublisher; | ||
| import edu.wpi.first.networktables.StringSubscriber; | ||
| import edu.wpi.first.wpilibj.DriverStation; | ||
| import edu.wpi.first.wpilibj.DriverStation.Alliance; | ||
| import edu.wpi.first.wpilibj2.command.Command; | ||
| import edu.wpi.first.wpilibj2.command.CommandScheduler; | ||
| import frc.robot.commands.strategies.AutoIntake; | ||
| import frc.robot.commands.strategies.AutoScore; | ||
| import frc.robot.constants.AutoStrategy; | ||
| import frc.robot.constants.AutoStrategyContainer.Action; | ||
| import frc.robot.constants.AutoStrategyContainer.ActionType; | ||
| import frc.robot.constants.FeatureFlags; | ||
| import frc.robot.constants.VisionConstants; | ||
| import frc.robot.subsystems.drive.Drive; | ||
| import frc.robot.subsystems.drive.Drive.DesiredLocation; | ||
| import frc.robot.subsystems.scoring.ScoringSubsystem; | ||
|
|
@@ -435,6 +440,22 @@ public void autonomousInit(AutoStrategy strategy) { | |
| this.currentCommand = null; | ||
| this.currentAction = null; | ||
|
|
||
| if (!FeatureFlags.synced.getObject().runVision | ||
| || drive.getVisionMeasurementCount() | ||
| < VisionConstants.synced.getObject().minimumVisionMeasurementInitCount) { | ||
| Pose2d startPose = | ||
| new Pose2d(strategy.startSeededPositionTranslation, strategy.startSeededPositionRotation); | ||
| if (DriverStation.getAlliance().isPresent() | ||
| && DriverStation.getAlliance().get() == Alliance.Blue) { | ||
| startPose = | ||
| new Pose2d( | ||
| 17.3736 - startPose.getX(), | ||
| 7.9248 - startPose.getY(), | ||
| new Rotation2d(startPose.getRotation().getRadians() - Math.PI / 2)); | ||
|
Comment on lines
+451
to
+454
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add verification that this works when we are on the blue alliance? I think a screenshot of where the robot thinks it starts in auto would be fine for this for blue
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| drive.setPose(startPose); | ||
| } | ||
|
|
||
| actions.clear(); | ||
| this.addActionsFromAutoStrategy(strategy); | ||
| System.out.println("New actions loaded: " + String.valueOf(actions.size())); | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we need to turn this back on before merging