Class LocalADStarAK

java.lang.Object
com.flarerobotics.lib.auto.LocalADStarAK
All Implemented Interfaces:
com.pathplanner.lib.pathfinding.Pathfinder

public class LocalADStarAK extends Object implements com.pathplanner.lib.pathfinding.Pathfinder
Custom PathPlanner pathfinder for AdvantageKit replay compatibility.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.pathplanner.lib.path.PathPlannerPath
    getCurrentPath(com.pathplanner.lib.path.PathConstraints constraints, com.pathplanner.lib.path.GoalEndState goalEndState)
    Get the most recently calculated path.
    boolean
    Get if a new path has been calculated since the last time a path was retrieved.
    void
    setDynamicObstacles(List<edu.wpi.first.math.Pair<edu.wpi.first.math.geometry.Translation2d,edu.wpi.first.math.geometry.Translation2d>> obs, edu.wpi.first.math.geometry.Translation2d currentRobotPos)
    Set the dynamic obstacles that should be avoided while pathfinding.
    void
    setGoalPosition(edu.wpi.first.math.geometry.Translation2d goalPosition)
    Set the goal position to pathfind to
    void
    setStartPosition(edu.wpi.first.math.geometry.Translation2d startPosition)
    Set the start position to pathfind from.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LocalADStarAK

      public LocalADStarAK()
  • Method Details

    • isNewPathAvailable

      public boolean isNewPathAvailable()
      Get if a new path has been calculated since the last time a path was retrieved.
      Specified by:
      isNewPathAvailable in interface com.pathplanner.lib.pathfinding.Pathfinder
      Returns:
      True if a new path is available.
    • getCurrentPath

      public com.pathplanner.lib.path.PathPlannerPath getCurrentPath(com.pathplanner.lib.path.PathConstraints constraints, com.pathplanner.lib.path.GoalEndState goalEndState)
      Get the most recently calculated path.
      Specified by:
      getCurrentPath in interface com.pathplanner.lib.pathfinding.Pathfinder
      Parameters:
      constraints - The path constraints to use when creating the path.
      goalEndState - The goal end state to use when creating the path.
      Returns:
      The PathPlannerPath created from the points calculated by the pathfinder.
    • setStartPosition

      public void setStartPosition(edu.wpi.first.math.geometry.Translation2d startPosition)
      Set the start position to pathfind from.
      Specified by:
      setStartPosition in interface com.pathplanner.lib.pathfinding.Pathfinder
      Parameters:
      startPosition - Start position on the field. If this is within an obstacle it will be moved to the nearest non-obstacle node.
    • setGoalPosition

      public void setGoalPosition(edu.wpi.first.math.geometry.Translation2d goalPosition)
      Set the goal position to pathfind to
      Specified by:
      setGoalPosition in interface com.pathplanner.lib.pathfinding.Pathfinder
      Parameters:
      goalPosition - Goal position on the field. f this is within an obstacle it will be moved to the nearest non-obstacle node.
    • setDynamicObstacles

      public void setDynamicObstacles(List<edu.wpi.first.math.Pair<edu.wpi.first.math.geometry.Translation2d,edu.wpi.first.math.geometry.Translation2d>> obs, edu.wpi.first.math.geometry.Translation2d currentRobotPos)
      Set the dynamic obstacles that should be avoided while pathfinding.
      Specified by:
      setDynamicObstacles in interface com.pathplanner.lib.pathfinding.Pathfinder
      Parameters:
      obs - A List of Translation2d pairs representing obstacles. Each Translation2d represents opposite corners of a bounding box.
      currentRobotPos - The current position of the robot. This is needed to change the start position of the path to properly avoid obstacles.