Paths, trajectories, splines, the number 2, and a whole lot of swag.
GPL-3.0 License
This project is no longer actively being developed. If anyone is interested in continuing the development of this project, please let me know!
I'd be happy to help you with using this project. You can reach me through
Discord (wobblyyyy#6733
) or e-mail ([email protected]
).
Pathfinder2 is a continuation of the original Pathfinder library: a streamlined motion planning and control system designed for FIRST events, such as the FIRST Robotics Competition and the FIRST Tech Challenge.
Runnable
s, making it easy to create listeners.NEW DOCUMENTATION:
Pathfinder has improved documentation available in the
docs
directory.
OLD DOCUMENTATION:
Want to get started? Check out the releases guide to get everything installed, and then head over to the documentation portal.
Pathfinder handles everything related to your robot's movement. It abstracts away much of the tedious movement-related code many robot codebases are bogged down with and allows you to focus on what else your robot can do. In addition to providing a robust interface for precisely controlling your robot's movement, Pathfinder provides a wide array of robotics-related utilities and tools.
Want your robot to move to a certain point on the field? Simple:
pathfinder.goTo(new PointXY(10, 15));
PointXY
is a simple Cartesian coordinate with X and Y values. Now let's say
you want to make your robot move to the same point, but turn to 45 degrees.
// method 1
pathfinder.goTo(new PointXYZ(10, 15, Angle.fromDeg(45)));
// method 2
pathfinder.goToZ(Angle.fromDeg(45));
Pathfinder is capable of significantly more than simple movement - splines, motion profiling, recording and playback - the list goes on.
Check out an example FRC project here!
Here's a demonstration of Pathfinder's utilization of lambda expressions to write simple and readable code.
pathfinder
.setSpeed(0.5)
.setTolerance(2)
.setAngleTolerance(Angle.fixedDeg(5))
.splineTo(
new PointXYZ(10, 10, Angle.fixedDeg(90)),
new PointXYZ(20, 30, Angle.fixedDeg(45)),
new PointXYZ(30, 50, Angle.fixedDeg(180))
)
.tickUntil();
pathfinder.getListenerManager()
.bindButton(gampad::a, (isPressed) -> {
// code to be executed whenever the A button is pressed
})
.bindButton(gamepad::b, (isPressed) -> {
// code to be executed whenever the B button is pressed
})
.bind(new ListenerBuilder()
.setMode(ListenerMode.CONDITION_IS_MET)
.addInput(() -> SupplierFilter.anyTrue(
() -> gamepad.rightTrigger() > 0,
() -> gamepad.leftTrigger() > 0
))
.setWhenTriggered(() -> {
// code to be executed whenever either trigger is pressed
})
.setPriority(10)
.setExpiration(Double.MAX_VALUE),
.setMaximumExecutions(Double.MAX_VALUE)
);
// whenever pathfinder is "ticked" (updated, basically), set the robot's
// translation to whatever the driver's controller outputs
pathfinder.onTick(() -> {
pathfinder.setTranslation(new Translation(
gamepad.leftStickX(),
gamepad.leftStickY(),
gamepad.rightStickX()
));
});
while (true) {
// tick pathfinder forever
pathfinder.tick();
}
Installation instructions have been moved here.
Here's all of the sources of documentation I can think of right now.
This project uses the GNU GPL V3. You're allowed to freely distribute and modify the code contained in this project, so long as a copy of the original license is provided, and all of your code is made open-source.