Skip to content

Commit

Permalink
Change follow trajetory to FollowPathHolonomic
Browse files Browse the repository at this point in the history
  • Loading branch information
BenG49 committed Jan 12, 2024
1 parent 236e793 commit 174b112
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import java.util.HashMap;
import java.util.List;

import com.pathplanner.lib.commands.FollowPathCommand;
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
import com.pathplanner.lib.commands.FollowPathHolonomic;
import com.pathplanner.lib.path.PathPlannerPath;
import com.pathplanner.lib.path.PathPlannerTrajectory;
import com.pathplanner.lib.util.ReplanningConfig;
import com.stuypulse.robot.constants.Settings;
import com.stuypulse.robot.constants.Settings.Swerve.Motion;
import com.stuypulse.robot.subsystems.odometry.Odometry;
import com.stuypulse.robot.subsystems.swerve.SwerveDrive;
import com.stuypulse.stuylib.math.Vector2D;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
Expand All @@ -25,7 +25,7 @@
import edu.wpi.first.wpilibj.smartdashboard.FieldObject2d;
import edu.wpi.first.wpilibj2.command.Command;

public class SwerveDriveFollowTrajectory extends FollowPathCommand {
public class SwerveDriveFollowTrajectory extends FollowPathHolonomic {

public static HashMap<String, PathPlannerTrajectory> getSeparatedPaths(List<PathPlannerTrajectory> paths, String... names) {
if (paths.size() != names.length)
Expand Down Expand Up @@ -54,19 +54,19 @@ public SwerveDriveFollowTrajectory(PathPlannerPath path) {
Odometry.getInstance()::getPose,
SwerveDrive.getInstance()::getChassisSpeeds,
SwerveDrive.getInstance()::setChassisSpeeds,
new PPHolonomicDriveController(Motion.XY, Motion.THETA, Settings.Swerve.MAX_MODULE_SPEED.get(), Settings.Swerve.WIDTH),
Motion.XY,
Motion.THETA,
Settings.Swerve.MAX_MODULE_SPEED.get(),
new Vector2D(Settings.Swerve.WIDTH / 2, Settings.Swerve.LENGTH / 2).distance(),
new ReplanningConfig(),
() -> {


var alliance = DriverStation.getAlliance();
if (alliance.isPresent()) {
return alliance.get() == DriverStation.Alliance.Red;
}
return false;
},
SwerveDrive.getInstance()

);

robotRelative = false;
Expand Down

0 comments on commit 174b112

Please sign in to comment.