Package com.marslib.auto
Class MARSAuto
java.lang.Object
com.marslib.auto.MARSAuto
Utility Command factory for autonomous routines.
Students: This class hooks directly into PathPlanner and Choreo. Use `runChoreoTrajectory` to execute the exact pre-rendered JSON files mapped in your deploy directory natively.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic edu.wpi.first.wpilibj2.command.CommandpathfindObstacleAvoidance(SwerveDrive drive, edu.wpi.first.math.geometry.Pose2d targetPose) Utilizes PathPlanner's A* Pathfinding to navigate avoiding obstacles.static edu.wpi.first.wpilibj2.command.CommandpathfindThenRunChoreoTrajectory(SwerveDrive drive, String choreoTrajectoryName) Executes a pre-planned Choreo trajectory but dynamically pathfinds to the start position first if the robot is off-target.static edu.wpi.first.wpilibj2.command.CommandrunChoreoTrajectory(String choreoTrajectoryName) Executes a pre-planned, time-optimal Choreo trajectory via PathPlannerLib.
-
Constructor Details
-
MARSAuto
public MARSAuto()
-
-
Method Details
-
runChoreoTrajectory
public static edu.wpi.first.wpilibj2.command.Command runChoreoTrajectory(String choreoTrajectoryName) Executes a pre-planned, time-optimal Choreo trajectory via PathPlannerLib. Retains support for PathPlanner NamedCommands hooks.- Parameters:
choreoTrajectoryName- The filename of the trajectory inside deploy/choreo- Returns:
- The autonomous execution Command
-
pathfindThenRunChoreoTrajectory
public static edu.wpi.first.wpilibj2.command.Command pathfindThenRunChoreoTrajectory(SwerveDrive drive, String choreoTrajectoryName) Executes a pre-planned Choreo trajectory but dynamically pathfinds to the start position first if the robot is off-target. This is the ultimate "Hybrid" approach.- Parameters:
drive- The SwerveDrive subsystem to retrieve constraints from.choreoTrajectoryName- The filename of the trajectory inside deploy/choreo- Returns:
- The autonomous execution Command
-
pathfindObstacleAvoidance
public static edu.wpi.first.wpilibj2.command.Command pathfindObstacleAvoidance(SwerveDrive drive, edu.wpi.first.math.geometry.Pose2d targetPose) Utilizes PathPlanner's A* Pathfinding to navigate avoiding obstacles. Helpful for dynamic teleop routing.- Parameters:
drive- The SwerveDrive subsystem to retrieve constraints from.targetPose- The destination field pose- Returns:
- Pathfinding command
-