use of me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry in project Pathfinder2 by Wobblyyyy.
the class TestMovementRecorder method testMovementRecorder.
public void testMovementRecorder() {
Pathfinder pf = Pathfinder.newSimulatedPathfinder(0.01);
SimulatedOdometry odometry = (SimulatedOdometry) pf.getOdometry();
Translation translation = new Translation(0.51, 0.51, 0);
odometry.setVelocity(Angle.DEG_45, 0.5);
odometry.setTranslation(translation);
pf.setTranslation(translation);
pf.getRecorder().start();
pf.tick();
ElapsedTimer timer = new ElapsedTimer(true);
while (timer.elapsedSeconds() < 2) pf.tick();
}
use of me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry in project Pathfinder2 by Wobblyyyy.
the class TestSimulatedChassis method beforeEach.
@BeforeEach
public void beforeEach() {
wrapper = new SimulatedWrapper(new SimulatedDrive(), new SimulatedOdometry());
odometry = wrapper.getOdometry();
robot = wrapper.getRobot();
turnController = new ProportionalController(-0.05);
pathfinder = new Pathfinder(robot, turnController).setSpeed(0.5).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(5));
factory = new SplineBuilderFactory().setSpeed(0.5).setStep(0.1).setTolerance(DEFAULT_TOLERANCE).setAngleTolerance(Angle.fromDeg(5));
}
use of me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry in project Pathfinder2 by Wobblyyyy.
the class GenericTrajectoryTester method beforeEach.
@BeforeEach
public void beforeEach() {
wrapper = new SimulatedWrapper(new SimulatedDrive(), new SimulatedOdometry());
odometry = wrapper.getOdometry();
robot = wrapper.getRobot();
turnController = new ProportionalController(turnCoefficient);
pathfinder = new Pathfinder(robot, turnController).setSpeed(speed).setTolerance(tolerance).setAngleTolerance(angleTolerance);
factory = new SplineBuilderFactory().setSpeed(speed).setStep(step).setTolerance(tolerance).setAngleTolerance(angleTolerance);
}
use of me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry in project Pathfinder2 by Wobblyyyy.
the class TestStatTracker method testTicksPerSecond.
public void testTicksPerSecond() {
Pathfinder pathfinder = Pathfinder.newSimulatedPathfinder(0.01).setSpeed(0.75).setTolerance(2).setAngleTolerance(Angle.fixedDeg(10));
pathfinder.loadPlugin(new StatTracker());
pathfinder.goTo(new PointXYZ(10, 10, 0));
pathfinder.splineTo(new PointXYZ(10, 10, 90), new PointXYZ(12, 11, 45), new PointXYZ(13, 15, 180));
ElapsedTimer timer = new ElapsedTimer(true);
SimulatedOdometry odometry = (SimulatedOdometry) pathfinder.getOdometry();
AtomicInteger i = new AtomicInteger(0);
try {
while (timer.elapsedSeconds() < 5) {
if (Math.random() > 0.5)
Thread.sleep(2);
pathfinder.tick();
Translation translation = pathfinder.getTranslation();
odometry.setRawPosition(odometry.getRawPosition().add(new PointXYZ(translation.vx() / 50, translation.vy() / 50, Angle.fixedRad(translation.vz() / 50))));
}
} catch (Exception ignored) {
}
pathfinder.tick();
System.out.println("tps: " + pathfinder.ticksPerSecond());
System.out.println("ticks: " + pathfinder.getData("pf_ticks"));
System.out.println("position: " + pathfinder.getPosition());
System.out.println("condition met: " + i.get());
System.out.println("total PointXY: " + PointXY.COUNT);
System.out.println("total PointXYZ: " + PointXYZ.COUNT);
System.out.println("total Angle: " + Angle.COUNT);
}
use of me.wobblyyyy.pathfinder2.robot.simulated.SimulatedOdometry in project Pathfinder2 by Wobblyyyy.
the class ExampleTimedRobot method robotInit.
@Override
public void robotInit() {
// initialize everything. if this was a real implementation, you would
// not want to use SimulatedDrive or SimulatedOdometry
drive = new SimulatedDrive();
odometry = new SimulatedOdometry();
robot = new Robot(drive, odometry);
pathfinder = new Pathfinder(robot, controller).setSpeed(0.5).setTolerance(2).setAngleTolerance(Angle.fromDeg(5));
}
Aggregations