Search in sources :

Example 1 with MultiSegmentTrajectory

use of me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory in project Pathfinder2 by Wobblyyyy.

the class MultiSegmentTrajectory method toString.

@Override
public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("MultiSegmentTrajectory (");
    for (Trajectory trajectory : trajectories) {
        builder.append(trajectory);
        builder.append(',');
    }
    if (trajectories.size() > 0)
        builder.setLength(builder.length() - 1);
    builder.append(')');
    return builder.toString();
}
Also used : Trajectory(me.wobblyyyy.pathfinder2.trajectory.Trajectory)

Example 2 with MultiSegmentTrajectory

use of me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory in project Pathfinder2 by Wobblyyyy.

the class TestSimulatedChassis method testMultiSegmentTrajectory.

@Test
public void testMultiSegmentTrajectory() {
    List<Trajectory> trajectories = new LinearTrajectoryBuilder().setSpeed(0.5).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(1)).goTo(new PointXYZ(0, 0, 0)).goTo(new PointXYZ(0, 10, 0)).goTo(new PointXYZ(10, 10, 0)).goTo(new PointXYZ(10, 0, 0)).goTo(new PointXYZ(0, 0, 0)).getTrajectories();
    Trajectory trajectory = new MultiSegmentTrajectory(trajectories);
    pathfinder.followTrajectory(trajectory);
    pathfinder.tickUntil(500);
    assertPositionIs(new PointXYZ());
}
Also used : LinearTrajectoryBuilder(me.wobblyyyy.pathfinder2.trajectory.builder.LinearTrajectoryBuilder) MultiSegmentTrajectory(me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory) 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)

Aggregations

Trajectory (me.wobblyyyy.pathfinder2.trajectory.Trajectory)2 PointXYZ (me.wobblyyyy.pathfinder2.geometry.PointXYZ)1 ArcTrajectory (me.wobblyyyy.pathfinder2.trajectory.ArcTrajectory)1 LinearTrajectory (me.wobblyyyy.pathfinder2.trajectory.LinearTrajectory)1 LinearTrajectoryBuilder (me.wobblyyyy.pathfinder2.trajectory.builder.LinearTrajectoryBuilder)1 MultiSegmentTrajectory (me.wobblyyyy.pathfinder2.trajectory.multi.segment.MultiSegmentTrajectory)1