Skip to main content

Constraints

danger

None of the methods in this page auto-convert units. They're all whatever units Roadrunner uses (iirc, inches, rads, in/sec, rad/sec, etc.)

These are all mappings to the constraint functions. All of these functions return the Anvil instance to allow for method chaining (like so)

Anvil.forgeTrajectory(drive, startPose)
.forward(...)
.back(...)
.lineTo(...);
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.

anvil.resetConstraints()

Roadrunner mapping (resetConstraints)

Clears any temporary constraints set by setConstraints(). Defaults to the ones in DRIVE_CONSTANTS, unless you did something weird.

Velocity constraints

anvil.setVelConstraint() (#1)

Roadrunner mapping (setVelConstraint)

Allows you to set a custom, temporary, TrajectoryVelocityConstraint for the rest of the trajectory, or at least until it is reset/overridden.

Params
  • velConstraint: TrajectoryVelocityConstraint - The TrajectoryVelocityConstraint to use
  • anvil.setVelConstraint() (#2)

    Roadrunner mapping (setVelConstraint)

    Allows you to set a custom, temporary, TrajectoryVelocityConstraint for the rest of the trajectory, or at least until it is reset/overridden.

    This one creates the TrajectoryVelocityConstraint for you, using SampleMecanumDrive.getVelocityConstraint(). Keep in mind this does not auto-convert units.

    Params
  • maxVel: Number - The max velocity in inches/second
  • maxAngularVel: Number - The max angular velocity in radians/second
  • trackWidth: Number - The bots track width in inches (should prob leave this the same as the one in DRIVE_CONSTANTS)
  • anvil.resetVelConstraint()

    Roadrunner mapping (resetVelConstraint)

    Clears any temporary constraints set by setVelConstraint(). Defaults to the ones in DRIVE_CONSTANTS, unless you did something weird.

    Acceleration constraints

    anvil.setAccelConstraint() (#1)

    Roadrunner mapping (setAccelConstraint)

    Allows you to set a custom, temporary, TrajectoryAccelerationConstraint for the rest of the trajectory, or at least until it is reset/overridden.

    Params
  • velConstraint: TrajectoryAccelerationConstraint - The TrajectoryAccelerationConstraint to use
  • anvil.setAccelConstraint() (#2)

    Roadrunner mapping (setAccelConstraint)

    Allows you to set a custom, temporary, TrajectoryAccelerationConstraint for the rest of the trajectory, or at least until it is reset/overridden.

    This one creates the TrajectoryAccelerationConstraint for you, using SampleMecanumDrive.getAccelerationConstraint(). Keep in mind this does not auto-convert units.

    Params
  • maxAccel: Number - The max acceleration in (I think) inches/second^2
  • anvil.resetAccelConstraint()

    Roadrunner mapping (resetVelConstraint)

    Clears any temporary constraints set by setAccelConstraint(). Defaults to the ones in DRIVE_CONSTANTS, unless you did something weird.

    Turn constraints

    anvil.setTurnConstraint()

    Roadrunner mapping (setTurnConstraint)

    Allows you to set a custom, temporary, turn constraint for the rest of the trajectory, or at least until it is reset/overridden.

    Params
  • maxAngVel: Number - The max angular velocity in (I think) radians/second
  • maxAngAccel: Number - The max angular acceleration in (I think) radians/second^2
  • anvil.resetTurnConstraint()

    Roadrunner mapping (resetTurnConstraint)

    Clears any temporary constraints set by setTurnConstraint(). Defaults to the ones in DRIVE_CONSTANTS, unless you did something weird.