Search in sources :

Example 1 with WaypointSequence

use of com.team254.lib_2014.trajectory.WaypointSequence in project Relic_Main by TeamOverdrive.

the class TestingPath method main.

public static void main(String[] args) {
    TrajectoryGenerator.Config config = new TrajectoryGenerator.Config();
    config.dt = .01;
    config.max_acc = 0.6;
    config.max_jerk = 0.4;
    config.max_vel = 2.0;
    final double kWheelbaseWidth = 12.625 / 12;
    // Path name must be a valid Java class name.
    final String path_name = "RedCloseCryptobox";
    // Description of this auto mode path.
    // Remember that this is for the GO LEFT CASE!
    WaypointSequence p = new WaypointSequence(10);
    p.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
    p.addWaypoint(new WaypointSequence.Waypoint(7.0, 0, 0));
    Path path = PathGenerator.makePath(p, config, kWheelbaseWidth, path_name);
}
Also used : Path(com.team254.lib_2014.trajectory.Path) TrajectoryGenerator(com.team254.lib_2014.trajectory.TrajectoryGenerator) WaypointSequence(com.team254.lib_2014.trajectory.WaypointSequence)

Example 2 with WaypointSequence

use of com.team254.lib_2014.trajectory.WaypointSequence in project Relic_Main by TeamOverdrive.

the class PathFollowing method runOpMode.

@Override
public void runOpMode() throws InterruptedException {
    waitForStart("Path", true);
    TrajectoryGenerator.Config config = new TrajectoryGenerator.Config();
    config.dt = .01;
    config.max_acc = 10.0;
    config.max_jerk = 60.0;
    config.max_vel = 15.0;
    final double kWheelbaseWidth = 12.625;
    // Path name must be a valid Java class name.
    final String path_name = "RedCloseCryptobox";
    // Description of this auto mode path.
    // Remember that this is for the GO LEFT CASE!
    WaypointSequence p = new WaypointSequence(10);
    p.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
    p.addWaypoint(new WaypointSequence.Waypoint(7.0, 0, 0));
    Path path = PathGenerator.makePath(p, config, kWheelbaseWidth, path_name);
    // Robot.getDrive().loadProfile(path.getLeftWheelTrajectory(),
    // path.getRightWheelTrajectory(), 0, 0);
    // 
    // while (opModeIsActive() && !Robot.getDrive().onTarget()){
    // Robot.getDrive().update(1, 1);
    // }
    Robot.getDrive().setLeftRightPower(0, 0);
}
Also used : Path(com.team254.lib_2014.trajectory.Path) TrajectoryGenerator(com.team254.lib_2014.trajectory.TrajectoryGenerator) WaypointSequence(com.team254.lib_2014.trajectory.WaypointSequence)

Example 3 with WaypointSequence

use of com.team254.lib_2014.trajectory.WaypointSequence in project Relic_Main by TeamOverdrive.

the class TestingFIles method main.

public static void main(String... args) {
    TrajectoryGenerator.Config config = new TrajectoryGenerator.Config();
    // In/s
    config.max_vel = 23.832;
    // In/s^2
    config.max_acc = 11.9;
    // In/s^3
    config.max_jerk = 10;
    config.dt = 0.01;
    // WaypointSequence waypointSequence = new WaypointSequence(10);
    // waypointSequence.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
    // waypointSequence.addWaypoint(
    // new WaypointSequence.Waypoint(4, 0, 0));
    // waypointSequence.addWaypoint(new WaypointSequence.Waypoint(42.25-30, 34.5-26, Math.toRadians(5)));
    // WaypointSequence blueClose = new WaypointSequence(5);
    // blueClose.addWaypoint(new WaypointSequence.Waypoint(0, 4, 0));
    // blueClose.addWaypoint(new WaypointSequence.Waypoint(, 0, 0));
    // blueClose.addWaypoint(new WaypointSequence.Waypoint(5, 36, Math.toRadians(-10)));
    // 
    // Path path = PathGenerator.makePath(blueClose, config, 12.625, "");
    // System.out.println(path.getLeftWheelTrajectory().toStringEuclidean());
    WaypointSequence waypointSequence = new WaypointSequence(10);
    double xOffset = 120;
    double yOffset = 96;
    waypointSequence.addWaypoint(new WaypointSequence.Waypoint(96 - yOffset, 120 - xOffset, 0));
    waypointSequence.addWaypoint(new WaypointSequence.Waypoint(126 - yOffset, 115 - xOffset, Math.toRadians(-15)));
    Path pathToRightColumnRedFar = PathGenerator.makePath(waypointSequence, config, 12.625, "");
    System.out.println(pathToRightColumnRedFar.getLeftWheelTrajectory().toStringEuclidean());
}
Also used : Path(com.team254.lib_2014.trajectory.Path) TrajectoryGenerator(com.team254.lib_2014.trajectory.TrajectoryGenerator) WaypointSequence(com.team254.lib_2014.trajectory.WaypointSequence)

Example 4 with WaypointSequence

use of com.team254.lib_2014.trajectory.WaypointSequence in project Relic_Main by TeamOverdrive.

the class BlueClose_Paths method calculateBlueClose.

public static void calculateBlueClose(final FieldConfig fieldConfig) {
    if (pathFromBlueCloseToGlyphPit == null) {
        WaypointSequence waypointSequence = new WaypointSequence(5);
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(5, 0, 0));
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(24, 20, -89.4));
        pathFromBlueCloseToGlyphPit = PathGenerator.makePath(waypointSequence, defaultTrajectoryConfig, WHEEL_BASE, "");
        waypointSequence = new WaypointSequence(5);
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(25, 0, 5));
        pathFromBlueCloseGlyphPitToLeftColumn = PathGenerator.makePath(waypointSequence, defaultTrajectoryConfig, WHEEL_BASE, "");
    }
}
Also used : WaypointSequence(com.team254.lib_2014.trajectory.WaypointSequence)

Example 5 with WaypointSequence

use of com.team254.lib_2014.trajectory.WaypointSequence in project Relic_Main by TeamOverdrive.

the class RedClose_Paths method calculateRedClose.

public static void calculateRedClose(final FieldConfig field) {
    if (bsToRight == null) {
        WaypointSequence waypointSequence = new WaypointSequence(5);
        // Path from Red Far Stone to Right Column
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(0, 0, 0));
        waypointSequence.addWaypoint(new WaypointSequence.Waypoint(field.getFarRedCryptoboxToFarStone() - 21, 23 - field.getFarRedCenterToWall(), Math.toRadians(14)));
        bsToRight = PathGenerator.makePath(waypointSequence, defaultTrajectoryConfig, WHEEL_BASE, "");
    }
}
Also used : WaypointSequence(com.team254.lib_2014.trajectory.WaypointSequence)

Aggregations

WaypointSequence (com.team254.lib_2014.trajectory.WaypointSequence)16 Path (com.team254.lib_2014.trajectory.Path)7 TrajectoryGenerator (com.team254.lib_2014.trajectory.TrajectoryGenerator)7 Trajectory (com.team254.lib_2014.trajectory.Trajectory)2