Hello! Our robot currently drives +90 degrees in the wrong direction while we use pathplanner, even when we use a straight line. Here is a photo of our path:
We know that events and moving has worked before. (at our last offseason competition we rotated each holonomic degrees by 90 degrees as a band-aid fix) However rotation doesn’t work due to the holonomic degrees being 90 degrees off what the bot is actually facing.
We are unsure what is causing this issue, and what to fix it so we can do a more than 1 gamepiece auto.
This is how we building the auto command:
/**
* Builds the auto command from the path group.
*
* @param pathGroup The path group to build the auto command from.
* @return The auto command.
*/
public edu.wpi.first.wpilibj2.command.Command buildAuto(List<PathPlannerTrajectory> pathGroup) {
buildCommands();
// for (int i = 0; i < pathGroup.`; i++) {
// }
SwerveAutoBuilder autoBuilder = new SwerveAutoBuilder(
poseStuff::get, // Pose2d supplier
poseStuff::reset, // Pose2d consumer, used to reset odometry at the beginning of auto
new PIDConstants(6, 0.0, 0.0), // PID constants to correct for translation error (used to create the X
// and Y PID controllers)
new PIDConstants(2.5, 0.0, 0.0), // PID constants to correct for rotation error (used to create the
// rotation controller)
swerveDrive::accept, // Module states consumer used to output to the drive subsystem
eventMap,
false, // Should the path be automatically mirrored depending on alliance color.
// Optional, defaults to true
swerveDrive // The drive subsystem. Used to properly set the requirements of path following
// commands
);
edu.wpi.first.wpilibj2.command.Command fullAuto = autoBuilder.fullAuto(pathGroup);
traj = pathGroup.get(0);
// holDrive = new HolonomicDriveCommand(swerveDrive, traj, poseStuff);
return fullAuto;
}