Movement
NextFTC has commands to help you move your robot in autonomous with PedroPathing.
FollowPath
FollowPath
follows a PedroPathing Path
or PathChain
. If you pass a Path
it will automatically convert it to a PathChain
. PathChains
have the added benefit of (optional) holdEnd
.
kotlin
FollowPath(path)
FollowPath(pathChain)
// or with holdEnd:
FollowPath(path, true)
FollowPath(pathChain, true)
You can also pass a max power that will be used only for that path.
kotlin
new FollowPath(path, maxPower = 0.75)
Turn
Turn
turns the robot by an angle. It takes an Angle
to turn by.
kotlin
Turn(180.deg)
Optionally, you can pass a tolerance as well, which is how far from the target heading the robot needs to be to finish.
kotlin
Turn(180.deg, 10.deg) // the default tolerance is 5 degrees.
TurnTo
Unlike Turn
, which turns by an angle, TurnTo
turns to an angle.
kotlin
TurnTo(45.deg)
// we can also specify a tolerance:
TurnTo(45.deg, 10.deg)
NOTE
See the PedroPathing reference for more information.