use of me.wobblyyyy.pathfinder2.trajectory.FastTrajectory in project Pathfinder2 by Wobblyyyy.
the class TestTrajectoryCommands method testFastTrajectoryWithAutoInitial.
@Test
public void testFastTrajectoryWithAutoInitial() {
registry.execute("fastTrajectory", "10,10,45deg", "0.5");
registry.execute("tickUntil");
AssertionUtils.assertIsNear(new PointXYZ(10, 10, 0), pathfinder.getPosition(), 2, Angle.fromDeg(360));
}
use of me.wobblyyyy.pathfinder2.trajectory.FastTrajectory in project Pathfinder2 by Wobblyyyy.
the class TrajectoryFactory method getFastTrajectories.
public static List<Trajectory> getFastTrajectories(PointXYZ start, List<PointXYZ> points, double speed) {
List<Trajectory> trajectories = new ArrayList<>(points.size() - 1);
PointXYZ lastPoint = start;
for (PointXYZ point : points) {
FastTrajectory trajectory = new FastTrajectory(lastPoint, point, speed);
trajectories.add(trajectory);
lastPoint = point;
}
return trajectories;
}
use of me.wobblyyyy.pathfinder2.trajectory.FastTrajectory in project Pathfinder2 by Wobblyyyy.
the class TestFastTrajectory method testThrowsExceptions.
@Test
public void testThrowsExceptions() {
Assertions.assertThrows(NullPointException.class, () -> {
new FastTrajectory(null, new PointXYZ(), 0.5);
});
Assertions.assertThrows(NullPointException.class, () -> {
new FastTrajectory(new PointXYZ(), null, 0.5);
});
Assertions.assertThrows(InvalidSpeedException.class, () -> {
new FastTrajectory(new PointXYZ(), new PointXYZ(), -100);
});
Assertions.assertThrows(InvalidSpeedException.class, () -> {
new FastTrajectory(new PointXYZ(), new PointXYZ(), 200);
});
}
use of me.wobblyyyy.pathfinder2.trajectory.FastTrajectory in project Pathfinder2 by Wobblyyyy.
the class TestTrajectoryCommands method testFastTrajectoryWithoutAutoInitial.
@Test
public void testFastTrajectoryWithoutAutoInitial() {
registry.execute("fastTrajectory", "0,0,0", "10,10,45deg", "0.5");
registry.execute("tickUntil");
AssertionUtils.assertIsNear(new PointXYZ(10, 10, 0), pathfinder.getPosition(), 2, Angle.fromDeg(360));
}
use of me.wobblyyyy.pathfinder2.trajectory.FastTrajectory in project Pathfinder2 by Wobblyyyy.
the class TrajectoryBuilder method fastTo.
public TrajectoryBuilder fastTo(PointXYZ target, double speed) {
if (lastPoint == null) {
throw new NullPointException("Must use the setStartPos method before creating a fast " + "trajectory to a target! This position should be " + "the robot's starting position.");
}
trajectories.add(new FastTrajectory(lastPoint, target, speed));
lastPoint = target;
return this;
}
Aggregations