Final changes that make field oriented work post auto

This commit is contained in:
Bradley Bickford 2024-03-07 20:36:35 -05:00
parent e0fd9dab1d
commit c02b8b0a3c
2 changed files with 20 additions and 5 deletions

View File

@ -8,8 +8,8 @@
}, },
"prevControl": null, "prevControl": null,
"nextControl": { "nextControl": {
"x": 2.4304615881959033, "x": 2.4368920788482864,
"y": 3.1531161244140673 "y": 3.1622483921028106
}, },
"isLocked": false, "isLocked": false,
"linkedName": null "linkedName": null
@ -20,8 +20,8 @@
"y": 7.565612949407717 "y": 7.565612949407717
}, },
"prevControl": { "prevControl": {
"x": 1.7961068649410026, "x": 1.8176568333482528,
"y": 6.511464659292955 "y": 6.336387277909188
}, },
"nextControl": null, "nextControl": null,
"isLocked": false, "isLocked": false,

View File

@ -5,8 +5,13 @@
package frc.robot; package frc.robot;
import com.pathplanner.lib.auto.AutoBuilder; import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.commands.PathPlannerAuto;
import com.pathplanner.lib.path.PathPlannerPath;
import com.pathplanner.lib.path.PathPlannerTrajectory;
import com.pathplanner.lib.util.PathPlannerLogging;
import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
@ -78,9 +83,19 @@ public class RobotContainer {
tab.add("Drivetrain Pose", poseSendable) tab.add("Drivetrain Pose", poseSendable)
.withPosition(0, 0) .withPosition(0, 0)
.withSize(2, 3); .withSize(2, 3);
tab.add("Auto Selector", autoChooser)
.withPosition(2, 0)
.withSize(2, 1);
tab.addDouble("Current Pose Rotation", () -> { return drivetrain.getPose().getRotation().getDegrees(); })
.withPosition(2, 1)
.withSize(2, 1)
.withWidget(BuiltInWidgets.kTextView);
} }
public Command getAutonomousCommand() { public Command getAutonomousCommand() {
return autoChooser.getSelected(); return drivetrain.zeroHeadingCommand().andThen(autoChooser.getSelected());
} }
} }