use of me.wobblyyyy.pathfinder2.robot.Robot 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.robot.Robot 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.robot.Robot in project Pathfinder2 by Wobblyyyy.
the class ExamplePathfinder method goToSomePoints.
/**
* Go to a series of points. This method is blocking, meaning its execution
* takes a variable amount of time to execute, and, in some cases,
* nearly impossible. A method like this would have good use in the
* Autonomous period of FTC/FRC games, because it's the only thing the robot
* has to do, but wouldn't be so great for the teleop periods.
*/
@SuppressWarnings("DuplicatedCode")
public void goToSomePoints() {
// this is a pretty bad way of going to the points...
List<PointXYZ> points = new ArrayList<PointXYZ>() {
{
add(new PointXYZ(0, 0, 0));
add(new PointXYZ(10, 0, 0));
add(new PointXYZ(10, 10, 0));
add(new PointXYZ(0, 10, 0));
add(new PointXYZ(0, 0, 0));
}
};
for (PointXYZ point : points) {
goToPoint(point);
}
}
use of me.wobblyyyy.pathfinder2.robot.Robot in project Pathfinder2 by Wobblyyyy.
the class ExamplePathfinder method betterGoToSomePoints.
public void betterGoToSomePoints() {
// generate a list of trajectories w/ LinearTrajectoryBuilder
// the setSpeed method is used to dynamically adjust the speed of
// the robot - for example, the speed is halved, then the speed
// is reset, then the speed is doubled
List<Trajectory> trajectories = new LinearTrajectoryBuilder(SPEED, TOLERANCE, ANGLE_TOLERANCE, PointXYZ.ZERO).goTo(new PointXYZ(0, 0, 0)).goTo(new PointXYZ(10, 0, 0)).setSpeed(SPEED / 2).goTo(new PointXYZ(10, 10, 0)).setSpeed(SPEED).goTo(new PointXYZ(0, 10, 0)).setSpeed(SPEED * 2).goTo(new PointXYZ(0, 0, 0)).getTrajectories();
// follow the trajectories with a timeout of 10 seconds. if more than
// 10 seconds pass and the trajectories haven't finished yet, stop
// following the trajectories
pathfinder.followTrajectories(trajectories).tickUntil(10_000);
}
use of me.wobblyyyy.pathfinder2.robot.Robot in project Pathfinder2 by Wobblyyyy.
the class ExampleTimedRobot method autonomousInit.
@Override
public void autonomousInit() {
// clear it, just in case there's already a trajectory
pathfinder.clear();
// make the robot follow a spline: all we have to do now is tick it!
pathfinder.splineTo(new PointXYZ(0, 0, 0), new PointXYZ(10, 0, 0), new PointXYZ(10, 10, 0), new PointXYZ(0, 10, 0), new PointXYZ(0, 0, 0));
}
Aggregations