Class PathfinderConfig

java.lang.Object
me.wobblyyyy.pathfinder.config.PathfinderConfig
Direct Known Subclasses:
SimpleConfig

public class PathfinderConfig
extends java.lang.Object
The lowest-level and least-abstract configuration available for the Pathfinder library.

All of these settings are incredibly important to how the pathfinder actually functions. If you're confused about why something isn't working, you should read through this file and make sure that you're aware of everything you're doing.

Hey! You! Yes, you. If you're reading this, trying to figure out what the hell is going wrong, you can feel free to shoot me an email on what's missing documentation. This project is designed to help people, not fry their brain.

Since:
0.1.0
Author:
Colin Robertson
  • Field Details

    • rawOdometry

      private Odometry rawOdometry
      The rawOdometry subsystem that the robot uses.

      Obviously, this is pretty necessary for a pathfinder. If you don't have any rawOdometry, you can't keep track of where the robot is. And if you can't keep track of where the robot is, then how are you supposed to actually navigate anywhere?

    • wrappedOdometry

      private OdometryWrapper wrappedOdometry
      A wrapper that surrounds the inputted rawOdometry system. This field is automatically created on initialization of a configuration class and you don't have to worry about it.
    • fieldHeight

      private int fieldHeight
      The height of the field.

      Ultimately, you're free to do whatever the hell you'd like - I could care less. However, for the sake of consistency, I'd suggest that all units of measurement be in inches unless otherwise specified.

      • FRC Field Width: 323.25 inches
      • FRC Field Height: 629.25 inches
      • FTC Field Width: 144 inches
      • FTC Field Height: 144 inches

    • fieldWidth

      private int fieldWidth
      The height of the field.

      Ultimately, you're free to do whatever the hell you'd like - I could care less. However, for the sake of consistency, I'd suggest that all units of measurement be in inches unless otherwise specified.

      • FRC Field Width: 323.25 inches
      • FRC Field Height: 629.25 inches
      • FTC Field Width: 144 inches
      • FTC Field Height: 144 inches

    • specificity

      private int specificity
      The field's "specificity" factor, which determines how double to integer conversions are handled.

      There aren't many rules for what this number can be - however, it has to be non-zero and greater than 0.

      Higher specificity values provide more accuracy at the price of more expensive calculation operations. Lower specificity values provide less accuracy at the price of much faster calculations. Although I've yet to do any performance profiling on it...

      • Low width, low height, low specificity.
        • Width: 128
        • Height: 128
        • Execution time: 113ms
      • High width, high height, low specificity.
        • Width: 1024
        • Height: 1024
        • Execution time: 622ms
      • High width, high height, high specificity.
        • Width: 2048
        • Width: 2048
        • Execution time: OutOfMemory exception...

      My point is, choose a specificity value that doesn't hinder your performance all that much. For FTC, I use a specificity of 6. For FRC, I use a specificity of 2, because the field is so fucking big.

    • robotX

      private double robotX
      The robot's X dimension.

      robotX and robotY are interchangeable - ultimately, the radius of the robot's "hit circle" is dependent on the hypotenuse of the X and Y values, so it doesn't really matter which is which.

      Ultimately, you're free to do whatever the hell you'd like - I could care less. However, for the sake of consistency, I'd suggest that all units of measurement be in inches unless otherwise specified.

    • robotY

      private double robotY
      The robot's Y dimension.

      robotX and robotY are interchangeable - ultimately, the radius of the robot's "hit circle" is dependent on the hypotenuse of the X and Y values, so it doesn't really matter which is which.

      Ultimately, you're free to do whatever the hell you'd like - I could care less. However, for the sake of consistency, I'd suggest that all units of measurement be in inches unless otherwise specified.

    • gapX

      private double gapX
      The X distance, measured in inches, between the FR-FL pair of swerve modules. This distance should be measured from the very center of the swerve module's rotational radius.
    • gapY

      private double gapY
      The X distance, measured in inches, between the FR-BR pair of swerve modules. This distance should be measured from the very center of the swerve module's rotational radius.
    • profile

      private RobotProfile profile
      The robot's motion file, used in motion profiling and planning.

      Out-of-the-box, Pathfinder is tuned to use a proportional integral derivative controller follower to follow a predefined path. In order to effectively optimize this follower, there are some coefficients that need to be known.

      For more information regarding robot profiling, go click on the RobotProfile class. Here. A link, because I'm just so kind, right? RobotProfile

    • rawDrive

      private Drive rawDrive
      The robot's drivetrain.

      Now, obviously, we both know that a wheeled robot needs to have wheels to move, right? In order to make the pathfinder able to control the robot and its movement, we have to give the pathfinder some interface to control the motors. This is that interface.

    • wrappedDrive

      private Drive wrappedDrive
      Wrapper surrounding the robot's drive interface.
    • map

      private Map map
      The field's map.

      Go read these JavaDocs if you're confused about what a map is. Map

    • follower

      private Followers follower
      What type of follower does the pathfinder use?

      All of the types of followers and information about them can be found right here. Or here. Or, actually, here. Just kidding, it's right here: Followers

    • usesLightning

      private boolean usesLightning
      Should the pathfinder use the lightning finder, or skip it entirely?

      Generally, using the lighting and fast followers is optimal, as the amount of time required to generate a path is reduced by quite a fair bit. However, if you'd prefer to not use the lightning generator, fear not - you don't have to.

    • usesFast

      private boolean usesFast
      Should the pathfinder use the fast finder, or skip it entirely?

      Generally, using the lighting and fast followers is optimal, as the amount of time required to generate a path is reduced by quite a fair bit. However, if you'd prefer to not use the lightning generator, fear not - you don't have to.

    • usesThetaStar

      private boolean usesThetaStar
      Should the pathfinder use a theta star pathfinding algorithm?

      If lighting and fast followers don't generate a path, this one is the fall-back. This pathfinder is slower, but will actually find a path, rather than just running quick potential collision detection.

    • speed

      private double speed
      The speed that certain types of linear followers should run at.
    • odometrySwapXY

      private boolean odometrySwapXY
      Should the pathfinder swap X and Y pairs?
    • odometryInvertX

      private boolean odometryInvertX
      Should X values be inverted?
    • odometryInvertY

      private boolean odometryInvertY
      Should Y values be inverted?
    • driveSwapXY

      private boolean driveSwapXY
      Should the pathfinder swap X and Y pairs?
    • driveInvertX

      private boolean driveInvertX
      Should the X values be inverted?
    • driveInvertY

      private boolean driveInvertY
      Should the Y values be inverted?
  • Constructor Details

    • PathfinderConfig

      public PathfinderConfig()
      Create a new PathfinderConfig without any configuration elements set.
    • PathfinderConfig

      public PathfinderConfig​(Odometry rawOdometry, int fieldWidth, int fieldHeight, int specificity, double robotX, double robotY, double gapX, double gapY, RobotProfile profile, Drive rawDrive, Map map, Followers follower, double speed, boolean usesLightning, boolean usesFast, boolean usesThetaStar)
      Create a new PathfinderConfig to be fed to a Pathfinder.

      For your own sake - please go read the field descriptions in this Java file if you're confused about what any of these means. I've written out nice and long descriptions for everything, so there shouldn't be all that much confusion about what's going on.

      Parameters:
      rawOdometry - the rawOdometry subsystem that's used by the pathfinder in determining the robot's position. This rawOdometry system should be as accurate as possible and maintain contact with the ground at all times.
      fieldWidth - the fieldWidth of the field, in whatever units you'd like. Although the units don't matter much, you need to be sure to keep the units consistent.
      fieldHeight - the fieldHeight of the field, in whatever units you'd like. Although the units don't matter much, you need to be sure to keep the units consistent.
      specificity - the field's specificity factor. Low specificity means lower precision. High specificity means higher precision. The higher the specificity value is, the longer paths will take to find and the more resources are needed on the host computer.
      robotX - the robot's X dimension. X/Y are the same thing here. That's not to say that you shouldn't measure X and Y values - accuracy is still just as important as ever.
      robotY - the robot's Y dimension. X/Y are the same thing here. That's not to say that you shouldn't measure X and Y values - accuracy is still just as important as ever.
      gapX - the distance (in inches) between the pair of front right and front left wheel centers.
      gapY - the distance (in inches) between the pair of front right and back right wheel centers.
      profile - the robot's motion profiling profile. This profile should provide (at least somewhat accurate) info on the robot's motion in real life.
      rawDrive - the robot's drivetrain. The drivetrain is (rather obviously) used to actually rawDrive the robot.
      map - a virtual map of something. In most cases, this is a game field with all your different obstacles and what not.
      follower - what type of follower the pathfinder uses.
      speed - the speed that linear followers should run at.
      usesLightning - see: usesLightning
      usesFast - see: usesFast
      usesThetaStar - see: usesThetaStar
  • Method Details

    • setFollower

      public PathfinderConfig setFollower​(Followers follower)
    • setUsesLightning

      public PathfinderConfig setUsesLightning​(boolean usesLightning)
    • setUsesFast

      public PathfinderConfig setUsesFast​(boolean usesFast)
    • setUsesThetaStar

      public PathfinderConfig setUsesThetaStar​(boolean usesThetaStar)
    • getFieldHeight

      public int getFieldHeight()
      Get the fieldHeight of the field.
      Returns:
      the field's fieldHeight.
    • setFieldHeight

      public PathfinderConfig setFieldHeight​(int fieldHeight)
    • getFieldWidth

      public int getFieldWidth()
      Get the fieldWidth of the field.
      Returns:
      the field's fieldWidth.
    • setFieldWidth

      public PathfinderConfig setFieldWidth​(int fieldWidth)
    • getSpecificity

      public int getSpecificity()
      Get the field's specificity.
      Returns:
      the field's specificity.
    • setSpecificity

      public PathfinderConfig setSpecificity​(int specificity)
    • getRobotX

      public double getRobotX()
      Get the robot's X value.
      Returns:
      the robot's X value.
    • setRobotX

      public PathfinderConfig setRobotX​(double robotX)
    • getRobotY

      public double getRobotY()
      Get the robot's Y value.
      Returns:
      the robot's Y value.
    • setRobotY

      public PathfinderConfig setRobotY​(double robotY)
    • getGapX

      public double getGapX()
      The robot's X gap.
      Returns:
      the robot's X gap.
    • setGapX

      public PathfinderConfig setGapX​(double gapX)
    • getGapY

      public double getGapY()
      The robot's Y gap.
      Returns:
      the robot's Y gap.
    • setGapY

      public PathfinderConfig setGapY​(double gapY)
    • getRawOdometry

      public Odometry getRawOdometry()
    • getOdometry

      public Odometry getOdometry()
      Get the rawOdometry system.
      Returns:
      the rawOdometry system.
    • setRawOdometry

      public PathfinderConfig setRawOdometry​(Odometry rawOdometry)
    • getProfile

      public RobotProfile getProfile()
      Get the robot's motion profile.
      Returns:
      the robot's motion profile.
    • setProfile

      public PathfinderConfig setProfile​(RobotProfile profile)
    • getRawDrive

      public Drive getRawDrive()
      Get the robot's raw drivetrain.
      Returns:
      the robot's raw drivetrain.
    • getDrive

      public Drive getDrive()
      Get the robot's drivetrain.
      Returns:
      the robot's drivetrain.
    • setDrive

      public void setDrive​(Drive drive)
    • getMap

      public Map getMap()
      Get the field's map.
      Returns:
      the field's map.
    • setMap

      public PathfinderConfig setMap​(Map map)
    • getFollowerType

      public Followers getFollowerType()
      Get what type of follower the pathfinder uses.
      Returns:
      the pathfinder's follower type.
    • setSpeed

      public void setSpeed​(double speed)
      Set the speed that linear followers will be executed at.
      Parameters:
      speed - the speed that linear followers will be executed at.
    • getSpeed

      public double getSpeed()
      Get the speed that linear followers should run at.
      Returns:
      the speed linear followers should run at.
    • doesUseLightning

      public boolean doesUseLightning()
      Does the pathfinder utilize lightning finding?
      Returns:
      whether or not the pathfinder utilizes x type of finding.
    • doesUseFast

      public boolean doesUseFast()
      Does the pathfinder utilize fast finding?
      Returns:
      whether or not the pathfinder utilizes x type of finding.
    • doesUseThetaStar

      public boolean doesUseThetaStar()
      Does the pathfinder utilize ThetaStar finding?
      Returns:
      whether or not the pathfinder utilizes x type of finding.
    • odometrySwapXY

      public void odometrySwapXY​(boolean xy)
      Swap the X and Y coordinate inputs.
    • odometryInvertX

      public void odometryInvertX​(boolean invert)
      Set the X coordinates to be inverted or not. True = inverted, false = normal.
    • odometryInvertY

      public void odometryInvertY​(boolean invert)
      Set the Y coordinates to be inverted or not. True = inverted, false = normal.
    • odometrySwapXY

      public boolean odometrySwapXY()
      Are the X and Y coordinates swapped?
    • odometryInvertX

      public boolean odometryInvertX()
      Is the X coordinate inverted?
    • odometryInvertY

      public boolean odometryInvertY()
      Is the Y coordinate inverted?
    • driveSwapXY

      public void driveSwapXY​(boolean xy)
      Swap the X and Y coordinate inputs.
    • driveInvertX

      public void driveInvertX​(boolean invert)
      Set the X coordinates to be inverted or not. True = inverted, false = normal.
    • driveInvertY

      public void driveInvertY​(boolean invert)
      Set the Y coordinates to be inverted or not. True = inverted, false = normal.
    • driveSwapXY

      public boolean driveSwapXY()
      Are the X and Y coordinates swapped?
    • driveInvertX

      public boolean driveInvertX()
      Is the X coordinate inverted?
    • driveInvertY

      public boolean driveInvertY()
      Is the Y coordinate inverted?