Class FrcPath


public class FrcPath extends TrcPath
  • Constructor Details

    • FrcPath

      public FrcPath(boolean inDegrees, TrcWaypoint... waypoints)
    • FrcPath

      public FrcPath(TrcWaypoint... waypoints)
  • Method Details

    • toWpiPose

      public static edu.wpi.first.math.geometry.Pose2d toWpiPose(TrcPose2D pose)
    • createSwerveConfig

      public static edu.wpi.first.math.trajectory.TrajectoryConfig createSwerveConfig(TrcSwerveDriveBase driveBase, double maxVel, double maxAccel, double maxSteerVel)
      Create a TrajectoryConfig object to use for path creation. This config is specific to swerve drives. It applies a max velocity and acceleration to the path to create a trapezoidal velocity profile. It also uses the maximum steer velocity (rotation rate) of the swerve modules to limit the centripetal acceleration of the path. This protects against the robot's velocity vector changing direction too fast for the modules to follow. It also constrains the path such that none of the wheels will exceed the maximum wheel velocity.
      Parameters:
      driveBase - The drivebase used for the path creation.
      maxVel - The maximum velocity of the robot, in inches per second.
      maxAccel - The maximum acceleration of the robot, in inches per second per second.
      maxSteerVel - The maximum steer velocity of the robot, in degrees per second.
      Returns:
      A TrajectoryConfig to be used for trajectory configuration.
    • createHolonomicTrajectory

      public static edu.wpi.first.math.trajectory.Trajectory createHolonomicTrajectory(TrcPath path, edu.wpi.first.math.trajectory.TrajectoryConfig config)
      Create a Trajectory from a TrcPath object. Only the positions are preserved. The velocities and accelerations will be defined by the TrajectoryConfig. The trajectory headings will be modified, since heading refers to the velocity vector direction. The returned Trajectory will be a FrcHolonomicTrajectory object, so the last sample will have the target heading as the heading value. All other heading values refer to velocity direction.

      This is meant for holonomic drivebases, where heading is decoupled from the velocity vector.

      Parameters:
      path - The TrcPath object to use to create the Trajectory.
      config - This specifies the constraints and configurations to use when making the Trajectory.
      Returns:
      A Trajectory object with the appropriate constraints.
    • createTrajectory

      public static edu.wpi.first.math.trajectory.Trajectory createTrajectory(TrcPath path, edu.wpi.first.math.trajectory.TrajectoryConfig config, FrcPath.SplineType type)
      Create a Trajectory from a TrcPath object. Only the positions are preserved. The velocities and accelerations will be defined by the TrajectoryConfig. If the spline type is hermite quintic, then the intermediate headings will also be preserved.
      Parameters:
      path - The TrcPath object to use to create the Trajectory.
      config - This specifies the constraints and configurations to use when making the Trajectory.
      type - The type of spline to use. If cubic, the intermediate poses become "knot points", and only their positions will be preserved. If quintic, the intermediate poses' headings are preserved. More or less a moot point for holonomic drivebases. Keep in mind that some path followers won't honor intermediate headings.
      Returns:
      A Trajectory object with the appropriate constraints. The trajectory should pass through every point, and start and end at the correct headings.
    • createTrajectory

      public edu.wpi.first.math.trajectory.Trajectory createTrajectory(edu.wpi.first.math.trajectory.TrajectoryConfig config, FrcPath.SplineType type)
      Create a Trajectory from a TrcPath object. Only the positions are preserved. The velocities and accelerations will be defined by the TrajectoryConfig. If the spline type is hermite quintic, then the intermediate headings will also be preserved.
      Parameters:
      config - This specifies the constraints and configurations to use when making the Trajectory.
      type - The type of spline to use. If cubic, the intermediate poses become "knot points", and only their positions will be preserved. If quintic, the intermediate poses' headings are preserved. More or less a moot point for holonomic drivebases. Keep in mind that some path followers won't honor intermediate headings.
      Returns:
      A Trajectory object with the appropriate constraints. The trajectory should pass through every point, and start and end at the correct headings.