core / com.acmerobotics.roadrunner.trajectory / TrajectoryBuilder

TrajectoryBuilder

class TrajectoryBuilder : BaseTrajectoryBuilder<TrajectoryBuilder> (source)

Builder for trajectories with dynamic constraints.

Constructors

<init>

Create a builder from a start pose and motion state. This is the recommended constructor for creating trajectories from rest.

TrajectoryBuilder(startPose: Pose2d, startTangent: Double = startPose.heading, baseVelConstraint: TrajectoryVelocityConstraint, baseAccelConstraint: TrajectoryAccelerationConstraint, resolution: Double = 0.25)TrajectoryBuilder(startPose: Pose2d, reversed: Boolean, baseVelConstraint: TrajectoryVelocityConstraint, baseAccelConstraint: TrajectoryAccelerationConstraint, resolution: Double = 0.25)

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

TrajectoryBuilder(trajectory: Trajectory, t: Double, baseVelConstraint: TrajectoryVelocityConstraint, baseAccelConstraint: TrajectoryAccelerationConstraint, resolution: Double = 0.25)

Functions

back

Adds a line straight backward.

fun back(distance: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

buildTrajectory

Build a trajectory from path.

fun buildTrajectory(path: Path, temporalMarkers: List<TemporalMarker>, displacementMarkers: List<DisplacementMarker>, spatialMarkers: List<SpatialMarker>): Trajectory

forward

Adds a line straight forward.

fun forward(distance: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

lineTo

Adds a line segment with tangent heading interpolation.

fun lineTo(endPosition: Vector2d, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

lineToConstantHeading

Adds a line segment with constant heading interpolation.

fun lineToConstantHeading(endPosition: Vector2d, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

lineToLinearHeading

Adds a line segment with linear heading interpolation.

fun lineToLinearHeading(endPose: Pose2d, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

lineToSplineHeading

Adds a line segment with spline heading interpolation.

fun lineToSplineHeading(endPose: Pose2d, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

splineTo

Adds a spline segment with tangent heading interpolation.

fun splineTo(endPosition: Vector2d, endTangent: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

splineToConstantHeading

Adds a spline segment with constant heading interpolation.

fun splineToConstantHeading(endPosition: Vector2d, endTangent: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

splineToLinearHeading

Adds a spline segment with linear heading interpolation.

fun splineToLinearHeading(endPose: Pose2d, endTangent: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

splineToSplineHeading

Adds a spline segment with spline heading interpolation.

fun splineToSplineHeading(endPose: Pose2d, endTangent: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

strafeLeft

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

fun strafeLeft(distance: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

strafeRight

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

fun strafeRight(distance: Double, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder

strafeTo

Adds a strafe path segment.

fun strafeTo(endPosition: Vector2d, velConstraintOverride: TrajectoryVelocityConstraint?, accelConstraintOverride: TrajectoryAccelerationConstraint?): TrajectoryBuilder