public class BaseTrajectoryBuilder
Easy-to-use builder for creating class Trajectory
instances.
class Trajectory
Modifier | Constructor and Description |
---|---|
protected |
BaseTrajectoryBuilder(Pose2d startPose,
Trajectory trajectory,
java.lang.Double t)
Easy-to-use builder for creating
class Trajectory instances. |
Modifier and Type | Method and Description |
---|---|
BaseTrajectoryBuilder |
addMarker(double time,
kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker to the trajectory at
time . |
BaseTrajectoryBuilder |
addMarker(Vector2d point,
kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker that will be triggered at the closest trajectory point to
point . |
BaseTrajectoryBuilder |
addMarker(kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker at the current position of the trajectory.
|
BaseTrajectoryBuilder |
back(double distance)
Adds a line straight backward.
|
Trajectory |
build()
Constructs the
class Trajectory instance. |
protected Trajectory |
buildTrajectory(Path path,
java.util.List<com.acmerobotics.roadrunner.trajectory.TemporalMarker> temporalMarkers,
java.util.List<com.acmerobotics.roadrunner.trajectory.SpatialMarker> spatialMarkers)
Build a trajectory from
path . |
BaseTrajectoryBuilder |
forward(double distance)
Adds a line straight forward.
|
BaseTrajectoryBuilder |
lineTo(Vector2d pos,
HeadingInterpolator interpolator)
Adds a line path segment.
|
BaseTrajectoryBuilder |
lineTo(Vector2d pos)
Adds a line path segment.
|
BaseTrajectoryBuilder |
reverse()
Reverse the direction of robot travel.
|
BaseTrajectoryBuilder |
setReversed(boolean reversed)
Sets the robot travel direction.
|
BaseTrajectoryBuilder |
splineTo(Pose2d pose,
HeadingInterpolator interpolator)
Adds a spline segment.
|
BaseTrajectoryBuilder |
splineTo(Pose2d pose)
Adds a spline segment.
|
BaseTrajectoryBuilder |
strafeLeft(double distance)
Adds a segment that strafes left in the robot reference frame.
|
BaseTrajectoryBuilder |
strafeRight(double distance)
Adds a segment that strafes right in the robot reference frame.
|
BaseTrajectoryBuilder |
strafeTo(Vector2d pos)
Adds a strafe path segment.
|
protected BaseTrajectoryBuilder(@Nullable Pose2d startPose, @Nullable Trajectory trajectory, @Nullable java.lang.Double t)
Easy-to-use builder for creating class Trajectory
instances.
startPose
- start posetrajectory
- initial trajectory (for splicing)t
- time index in previous trajectory to begin new trajectoryclass Trajectory
@NotNull public BaseTrajectoryBuilder reverse()
Reverse the direction of robot travel.
@NotNull public BaseTrajectoryBuilder setReversed(boolean reversed)
Sets the robot travel direction.
@JvmOverloads @NotNull public BaseTrajectoryBuilder lineTo(@NotNull Vector2d pos, @NotNull HeadingInterpolator interpolator)
Adds a line path segment.
pos
- end positioninterpolator
- heading interpolator@JvmOverloads @NotNull public BaseTrajectoryBuilder lineTo(@NotNull Vector2d pos)
Adds a line path segment.
pos
- end position@NotNull public BaseTrajectoryBuilder strafeTo(@NotNull Vector2d pos)
Adds a strafe path segment.
pos
- end position@NotNull public BaseTrajectoryBuilder forward(double distance)
Adds a line straight forward.
distance
- distance to travel forward@NotNull public BaseTrajectoryBuilder back(double distance)
Adds a line straight backward.
distance
- distance to travel backward@NotNull public BaseTrajectoryBuilder strafeLeft(double distance)
Adds a segment that strafes left in the robot reference frame.
distance
- distance to strafe left@NotNull public BaseTrajectoryBuilder strafeRight(double distance)
Adds a segment that strafes right in the robot reference frame.
distance
- distance to strafe right@JvmOverloads @NotNull public BaseTrajectoryBuilder splineTo(@NotNull Pose2d pose, @NotNull HeadingInterpolator interpolator)
Adds a spline segment.
pose
- end poseinterpolator
- heading interpolator@JvmOverloads @NotNull public BaseTrajectoryBuilder splineTo(@NotNull Pose2d pose)
Adds a spline segment.
pose
- end pose@NotNull public BaseTrajectoryBuilder addMarker(double time, @NotNull kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker to the trajectory at time
.
time
@NotNull public BaseTrajectoryBuilder addMarker(@NotNull Vector2d point, @NotNull kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker that will be triggered at the closest trajectory point to point
.
point
@NotNull public BaseTrajectoryBuilder addMarker(@NotNull kotlin.jvm.functions.Function0<kotlin.Unit> callback)
Adds a marker at the current position of the trajectory.
@NotNull public Trajectory build()
Constructs the class Trajectory
instance.
class Trajectory
@NotNull protected Trajectory buildTrajectory(@NotNull Path path, @NotNull java.util.List<com.acmerobotics.roadrunner.trajectory.TemporalMarker> temporalMarkers, @NotNull java.util.List<com.acmerobotics.roadrunner.trajectory.SpatialMarker> spatialMarkers)
Build a trajectory from path
.
path