Hello,
I am using a trajectory generator to generate a path and a SwerveControllerCommand to control the modules like the following:
Trajectory exampletrajectory = TrajectoryGenerator,generateTrajectory(new Pose2d(0, 0, new Rotation2d(0)), List.of(), new Pose2d(1, 0, new Rotation2d(0)), config);
var thetaController = new ProfiledPiDCOntroller(Constants.AutoConstants.kPThetaController, 0, 0, Constants.AutoConstants.kThetaControllerCOnstraints);
SwerveControllerCommand swerveControllerCOmmand = new SwerveControllerCommand(exampleTrajectory, s_Swerve::getPose, Constants.Swerve.swerveKinematics, new PIDController(Constants.AutoConstants.kPXController, 0, 0), new PIDController(Constants.AutoCOnstants.kPYController, 0, 0), thetaController, s_Swerve::setModuleStates, s_Swerve);
addCommands(swerveControllerCommand);
For some reason, when I run this auton path, the robot’s wheels seem to jitter around in random directions almost, and behave randomly. Sometimes when I run the code, the robot goes forwards, while other times it goes backwards and sometimes it doesn’t even move.