Package frclib.archive
Class FrcPath
java.lang.Object
trclib.pathdrive.TrcPath
frclib.archive.FrcPath
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionFrcPath(boolean inDegrees, TrcWaypoint... waypoints) FrcPath(TrcWaypoint... waypoints) -
Method Summary
Modifier and TypeMethodDescriptionstatic edu.wpi.first.math.trajectory.TrajectorycreateHolonomicTrajectory(TrcPath path, edu.wpi.first.math.trajectory.TrajectoryConfig config) Create aTrajectoryfrom aTrcPathobject.static edu.wpi.first.math.trajectory.TrajectoryConfigcreateSwerveConfig(TrcSwerveDriveBase driveBase, double maxVel, double maxAccel, double maxSteerVel) Create aTrajectoryConfigobject to use for path creation.edu.wpi.first.math.trajectory.TrajectorycreateTrajectory(edu.wpi.first.math.trajectory.TrajectoryConfig config, FrcPath.SplineType type) Create aTrajectoryfrom aTrcPathobject.static edu.wpi.first.math.trajectory.TrajectorycreateTrajectory(TrcPath path, edu.wpi.first.math.trajectory.TrajectoryConfig config, FrcPath.SplineType type) Create aTrajectoryfrom aTrcPathobject.static edu.wpi.first.math.geometry.Pose2dMethods inherited from class trclib.pathdrive.TrcPath
clone, getAllWaypoints, getArcLength, getLastWaypoint, getPathDuration, getSize, getWaypoint, inferAccelerations, inferTimeSteps, insertWaypoint, isInDegrees, loadPathFromCsv, mapSelfToDegrees, mapSelfToRadians, relativeTo, relativeToStart, toAbsolute, toDegrees, toRadians, toString, translate, trapezoidVelocity
-
Constructor Details
-
FrcPath
-
FrcPath
-
-
Method Details
-
toWpiPose
-
createSwerveConfig
public static edu.wpi.first.math.trajectory.TrajectoryConfig createSwerveConfig(TrcSwerveDriveBase driveBase, double maxVel, double maxAccel, double maxSteerVel) Create aTrajectoryConfigobject 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 aTrajectoryfrom aTrcPathobject. Only the positions are preserved. The velocities and accelerations will be defined by theTrajectoryConfig. The trajectory headings will be modified, since heading refers to the velocity vector direction. The returned Trajectory will be aFrcHolonomicTrajectoryobject, 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 aTrajectoryfrom aTrcPathobject. Only the positions are preserved. The velocities and accelerations will be defined by theTrajectoryConfig. 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 aTrajectoryfrom aTrcPathobject. Only the positions are preserved. The velocities and accelerations will be defined by theTrajectoryConfig. 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.
-