Package frc.robot

Class SwervePIDController

java.lang.Object
frc.robot.SwervePIDController

public class SwervePIDController extends Object
Controls automatic alignment for driver assistance.
  • Field Details

    • instance

      public static SwervePIDController instance
    • target_pose

      public edu.wpi.first.math.geometry.Pose2d target_pose
    • target_distance

      public double target_distance
    • rotation_offset

      public edu.wpi.first.math.geometry.Rotation2d rotation_offset
    • reset_speeds

      public boolean reset_speeds
    • done

      public boolean done
    • align_right

      public boolean align_right
  • Method Details

    • getNearestReefFace

      public int getNearestReefFace()
      Returns the closest reef face to the robot. The driverstation-oriented face is 0, and the rest are numbered CCW increasing.
      Returns:
      The number corresponding the closest reef face.
    • getReefPose

      public edu.wpi.first.math.geometry.Pose2d getReefPose(int index)
    • getNearestReefPose

      public edu.wpi.first.math.geometry.Pose2d getNearestReefPose(int offset)
    • getNearestReefPose

      public edu.wpi.first.math.geometry.Pose2d getNearestReefPose()
    • getProcessorPose

      public edu.wpi.first.math.geometry.Pose2d getProcessorPose()
    • getNearestSourcePose

      public edu.wpi.first.math.geometry.Pose2d getNearestSourcePose()
    • configure

      public void configure(edu.wpi.first.math.geometry.Pose2d target_pose, Double target_distance, edu.wpi.first.math.geometry.Rotation2d rotation_offset)
    • applyMovementConstraints

      public edu.wpi.first.math.kinematics.ChassisSpeeds applyMovementConstraints(edu.wpi.first.math.kinematics.ChassisSpeeds target_speeds)
      Applies velocity and acceleration constraints to desired speeds.
      Parameters:
      target_speeds - The desired robot-relative chassis speeds.
      Returns:
      The constrained robot-relative chassis speeds.
    • calculate

      public edu.wpi.first.math.kinematics.ChassisSpeeds calculate()
      Calculate the chassis speeds to position PID to the target pose. Points towards the target.
      Returns:
      The calculated chassis speeds.
    • calculate

      public edu.wpi.first.math.kinematics.ChassisSpeeds calculate(boolean useTargetAngle)
      Calculate the chassis speeds to position PID to the target pose.
      Parameters:
      useTargetAngle - Whether or not to use the rotation value from the stored target pose.
      Returns:
      The calculated chassis speeds.