use of me.wobblyyyy.pathfinder2.control.Controller in project Grupo5Cine by Diroro14.
the class Main method cargar.
private static void cargar() throws IOException {
InputStream is = new FileInputStream(new File(_inFile));
Controller controller = new Controller();
controller.load(is);
}
use of me.wobblyyyy.pathfinder2.control.Controller in project Pathfinder2 by Wobblyyyy.
the class TestControlledTrajectory method testSingleController.
private void testSingleController(Controller controller, PointXYZ target, double tolerance, Angle angleTolerance) {
PointXYZ origin = pathfinder.getPosition();
Trajectory toTarget = new ControlledTrajectory(target, controller, tolerance, angleTolerance);
Trajectory toOrigin = new ControlledTrajectory(origin, controller, tolerance, angleTolerance);
follow(toTarget, target);
follow(toOrigin, origin);
}
use of me.wobblyyyy.pathfinder2.control.Controller in project Pathfinder2 by Wobblyyyy.
the class ExampleTimedRobot method robotInit.
@Override
public void robotInit() {
// initialize everything. if this was a real implementation, you would
// not want to use SimulatedDrive or SimulatedOdometry
drive = new SimulatedDrive();
odometry = new SimulatedOdometry();
robot = new Robot(drive, odometry);
pathfinder = new Pathfinder(robot, controller).setSpeed(0.5).setTolerance(2).setAngleTolerance(Angle.fromDeg(5));
}
use of me.wobblyyyy.pathfinder2.control.Controller in project Pathfinder2 by Wobblyyyy.
the class ExampleElevator method exampleShifterElevator.
public void exampleShifterElevator() {
Pathfinder pathfinder = Pathfinder.newSimulatedPathfinder(0.01);
Map<Integer, Integer> levels = new HashMap<Integer, Integer>() {
{
put(1, 100);
put(2, 200);
put(3, 300);
put(4, 400);
put(5, 500);
}
};
Controller controller = new ProportionalController(0.001);
Shifter shifter = new Shifter(1, 1, 5, false, gear -> {
int target = levels.get(gear);
controller.setTarget(target);
});
pathfinder.getListenerManager().bind(ListenerMode.CONDITION_NEWLY_MET, this::aButton, b -> b, b -> shifter.shift(ShifterDirection.UP));
pathfinder.getListenerManager().bind(ListenerMode.CONDITION_NEWLY_MET, this::bButton, b -> b, b -> shifter.shift(ShifterDirection.DOWN));
pathfinder.onTick(pf -> {
int elevatorPosition = getPosition();
double elevatorPower = controller.calculate(elevatorPosition);
setElevatorPower(elevatorPower);
});
}
use of me.wobblyyyy.pathfinder2.control.Controller in project Pathfinder2 by Wobblyyyy.
the class Pathfinder method newEmptyPathfinder.
/**
* Create a new, "empty" instance of Pathfinder.
*
* <p>
* This is pretty much only useful for debugging or testing purposes.
* </p>
*
* @param coefficient the coefficient to use for the turn controller.
* @return a new instance of Pathfinder that makes use of both the
* {@link EmptyDrive} and {@link EmptyOdometry} classes.
*/
public static Pathfinder newEmptyPathfinder(double coefficient) {
Drive drive = new EmptyDrive();
Odometry odometry = new EmptyOdometry();
Robot robot = new Robot(drive, odometry);
return new Pathfinder(robot, coefficient);
}
Aggregations