core / com.acmerobotics.roadrunner.trajectory / SimpleTrajectoryBuilder

SimpleTrajectoryBuilder

class SimpleTrajectoryBuilder : BaseTrajectoryBuilder

Builder for trajectories with static constraints.

Constructors

<init>

SimpleTrajectoryBuilder(startPose: Pose2d, driveConstraints: DriveConstraints, start: MotionState = MotionState(0.0, 0.0, 0.0))

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

SimpleTrajectoryBuilder(trajectory: Trajectory, t: Double, driveConstraints: DriveConstraints)

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

Functions

buildTrajectory

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

Build a trajectory from path.

Inherited Functions

addMarker

fun addMarker(time: Double, callback: () -> Unit): BaseTrajectoryBuilder

Adds a marker to the trajectory at time.

fun addMarker(point: Vector2d, callback: () -> Unit): BaseTrajectoryBuilder

Adds a marker that will be triggered at the closest trajectory point to point.

fun addMarker(callback: () -> Unit): BaseTrajectoryBuilder

Adds a marker at the current position of the trajectory.

back

fun back(distance: Double): BaseTrajectoryBuilder

Adds a line straight backward.

build

fun build(): Trajectory

Constructs the Trajectory instance.

forward

fun forward(distance: Double): BaseTrajectoryBuilder

Adds a line straight forward.

lineTo

fun lineTo(pos: Vector2d, interpolator: HeadingInterpolator = TangentInterpolator()): BaseTrajectoryBuilder

Adds a line path segment.

reverse

fun reverse(): BaseTrajectoryBuilder

Reverse the direction of robot travel.

setReversed

fun setReversed(reversed: Boolean): BaseTrajectoryBuilder

Sets the robot travel direction.

splineTo

fun splineTo(pose: Pose2d, interpolator: HeadingInterpolator = TangentInterpolator()): BaseTrajectoryBuilder

Adds a spline segment.

strafeLeft

fun strafeLeft(distance: Double): BaseTrajectoryBuilder

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

strafeRight

fun strafeRight(distance: Double): BaseTrajectoryBuilder

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

strafeTo

fun strafeTo(pos: Vector2d): BaseTrajectoryBuilder

Adds a strafe path segment.