Search in sources :

Example 21 with PointXYZ

use of me.wobblyyyy.pathfinder2.geometry.PointXYZ in project Pathfinder2 by Wobblyyyy.

the class Trajectory method multiply.

@SuppressWarnings("DuplicatedCode")
default Trajectory multiply(double xMultiplier, double yMultiplier, double zMultiplier) {
    Function<PointXYZ, PointXYZ> nextMarkerFunction = InternalTrajectoryUtils.nextMarkerFunction(this);
    Function<PointXYZ, Boolean> isDoneFunction = InternalTrajectoryUtils.isDoneFunction(this);
    Function<PointXYZ, Double> speedFunction = InternalTrajectoryUtils.speedFunction(this);
    Supplier<String> _toString = this::toString;
    PointXYZ mult = new PointXYZ(xMultiplier, yMultiplier, Angle.fromDeg(zMultiplier));
    return new Trajectory() {

        @Override
        public PointXYZ nextMarker(PointXYZ current) {
            return nextMarkerFunction.apply(current.multiply(mult)).multiply(mult);
        }

        @Override
        public boolean isDone(PointXYZ current) {
            return isDoneFunction.apply(current.multiply(mult));
        }

        @Override
        public double speed(PointXYZ current) {
            return speedFunction.apply(current.multiply(mult));
        }

        @Override
        public String toString() {
            return _toString.get();
        }
    };
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) MultiSegmentTrajectory(me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory)

Example 22 with PointXYZ

use of me.wobblyyyy.pathfinder2.geometry.PointXYZ in project Pathfinder2 by Wobblyyyy.

the class LinearTrajectoryBuilder method goTo.

/**
 * Go to a specific point.
 *
 * @param target the target point.
 */
public LinearTrajectoryBuilder goTo(PointXYZ target) {
    trajectories.add(new LinearTrajectory(target, speed, tolerance, angleTolerance));
    last = target;
    return this;
}
Also used : LinearTrajectory(me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory)

Example 23 with PointXYZ

use of me.wobblyyyy.pathfinder2.geometry.PointXYZ in project Pathfinder2 by Wobblyyyy.

the class TrajectoryBuilder method linearTo.

public TrajectoryBuilder linearTo(PointXYZ target, double speed) {
    trajectories.add(new LinearTrajectory(target, speed, tolerance, angleTolerance));
    lastPoint = target;
    return this;
}
Also used : LinearTrajectory(me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory)

Example 24 with PointXYZ

use of me.wobblyyyy.pathfinder2.geometry.PointXYZ in project Pathfinder2 by Wobblyyyy.

the class AngleSplineTrajectory method nextMarker.

@Override
public PointXYZ nextMarker(PointXYZ current) {
    double x = current.x() + step;
    PointXY interpolatedPoint = spline.interpolate(x);
    Angle interpolatedAngle = angleSpline.getAngleTarget(x);
    return interpolatedPoint.withHeading(interpolatedAngle);
}
Also used : Angle(me.wobblyyyy.pathfinder2.geometry.Angle) PointXY(me.wobblyyyy.pathfinder2.geometry.PointXY)

Example 25 with PointXYZ

use of me.wobblyyyy.pathfinder2.geometry.PointXYZ in project Pathfinder2 by Wobblyyyy.

the class AbstractTrajectory method nextMarker.

@Override
public PointXYZ nextMarker(PointXYZ current) {
    current = applyModifiers(current, nextMarkerInputModifiers);
    PointXYZ nextMarker = abstractNextMarker(current);
    nextMarker = applyModifiers(nextMarker, nextMarkerOutputModifiers);
    return nextMarker;
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ)

Aggregations

PointXYZ (me.wobblyyyy.pathfinder2.geometry.PointXYZ)99 LinearTrajectory (me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory)33 Test (org.junit.jupiter.api.Test)32 Trajectory (me.wobblyyyy.pathfinder2.trajectory.Trajectory)27 Angle (me.wobblyyyy.pathfinder2.geometry.Angle)19 Translation (me.wobblyyyy.pathfinder2.geometry.Translation)12 MultiSegmentTrajectory (me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory)11 ArcTrajectory (me.wobblyyyy.pathfinder2.trajectory.ArcTrajectory)10 ArrayList (java.util.ArrayList)8 Pathfinder (me.wobblyyyy.pathfinder2.Pathfinder)8 Controller (me.wobblyyyy.pathfinder2.control.Controller)5 Robot (me.wobblyyyy.pathfinder2.robot.Robot)5 SimulatedOdometry (me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry)5 AdvancedSplineTrajectoryBuilder (me.wobblyyyy.pathfinder2.trajectory.spline.AdvancedSplineTrajectoryBuilder)5 GenericTurnController (me.wobblyyyy.pathfinder2.control.GenericTurnController)4 Follower (me.wobblyyyy.pathfinder2.follower.Follower)4 PointXY (me.wobblyyyy.pathfinder2.geometry.PointXY)4 SimulatedDrive (me.wobblyyyy.pathfinder2.robot.simulated.SimulatedDrive)4 SimulatedRobot (me.wobblyyyy.pathfinder2.robot.simulated.SimulatedRobot)4 ElapsedTimer (me.wobblyyyy.pathfinder2.time.ElapsedTimer)4