Skip to main content

Pathing mappings

info

All of these methods autoconvert to inches/radians/seconds behind the scenes, from the units set up in GlobalUnits.

For example, if GlobalUnits is set-up as inches/degrees/milliseconds, you can do something like .turn(90) to turn 90 degrees, and it does Math.toRadians(90) automatically.

These are the mappings from Anvil to the normal TrajectorySequenceBuilder functions that have to do with pathing, such as lines, splines, and raw movements.

All of these functions return the Anvil instance to allow for method chaining (like so)

Anvil.forgeTrajectory(drive, startPose)
.forward(...)
.back(...)
.lineTo(...);

They also all take just numbers, and convert them to the poses/vectors behind the scenes, allowing for a much cleaner API, and thus a much better developer experience.

tip

Click on the 'Roadrunner mapping' link to go to the LearnRoadRunner docs for the method! Heavy credit goes to the Roadrunner/LearnRoadRunner team fo their great library and documentation.

Raw movements

anvil.forward()

Roadrunner mapping (forward)

Params
  • distance: Number - Makes robot go forwards by (distance * unitConversion) inches
  • anvil.back()

    Roadrunner mapping (back)

    Params
  • distance: Number - Makes robot go backwards by (distance * unitConversion) inches
  • anvil.turn()

    Roadrunner mapping (turn)

    Params
  • angle: Number - Makes robot go turn by (angle * unitConversion) radians. Relative to unit circle
  • anvil.strafeLeft()

    Roadrunner mapping (strafeLeft)

    Params
  • distance: Number - Makes robot strafe left by (distance * unitConversion) inches
  • anvil.strafeRight()

    Roadrunner mapping (strafeRight)

    Params
  • distance: Number - Makes robot strafe right by (distance * unitConversion) inches
  • Lines

    anvil.lineTo()

    Roadrunner mapping (lineTo)

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • anvil.strafeTo()

    Roadrunner mapping (strafeTo)

    Functionally equivalent to lineTo

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • anvil.lineToConstantHeading()

    Roadrunner mapping (lineToConstantHeading)

    Functionally equivalent to lineTo

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • anvil.lineToLinearHeading()

    Roadrunner mapping (lineToLinearHeading)

    Params
  • x: Number - x component of the end pose
  • y: Number - y component of the end pose
  • heading: Number - Specified end heading
  • anvil.lineToSplineHeading()

    Roadrunner mapping (lineToSplineHeading)

    Params
  • x: Number - x component of the end pose
  • y: Number - y component of the end pose
  • heading: Number - Specified end heading
  • Splines

    anvil.splineTo()

    Roadrunner mapping (splineTo)

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • endTangent: Number - End tangent of the spline
  • anvil.splineToConstantHeading()

    Roadrunner mapping (splineToConstantHeading)

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • endTangent: Number - End tangent of the spline
  • anvil.splineToLinearHeading()

    Roadrunner mapping (splineToLinearHeading)

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • heading: Number - Specified end heading
  • endTangent: Number - End tangent of the spline
  • anvil.splineToSplineHeading()

    Roadrunner mapping (splineToSplineHeading)

    Params
  • x: Number - x component of the end vector
  • y: Number - y component of the end vector
  • heading: Number - Specified end heading
  • endTangent: Number - End tangent of the spline