Search in sources :

Example 41 with PointXYZ

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

the class TestMovementCommands method testSplineToWithParameters.

@Test
public void testSplineToWithParameters() {
    registry.execute("splineTo", "0.5", "2", "5 deg", "0,0,15", "5,10,30", "10,15,45", "15,25,60");
    pathfinder.tickUntil(100);
    AssertionUtils.assertIsNear(new PointXYZ(15, 25, 60), pathfinder.getPosition(), 2, Angle.fromDeg(5));
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) Test(org.junit.jupiter.api.Test)

Example 42 with PointXYZ

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

the class TestMovementCommands method testGoToWithPointXY.

@Test
public void testGoToWithPointXY() {
    registry.execute("goTo", "10, ", "0");
    pathfinder.tickUntil(1_000);
    AssertionUtils.assertIsNear(new PointXYZ(10, 0, 0), pathfinder.getPosition(), 2, Angle.fromDeg(5));
    registry.execute("goTo", "0, 10");
    pathfinder.tickUntil(1_000);
    AssertionUtils.assertIsNear(new PointXYZ(0, 10, 0), pathfinder.getPosition(), 2, Angle.fromDeg(5));
    registry.execute("goTo", "10, 10");
    pathfinder.tickUntil(1_000);
    AssertionUtils.assertIsNear(new PointXYZ(10, 10, 0), pathfinder.getPosition(), 2, Angle.fromDeg(5));
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) Test(org.junit.jupiter.api.Test)

Example 43 with PointXYZ

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

the class TestMovementCommands method testNonTurningSplineTo.

@Test
public void testNonTurningSplineTo() {
    registry.execute("splineTo", "0,0,0", "5,10,0", "10,15,0", "15,25,0");
    pathfinder.tickUntil(100);
    AssertionUtils.assertIsNear(new PointXYZ(15, 25, 0), pathfinder.getPosition(), 2, Angle.fromDeg(5));
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) Test(org.junit.jupiter.api.Test)

Example 44 with PointXYZ

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

the class TestScript method testSetValuesAndSplineToScript.

@Test
public void testSetValuesAndSplineToScript() {
    pathfinder.setSpeed(0.2);
    pathfinder.setTolerance(0.1);
    pathfinder.setAngleTolerance(Angle.fromDeg(45));
    Script script = Script.load(registry, "me/wobblyyyy/pathfinder2/commands/testSetValuesAndSplineTo.pf");
    script.execute();
    Assertions.assertEquals(0.5, pathfinder.getSpeed());
    Assertions.assertEquals(2, pathfinder.getTolerance());
    Assertions.assertEquals(Angle.fromDeg(5), pathfinder.getAngleTolerance());
    AssertionUtils.assertIsNear(new PointXYZ(0, 0, 0), pathfinder.getPosition(), 2, Angle.fromDeg(5));
}
Also used : PointXYZ(me.wobblyyyy.pathfinder2.geometry.PointXYZ) Test(org.junit.jupiter.api.Test)

Example 45 with PointXYZ

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

the class Pathfinder method goTo.

/**
 * Go to a specific point. This method will create a new linear trajectory.
 *
 * @param point the target point to go to.
 * @return this instance of Pathfinder, used for method chaining.
 * @see #setSpeed(double)
 * @see #setTolerance(double)
 * @see #setAngleTolerance(Angle)
 */
public Pathfinder goTo(PointXYZ point) {
    NullPointException.throwIfInvalid("Attempted to navigate to a null point.", point);
    checkForMissingDefaultValues();
    followTrajectory(new LinearTrajectory(point, speed, tolerance, angleTolerance));
    return this;
}
Also used : LinearTrajectory(me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory)

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