Pedro Commands
Ivy includes built-in commands for controlling the robot's movement using Pedro Pathing. To use them, add the following static import:
import static com.pedropathing.ivy.pedro.PedroCommands.*;All Pedro commands take a Follower as their first argument. Usually, your Follower
is one created using the create() method in your Constants file.
Pedro commands return regular Ivy Commands, so they work just like any other Ivy command.
Note
This page is compatible with Pedro 3. See the Pedro Pathing docs for more information.
Follow
Makes the robot follow a Path. The command finishes as soon as
the follower stops actively tracking the path (follower.following() becomes false).
Command goToBasket = follow(follower, basketPath);Note on Heading Interpolation
follow() executes the path using the interpolation method that was defined when the Path was created.
Hold
Makes the robot go to a position and then hold it. The robot will hold the position until it is tasked to do something else. If no position is sent the robot will hold its current position.
To hold the current position:
Command holdAtPosition = hold(follower);To hold a specific position:
Command holdAtGoal = hold(follower, p.of(120, 80, 0));Composing Pedro Commands
Since Pedro commands are regular Ivy commands, you can compose them with everything else. For example:
Command auto = sequential(
follow(follower, shootPreloads),
Shooter.shoot(), // Call the shoot Command.
instant(() -> claw.open()),
parallel( // Follow the path while running the intake.
follow(follower, pickupCloseSpikemark),
instant(() -> intake.activate())
)
);Last updated on