TrajectoryBuilder

Builder for trajectories with dynamic constraints.

Constructors

Link copied to clipboard
public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Angle startTangent, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk, Double resolution)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Angle startTangent, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Angle startTangent, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Angle startTangent, TrajectoryConstraints constraints, Double resolution)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Angle startTangent, TrajectoryConstraints constraints)

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

Creates a builder from a start pose and tangent. This is the recommended constructor for creating trajectories from rest.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Boolean reversed, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk, Double resolution)

Create a builder from a start pose with a reversed tangent. This constructor is used to execute trajectories backwards.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Boolean reversed, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk)

Create a builder from a start pose with a reversed tangent. This constructor is used to execute trajectories backwards.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Boolean reversed, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel)

Create a builder from a start pose with a reversed tangent. This constructor is used to execute trajectories backwards.

public TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Boolean reversed, TrajectoryConstraints constraints, Double resolution)

Create a builder from a start pose with a reversed tangent. This constructor is used to execute trajectories backwards.

Create a builder from a start pose with a reversed tangent. This constructor is used to execute trajectories backwards.

public TrajectoryBuilder TrajectoryBuilder(Trajectory trajectory, Double t, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk, Double resolution)

Create a builder from an active trajectory. This is useful for interrupting a live trajectory and smoothly transitioning to a new one.

public TrajectoryBuilder TrajectoryBuilder(Trajectory trajectory, Double t, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk)

Create a builder from an active trajectory. This is useful for interrupting a live trajectory and smoothly transitioning to a new one.

public TrajectoryBuilder TrajectoryBuilder(Trajectory trajectory, Double t, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel)

Create a builder from an active trajectory. This is useful for interrupting a live trajectory and smoothly transitioning to a new one.

public TrajectoryBuilder TrajectoryBuilder(Trajectory trajectory, Double t, TrajectoryConstraints constraints, Double resolution)

Create a builder from an active trajectory. This is useful for interrupting a live trajectory and smoothly transitioning to a new one.

Create a builder from an active trajectory. This is useful for interrupting a live trajectory and smoothly transitioning to a new one.

protected TrajectoryBuilder TrajectoryBuilder(Pose2d startPose, Pose2d startDeriv, Pose2d startSecondDeriv, TrajectoryVelocityConstraint baseVelConstraint, TrajectoryAccelerationConstraint baseAccelConstraint, Angle baseAngVel, Angle baseAngAccel, Angle baseAngJerk, MotionState start, Double resolution)

Properties

Link copied to clipboard
public final Angle baseAngAccel
Link copied to clipboard
public final Angle baseAngJerk
Link copied to clipboard
public final Angle baseAngVel

Functions

Link copied to clipboard

Adds the provided acceleration constraints for the following path segments.

Link copied to clipboard
public final TrajectoryBuilder addAngularConstraints(Angle angVel, Angle angAccel)
public final TrajectoryBuilder addAngularConstraints(Angle angVel, Angle angAccel, Angle angJerk)

Adds the provided angular constraints for the following turn segments.

Link copied to clipboard

Adds the provided constraints to the following path and turn segments.

Adds the provided constraints for the following path segments.

Link copied to clipboard
public final TrajectoryBuilder addLine(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addLine(Vector2d endPosition, HeadingInterpolation headingInterpolation, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addLine(Vector2d endPosition, HeadingInterpolation headingInterpolation, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line segment with the specified heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder addSpline(Vector2d endPosition, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addSpline(Vector2d endPosition, Angle endTangent, Double startTangentMag, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addSpline(Vector2d endPosition, Angle endTangent, Double startTangentMag, Double endTangentMag, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addSpline(Vector2d endPosition, Angle endTangent, Double startTangentMag, Double endTangentMag, HeadingInterpolation headingInterpolation, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder addSpline(Vector2d endPosition, Angle endTangent, Double startTangentMag, Double endTangentMag, HeadingInterpolation headingInterpolation, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a spline segment with the specified heading interpolation.

Link copied to clipboard

Adds the provided velocity constraints for the following path segments.

Link copied to clipboard
public final TrajectoryBuilder back(Double distance, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder back(Double distance, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line straight backward.

Link copied to clipboard
public final TrajectoryBuilder forward(Double distance, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder forward(Double distance, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line straight forward.

Link copied to clipboard
public final TrajectoryBuilder lineTo(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder lineTo(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line segment with tangent heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder lineToConstantHeading(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder lineToConstantHeading(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line segment with constant heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder lineToLinearHeading(Pose2d endPose, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line segment with linear heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder lineToSplineHeading(Pose2d endPose, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a line segment with spline heading interpolation.

Link copied to clipboard
Link copied to clipboard
protected TurnSegment makeTurnSegment(Pose2d pose, Angle angle)
Link copied to clipboard

Resets all constraints to the default constructor-provided values.

Link copied to clipboard

Resets the angular constraints to the default constructor-provided values.

Link copied to clipboard

Resets the path constraints to the default constructor-provided values.

Link copied to clipboard

Sets the acceleration constraints for the following path segments.

Link copied to clipboard
public final TrajectoryBuilder setAngularConstraints(Angle angVelOverride, Angle angAccelOverride)
public final TrajectoryBuilder setAngularConstraints(Angle angVelOverride, Angle angAccelOverride, Angle angJerkOverride)

Sets the angular constraints for the following turn segments.

Link copied to clipboard

Sets the constraints for the following segments using the provided constraints. Sets both the path and angular constraints.

public final TrajectoryBuilder setConstraints(TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Sets the constraints for the following path segments.

Link copied to clipboard

Sets the velocity constraints for the following path segments.

Link copied to clipboard
public final TrajectoryBuilder splineTo(Vector2d endPosition, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder splineTo(Vector2d endPosition, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a spline segment with tangent heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder splineToConstantHeading(Vector2d endPosition, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder splineToConstantHeading(Vector2d endPosition, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a spline segment with constant heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder splineToLinearHeading(Pose2d endPose, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder splineToLinearHeading(Pose2d endPose, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a spline segment with linear heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder splineToSplineHeading(Pose2d endPose, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder splineToSplineHeading(Pose2d endPose, Angle endTangent, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a spline segment with spline heading interpolation.

Link copied to clipboard
public final TrajectoryBuilder strafeLeft(Double distance, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder strafeLeft(Double distance, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a segment that strafes left in the robot reference frame.

Link copied to clipboard
public final TrajectoryBuilder strafeRight(Double distance, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder strafeRight(Double distance, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a segment that strafes right in the robot reference frame.

Link copied to clipboard
public final TrajectoryBuilder strafeTo(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride)
public final TrajectoryBuilder strafeTo(Vector2d endPosition, TrajectoryVelocityConstraint velConstraintOverride, TrajectoryAccelerationConstraint accelConstraintOverride)

Adds a strafe path segment.

Link copied to clipboard
public final TrajectoryBuilder turn(Angle angle, Angle angVelOverride)
public final TrajectoryBuilder turn(Angle angle, Angle angVelOverride, Angle angAccelOverride)
public final TrajectoryBuilder turn(Angle angle, Angle angVelOverride, Angle angAccelOverride, Angle angJerkOverride)

Adds a turn segment that turns angle degrees.