Class MARSAuto

java.lang.Object
com.marslib.auto.MARSAuto

public class MARSAuto extends Object
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 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