88from wpimath .controller import PIDController , ProfiledPIDControllerRadians
99from wpimath .geometry import Pose2d , Rotation2d , Translation2d
1010from wpimath .trajectory import TrajectoryConfig , TrajectoryGenerator
11+ from wpimath .controller import HolonomicDriveController
1112
1213from constants import AutoConstants , DriveConstants , OIConstants
1314from subsystems .drivesubsystem import DriveSubsystem
@@ -88,24 +89,14 @@ def getAutonomousCommand(self) -> commands2.Command:
8889 config ,
8990 )
9091
91- thetaController = ProfiledPIDControllerRadians (
92- AutoConstants .kPThetaController ,
93- 0 ,
94- 0 ,
95- AutoConstants .kThetaControllerConstraints ,
96- )
97- thetaController .enableContinuousInput (- math .pi , math .pi )
98-
9992 swerveControllerCommand = commands2 .SwerveControllerCommand (
10093 exampleTrajectory ,
10194 self .robotDrive .getPose , # Functional interface to feed supplier
10295 DriveConstants .kDriveKinematics ,
10396 # Position controllers
104- PIDController (AutoConstants .kPXController , 0 , 0 ),
105- PIDController (AutoConstants .kPYController , 0 , 0 ),
106- thetaController ,
97+ AutoConstants .kPIDController ,
10798 self .robotDrive .setModuleStates ,
108- (self .robotDrive ,),
99+ (self .robotDrive ,)
109100 )
110101
111102 # Reset odometry to the starting pose of the trajectory.
@@ -117,4 +108,4 @@ def getAutonomousCommand(self) -> commands2.Command:
117108 lambda : self .robotDrive .drive (0 , 0 , 0 , False , False ),
118109 self .robotDrive ,
119110 )
120- )
111+ )
0 commit comments