Search in sources :

Example 56 with PointXYZ

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

the class EasyOdometry method buildOdometry.

public static Odometry buildOdometry(Supplier<Double> xPos, Supplier<Double> yPos, Supplier<Angle> zPos) {
    return new AbstractOdometry() {

        @Override
        public PointXYZ getRawPosition() {
            double x = xPos.get();
            double y = yPos.get();
            Angle z = zPos.get();
            return new PointXYZ(x, y, z);
        }
    };
}
Also used : AbstractOdometry(me.wobblyyyy.pathfinder2.robot.AbstractOdometry) Angle(me.wobblyyyy.pathfinder2.geometry.Angle) PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ)

Example 57 with PointXYZ

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

the class SimulatedOdometry method setRawPosition.

public void setRawPosition(double x, double y, double zDegrees) {
    ValidationUtils.validate(x, "x");
    ValidationUtils.validate(y, "y");
    ValidationUtils.validate(zDegrees, "zDegrees");
    setRawPosition(new PointXYZ(x, y, zDegrees));
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ)

Example 58 with PointXYZ

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

the class TestValidationUtils method testValidateNonNullObject.

@Test
public void testValidateNonNullObject() {
    ValidationUtils.validate(new PointXYZ());
    ValidationUtils.validate(new PointXYZ(), "hello");
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) Test(org.junit.jupiter.api.Test)

Example 59 with PointXYZ

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

the class TestSimulatedChassis method testTurningRectangle.

@Test
public void testTurningRectangle() {
    pathfinder.followTrajectories(new LinearTrajectory(new PointXYZ(0, 0, 0), 0.5, 0.1, Angle.fromDeg(5)), new LinearTrajectory(new PointXYZ(10, 0, 90), 0.5, 0.1, Angle.fromDeg(5)), new LinearTrajectory(new PointXYZ(10, 10, 180), 0.5, 0.1, Angle.fromDeg(5)), new LinearTrajectory(new PointXYZ(0, 10, 270), 0.5, 0.1, Angle.fromDeg(5)), new LinearTrajectory(new PointXYZ(0, 0, 0), 0.5, 0.1, Angle.fromDeg(5)));
    pathfinder.tickUntil(500);
    assertPositionIs(new PointXYZ());
}
Also used : LinearTrajectory(me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory) PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ)

Example 60 with PointXYZ

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

the class TestSimulatedChassis method testAkimaSplineInterpolation.

@Test
public void testAkimaSplineInterpolation() {
    Trajectory trajectory = new AdvancedSplineTrajectoryBuilder().setStep(0.5).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(1)).setInterpolationMode(InterpolationMode.AKIMA).setSpeed(0.5).add(new PointXYZ(0, 0, 0)).add(new PointXYZ(4, 10, 0)).add(new PointXYZ(8, 12, 0)).add(new PointXYZ(10, 13, 0)).add(new PointXYZ(12, 14, 0)).add(new PointXYZ(14, 15, 0)).build();
    pathfinder.followTrajectory(trajectory);
    pathfinder.tickUntil(500);
    assertPositionIs(new PointXYZ(14, 15, 0));
}
Also used : ArcTrajectory(me.wobblyyyy.pathfinder2.trajectory.ArcTrajectory) Trajectory(me.wobblyyyy.pathfinder2.trajectory.Trajectory) MultiSegmentTrajectory(me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory) LinearTrajectory(me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory) PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) AdvancedSplineTrajectoryBuilder(me.wobblyyyy.pathfinder2.trajectory.spline.AdvancedSplineTrajectoryBuilder)

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