use of me.wobblyyyy.pathfinder2.trajectory.Trajectory in project Pathfinder2 by Wobblyyyy.
the class LinearTrajectoryBuilder method rotateLine.
/**
* Move in a line and rotate to a specified heading.
*
* @param distance the distance from the current point that the new
* point should be drawn at.
* @param targetAngle the angle the trajectory should attempt to turn to.
* @param angle the angle at which the line should be drawn.
*/
public LinearTrajectoryBuilder rotateLine(double distance, Angle targetAngle, Angle angle) {
PointXYZ next = last.inDirection(distance, angle);
trajectories.add(new LinearTrajectory(next.withHeading(targetAngle), speed, tolerance, angleTolerance));
last = next;
return this;
}
use of me.wobblyyyy.pathfinder2.trajectory.Trajectory 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;
}
use of me.wobblyyyy.pathfinder2.trajectory.Trajectory in project Pathfinder2 by Wobblyyyy.
the class CircleSurrounder method surround.
/**
* Surround the circle. This will find the closest point, create a new
* {@link me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory} to that
* point, and then instruct Pathfinder to follow it.
*/
public void surround() {
PointXYZ robotPosition = pathfinder.getPosition();
double speed = pathfinder.getSpeed();
double tolerance = pathfinder.getTolerance();
Angle angleTolerance = pathfinder.getAngleTolerance();
Trajectory trajectory = CircleSurround.trajectoryToClosestPoint(robotPosition, center, radius, speed, tolerance, angleTolerance);
pathfinder.followTrajectory(trajectory);
}
use of me.wobblyyyy.pathfinder2.trajectory.Trajectory in project Pathfinder2 by Wobblyyyy.
the class CircleSurrounder method fastSurround.
/**
* Surround the circle. This will find the closest point, create a new
* {@link me.wobblyyyy.pathfinder2.trajectory.FastTrajectory} to that
* point, and then instruct Pathfinder to follow it.
*/
public void fastSurround() {
PointXYZ robotPosition = pathfinder.getPosition();
double speed = pathfinder.getSpeed();
double tolerance = pathfinder.getTolerance();
Angle angleTolerance = pathfinder.getAngleTolerance();
Trajectory trajectory = CircleSurround.fastTrajectoryToClosestPoint(robotPosition, center, radius, speed);
pathfinder.followTrajectory(trajectory);
}
use of me.wobblyyyy.pathfinder2.trajectory.Trajectory in project Pathfinder2 by Wobblyyyy.
the class PathBuilder method fastPath.
public List<Trajectory> fastPath(PointXYZ start, double speed) {
List<Trajectory> trajectories = new ArrayList<>(targets.size());
PointXYZ previousPoint = start;
for (PointXYZ target : targets) {
trajectories.add(new FastTrajectory(previousPoint, target, speed));
previousPoint = target;
}
return trajectories;
}
Aggregations