use of me.wobblyyyy.pathfinder2.control.ProportionalController in project Pathfinder2 by Wobblyyyy.
the class TestSimulatedChassis method beforeEach.
@BeforeEach
public void beforeEach() {
wrapper = new SimulatedWrapper(new SimulatedDrive(), new SimulatedOdometry());
odometry = wrapper.getOdometry();
robot = wrapper.getRobot();
turnController = new ProportionalController(-0.05);
pathfinder = new Pathfinder(robot, turnController).setSpeed(0.5).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(5));
factory = new SplineBuilderFactory().setSpeed(0.5).setStep(0.1).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(5));
}
use of me.wobblyyyy.pathfinder2.control.ProportionalController in project Pathfinder2 by Wobblyyyy.
the class GenericTrajectoryTester method beforeEach.
@BeforeEach
public void beforeEach() {
wrapper = new SimulatedWrapper(new SimulatedDrive(), new SimulatedOdometry());
odometry = wrapper.getOdometry();
robot = wrapper.getRobot();
turnController = new ProportionalController(turnCoefficient);
pathfinder = new Pathfinder(robot, turnController).setSpeed(speed).setTolerance(tolerance).setAngleTolerance(angleTolerance);
factory = new SplineBuilderFactory().setSpeed(speed).setStep(step).setTolerance(tolerance).setAngleTolerance(angleTolerance);
}
use of me.wobblyyyy.pathfinder2.control.ProportionalController 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);
});
}
Aggregations