import com.acmerobotics.roadrunner.*
import kotlin.math.PI
@JvmOverloads
fun actionBuilder(beginPose: Pose2d) =
TrajectoryActionBuilder(
::TurnAction,
::TrajectoryAction,
beginPose,
eps = 1e-6,
beginEndVel = 0.0,
TurnConstraints(PI / 2, -PI / 2, PI / 2),
MinVelConstraint(
listOf(
TranslationalVelConstraint(40.0),
AngularVelConstraint(PI / 2),
)
),
ProfileAccelConstraint(-30.0, 50.0),
dispResolution = 0.25,
angResolution = 0.1,
)
fun main() {
val a = actionBuilder(Pose2d(0.0, 0.0, 0.0))
.lineToX(-12.0)
.afterDisp(5.0, LabelAction("first"))
.splineTo(Vector2d(-24.0, -12.0), -PI / 2)
.turn(PI / 2)
.afterTime(0.5, LabelAction("second"))
.turn(PI / 2)
.setReversed(true)
.splineTo(Vector2d(-36.0, 0.0), PI)
.build()
showActionVideo(a, fps=30)
}