Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
1dfff89
Move practice bot from practice drive train to regular drive train.
Glitterybunny245 Nov 30, 2024
c406efe
Revert "preset tweaks"
gnazarey Nov 30, 2024
ea44bd8
Reverted previous commit.
Glitterybunny245 Nov 30, 2024
12811e9
Merge remote-tracking branch 'origin/Comp2' into Comp2
gnazarey Nov 30, 2024
13dc641
Changed odometer to drivetrain.odometer
gnazarey Nov 30, 2024
ed098c8
RedSimple is going to be a simple park
gnazarey Nov 30, 2024
d4d8900
Put in a simple x 10 to test auto
gnazarey Nov 30, 2024
8f198ea
Got PractiveRedSimple to park. Using a very simple drive for 150 coun…
Glitterybunny245 Nov 30, 2024
b1e1847
Turned off the dashboard for the competition
gnazarey Dec 6, 2024
beec3d3
Modified auto to have one park CompPark.
gnazarey Dec 7, 2024
23df47e
Added inits to have power in servros
gnazarey Dec 7, 2024
2d8ec35
Added AUTO_X_DISTANCE_ERROR
gnazarey Dec 14, 2024
a65fe42
Removed this file, because it is not needed.
gnazarey Dec 14, 2024
bde6aed
Added the Constants.DASHBOARD_ENABLED to the setDashboard enabled.
gnazarey Dec 14, 2024
fe3ff56
Working on added needed functionality to be able to practice auto mode.
gnazarey Dec 14, 2024
8d9feae
Added auto_goto_xy, auto_drive_x and auto_drive_y for auto mode.
gnazarey Dec 14, 2024
82ac8bf
Changed elevator switch statement for preset posiitions, got rid of t…
Glitterybunny245 Dec 14, 2024
c054254
Renamed the three elevator constants
Glitterybunny245 Dec 14, 2024
7e6b9c9
Added need constants for auto:
gnazarey Dec 14, 2024
26828a5
Added a switch to control the steps or waypoints
gnazarey Dec 14, 2024
584630d
moved function calls to Practice Park
gnazarey Dec 14, 2024
3d49d7f
Merge remote-tracking branch 'origin/Comp3' into Comp3
gnazarey Dec 14, 2024
b805cb3
Got the square to work
gnazarey Dec 21, 2024
995aef6
craeted new auto for specimens
Kitten-kitten Dec 21, 2024
06513f9
Cleaned up code with comments
gnazarey Dec 21, 2024
149e66f
Commented out code that wasn't being used.
gnazarey Dec 21, 2024
cb8b5ba
created new auto for specimens
Kitten-kitten Dec 21, 2024
6b5b754
Added Test Waypoints for George's Test.
gnazarey Dec 30, 2024
8f338ae
Cleaned up formatting
gnazarey Dec 30, 2024
f6292da
Corrected the get y position to return the correct value.
gnazarey Jan 3, 2025
b739bf0
Modified to use for gathering x y coordinates
gnazarey Jan 3, 2025
11187dd
Modified getYPosition to return the correct signed value.
gnazarey Jan 3, 2025
ff16720
Created this file for code testing.
gnazarey Jan 3, 2025
78c2816
Updated code from George Test for moving in auto
Glitterybunny245 Jan 4, 2025
639b8ac
Changed the waypoint class to include x and y speed
Glitterybunny245 Jan 4, 2025
7f81522
Added more waypoints
Glitterybunny245 Jan 4, 2025
5a71d54
Added more waypoints
Glitterybunny245 Jan 4, 2025
d9aeabb
Changed from GeorgeWaypoint to Waypoint
gnazarey Jan 4, 2025
a60d8d1
Modified to get reading for x y coord for auto
gnazarey Jan 4, 2025
eb05d05
All of the waypoints are finished. Need to move to compbot for additi…
gnazarey Jan 4, 2025
ae2e872
Added PracticeBasket for Practice Bot for the auto Basket task.
gnazarey Jan 4, 2025
9989d2a
Added PracticeBasket for Practice Bot for the auto Basket task.
gnazarey Jan 11, 2025
4ae041b
Added code from AutoPrac for completeness
gnazarey Jan 11, 2025
a8ad803
Created class for comp specimen
gnazarey Jan 11, 2025
9e03ec5
Made changes to equal practice bot
gnazarey Jan 11, 2025
241ec20
Remove engine commands, so we can use this for measurements
gnazarey Jan 11, 2025
b625349
Working at added elevator, elbow, and claw commands.
gnazarey Jan 11, 2025
727a1a8
Tweeting for correct waypoints
gnazarey Jan 11, 2025
0a795ac
Added tweets for auto mode.
gnazarey Jan 11, 2025
aeeae96
Added another constant to accomodate for the the practice being able …
Glitterybunny245 Jan 11, 2025
8280034
Added another constant so both robots can pickup specimens from the w…
Kitten-kitten Jan 11, 2025
f49dc97
Added for the Compbot basket for auto
gnazarey Jan 18, 2025
af04b8d
Modified default speed setting for x and y
gnazarey Jan 18, 2025
890326b
Added comments for drivetrain setting
gnazarey Jan 18, 2025
caf76f2
Fixed formatting of class line.
gnazarey Jan 18, 2025
5148a01
Added the - sign in the getYposition function to match practice drive…
gnazarey Jan 18, 2025
c43a0f4
Add some comments that were in DriveTrain, but not in PracticeDriveTrain
gnazarey Jan 18, 2025
935332a
- added elevator command in case 3
gnazarey Jan 18, 2025
a00d248
Defined claw and elevator in all practice classes
Glitterybunny245 Jan 18, 2025
4001ac5
changed waypoints positions
Glitterybunny245 Jan 18, 2025
af83eb3
Moved all the inversion for the odometry, after the pods were mounted…
Glitterybunny245 Jan 18, 2025
e2aae15
- added elevator command in case 3
gnazarey Jan 25, 2025
b750594
add an init_loop to reset the odometer
gnazarey Jan 25, 2025
d8fdd34
add comments
gnazarey Jan 25, 2025
14e2694
updaeetd the offsets
Jan 25, 2025
b62ff8b
Changed values of waypoints
Kitten-kitten Jan 25, 2025
9e915a3
created compBasket_CBW for testing; corrected Pinpoint directions. st…
Jan 30, 2025
b45634f
Merge remote-tracking branch 'origin/Comp3' into Comp3
Jan 30, 2025
26804df
updated case 3
Jan 30, 2025
19234a3
found an x that should have been a y in goto_xy
gnazarey Jan 31, 2025
8eaa016
Format change. No code change.
gnazarey Jan 31, 2025
e0dc033
increasedd speed
Jan 31, 2025
ab48cdd
Merge remote-tracking branch 'origin/Comp3' into Comp3
Jan 31, 2025
2361e1a
working on new auto
Feb 1, 2025
0968650
Created a new auto park using new system.
Glitterybunny245 Feb 1, 2025
f2d3fff
Created a new auto park using new system.
Glitterybunny245 Feb 1, 2025
1a3c11f
New park auto sort of working,
Feb 1, 2025
fa6fd7b
Merge remote-tracking branch 'origin/Comp3' into Comp3
gnazarey Feb 1, 2025
8d06f73
Working on added web telemetry.
gnazarey Feb 2, 2025
82a3f57
Created a Do Nothing auto, so the initalization to TeleOp will work c…
gnazarey Feb 2, 2025
f5009d0
Modified the elevator height for high bar.
gnazarey Feb 2, 2025
fd4a290
Modified the elevator height for high bar.
gnazarey Feb 2, 2025
58b8e1b
Put in new logic for at_x and at_y. We were missing a couple of tests…
gnazarey Feb 2, 2025
7723412
Added code to output the error value for at_x and at_y.
gnazarey Feb 2, 2025
4819418
Added code to send to dashboard
gnazarey Feb 3, 2025
8340dc4
Added code to send to dashboard
gnazarey Feb 3, 2025
9ed5bf5
Added code to send to dashboard
gnazarey Feb 3, 2025
6bb2e73
added testGoTo
Feb 8, 2025
243329a
Added code to send to dashboard
gnazarey Feb 8, 2025
b0771f3
added testGoTo
Feb 8, 2025
c83e0d5
Change 10 to 10.0
gnazarey Feb 8, 2025
3ca63d9
Changed Waypoint values
gnazarey Feb 8, 2025
f353d1e
testing gotoXY_test.java
Feb 8, 2025
21f9ae0
Merge remote-tracking branch 'origin/Comp4' into Comp4
Feb 8, 2025
1e21ebd
Cleaned up the formating and made sure that each double had .0 after it
gnazarey Feb 8, 2025
6e455c0
testing gotoXY_test.java
Feb 8, 2025
9bb645d
Added some comments to the waypoint
gnazarey Feb 8, 2025
c775162
Merge remote-tracking branch 'origin/Comp4' into Comp4
gnazarey Feb 8, 2025
11680eb
Removed passing in previous waypoint, since it was not being used.
gnazarey Feb 8, 2025
26d1bd1
Added the configuration option to DriveTrain, so modification can be …
gnazarey Feb 8, 2025
bcb43ef
testing gotoxy: added tbleshooting messages, gains changed.
Feb 8, 2025
f95226c
fixed turning: added "correction = 0 if within tolerance into drive t…
Feb 8, 2025
f2ec357
Implemented the new way of going to waypoints
gnazarey Feb 9, 2025
841bcaf
corrected new park
Feb 14, 2025
6911cf9
tuned gotoxy
Feb 15, 2025
d1d3522
Implemented the new way of going to waypoints
gnazarey Feb 15, 2025
cfa1ac5
Implemented the new way of going to waypoints
gnazarey Feb 15, 2025
5eeee36
Fix turning by checking if we are done with auto. If done, don't call…
gnazarey Feb 15, 2025
54bbe97
Fix turning by checking if we are done with auto. If done, don't call…
gnazarey Feb 15, 2025
209e58c
trouble shooting auto spin
Feb 15, 2025
e2b975b
comp basket auto working on test chassis,need to tune for comp chassis.
Feb 15, 2025
7762d9b
1)clean up comments, put old Autos into folder2) added heading Kp to …
Feb 17, 2025
91a3c0a
fine tuning waypoints for basked and adding parking
Feb 21, 2025
e53dfe6
fine tuning waypoints for basket
Feb 22, 2025
b91dd5f
created new two basket auto
Feb 22, 2025
3f8dd4a
created new two basket auto/ading claw time
Feb 22, 2025
e88976d
Added a timely element to for claw closure
gnazarey Feb 22, 2025
1070b92
Created Logging module to save log files to microsd card on the Contr…
gnazarey Mar 7, 2025
2253b9f
Added the updates to logger to include a timestamp
gnazarey Mar 11, 2025
b37efba
This class will turn 90 every 0.2 seconds
gnazarey Mar 11, 2025
d846746
Updated telemetry to dashboard
gnazarey Mar 15, 2025
1d24ce6
created new two basket auto/ading claw time
Mar 29, 2025
5a22d60
Driving Test Auto
gnazarey Mar 29, 2025
875b6a1
Added Public Static variables for dashboard
gnazarey Mar 29, 2025
4dc9c65
Turning auto
gnazarey Mar 29, 2025
ed686f1
Added a new test.
gnazarey Mar 29, 2025
487e4cd
Merge remote-tracking branch 'origin/OffSeason' into OffSeason
Apr 5, 2025
2c54dd9
just testing team laptop
ftc16596 Apr 5, 2025
7cb5d75
Merge remote-tracking branch 'origin/OffSeason' into OffSeason
Apr 5, 2025
d29402d
minor changes in elevator testing
ftc16596 Apr 5, 2025
0cd8da2
Merge remote-tracking branch 'origin/OffSeason' into OffSeason
Apr 5, 2025
984962d
fixed hwmap issues
Apr 5, 2025
410ed1e
elevator.printTelemetry(telemetry);
ftc16596 Apr 5, 2025
d1b7818
elevator.init();
ftc16596 Apr 5, 2025
20fe809
Coded auto to pickup a sample from the tape, dropped in the basket
Glitterybunny245 Apr 12, 2025
389cfed
coding tutorials and elevator tests
Aila-skibidi May 2, 2025
9515f38
Merge remote-tracking branch 'origin/OffSeason' into OffSeason
Glitterybunny245 May 3, 2025
a329e26
3 samples
Aila-skibidi May 3, 2025
8aeb205
got farther in auto and figured out problems with practice chassie(re…
Aila-skibidi May 10, 2025
62f85d7
last waypoint
Aila-skibidi May 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions TeamCode/src/main/java/Testing_Code.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

@TeleOp
public class Testing_Code extends OpMode {

private DcMotor leftMotor;
private DcMotor rightMotor;

@Override
public void init() {
leftMotor = hardwareMap.get(DcMotor.class,"left");
rightMotor = hardwareMap.get(DcMotor.class,"right");
leftMotor.setDirection(DcMotorSimple.Direction.REVERSE);


}

@Override
public void loop() {
double leftPower = -gamepad1.left_stick_y;
double rightPower = -gamepad1.left_stick_y;

leftMotor.setPower(leftPower);
rightMotor.setPower(rightPower);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
package org.firstinspires.ftc.teamcode.Auto;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.firstinspires.ftc.robotcore.external.navigation.Pose2D;
import org.firstinspires.ftc.teamcode.Mechanisms.CAITelemetry;
import org.firstinspires.ftc.teamcode.Mechanisms.Claw;
import org.firstinspires.ftc.teamcode.Mechanisms.Constants;
import org.firstinspires.ftc.teamcode.Mechanisms.DriveTrain2025;
import org.firstinspires.ftc.teamcode.Mechanisms.Elbow;
import org.firstinspires.ftc.teamcode.Mechanisms.Elevator;
import org.firstinspires.ftc.teamcode.OLD_AutoPrograms.BaseAutoComp;

import java.util.Locale;

//@Autonomous(name = "CompBasket")
public class CompBasket extends BaseAutoComp {
private DriveTrain2025 driveTrain;
private int current_step;
private int total_waypoints = 20;
WayPoint[] wayPoints;
CAITelemetry dashboardtelemtry;

public void init_loop(){
driveTrain.odometer.update();
// driveTrain.odometer.resetPosAndIMU();
telemetry.addData("Sequence Step", this.current_step);
Pose2D pos = driveTrain.odometer.getPosition();
String data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", pos.getX(DistanceUnit.MM), pos.getY(DistanceUnit.MM), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Position", data);
data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", driveTrain.getXPosition(), driveTrain.getYPosition(), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Function Position", data);
telemetry.addData("Elevator State:",elevator.getState());
// This gets called when we have zero out and ready to hit play.
// if (driveTrain.getXPosition() <= 0.1 && driveTrain.getYPosition() <= 0.1) {
// telemetry.addData("Initialized","");
// }
}
public void init() {
driveTrain = new DriveTrain2025(hardwareMap);
driveTrain.init();
driveTrain.odometer.resetPosAndIMU();
driveTrain.odometer.update();
claw = new Claw(hardwareMap);
elbow = new Elbow(hardwareMap);
this.elbow.init();
this.elbow.setElbowState(0);
elevator = new Elevator(hardwareMap);
this.elevator.init();
this.elevator.setElevatorState(0);
this.current_step = 1;
dashboardtelemtry = new CAITelemetry(telemetry);
// Display Setup
telemetry.addData("Sequence Step", this.current_step);
Pose2D pos = driveTrain.odometer.getPosition();
String data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", pos.getX(DistanceUnit.MM), pos.getY(DistanceUnit.MM), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Position", data);
data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", driveTrain.getXPosition(), driveTrain.getYPosition(), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Function Position", data);
telemetry.addData("Elevator State:", elevator.getState());
//Waypoint setup
this.wayPoints = new WayPoint[this.total_waypoints + 1];
this.wayPoints[0] = new WayPoint();
this.wayPoints[0].x = 0.0;
this.wayPoints[0].y = 0.0;
this.wayPoints[0].facing = Constants.NORTH;
// WayPoint 1
this.wayPoints[1] = new WayPoint();
this.wayPoints[1].x = 400.0;
this.wayPoints[1].x_speed = 0.3;
this.wayPoints[1].y = 1.0;
this.wayPoints[1].y_speed = 0.3;
this.wayPoints[1].facing = Constants.NORTH;
//Done Waypoint 1
this.wayPoints[2] = new WayPoint();
this.wayPoints[2].x = 500.0;
this.wayPoints[2].x_speed = 0.3;
this.wayPoints[2].y = 400.0;
this.wayPoints[2].y_speed = 0.3;
this.wayPoints[2].facing = Constants.SOUTH_WEST;
//Done Waypoint 2
this.wayPoints[3] = new WayPoint();
this.wayPoints[3].x = 110.0;// hitting the wall?
this.wayPoints[3].y = 90.0;
this.wayPoints[3].y_speed = 0.3;
this.wayPoints[3].x_speed = 0.3;
this.wayPoints[3].facing = Constants.SOUTH_WEST;
//Done Waypoint 3
this.wayPoints[4] = new WayPoint();
this.wayPoints[4].x = 15.0;
this.wayPoints[4].y = 700.0;
this.wayPoints[4].y_speed = 0.3;
this.wayPoints[4].x_speed = 0.3;
this.wayPoints[4].facing = Constants.SOUTH_WEST;
//Done Waypoint 4
this.wayPoints[5] = new WayPoint();
this.wayPoints[5].x = 445.0;
this.wayPoints[5].y = 530.0;
this.wayPoints[5].y_speed = 0.3;
this.wayPoints[5].x_speed = 0.3;
this.wayPoints[5].facing = Constants.NORTH;
//Done Waypoint 5
//Waypoint for rotating
this.wayPoints[6] = new WayPoint();
this.wayPoints[6].x = 445.0;
this.wayPoints[6].y = 530.0;
this.wayPoints[6].y_speed = 0.3;
this.wayPoints[6].x_speed = 0.3;
this.wayPoints[6].facing = Constants.SOUTH_WEST;
//Done waypoint 6
this.wayPoints[7] = new WayPoint();
this.wayPoints[7].x = 270.0;
this.wayPoints[7].y = 250.0;
this.wayPoints[7].y_speed = 0.3;
this.wayPoints[7].x_speed = 0.3;
this.wayPoints[7].facing = Constants.SOUTH_WEST;
// Waypoint
this.wayPoints[8] = new WayPoint();
this.wayPoints[8].x = 270.0;
this.wayPoints[8].y = 530.0;
this.wayPoints[8].y_speed = 0.3;
this.wayPoints[8].x_speed = 0.3;
this.wayPoints[8].facing = Constants.NORTH;
// Waypoint
this.wayPoints[9] = new WayPoint();
this.wayPoints[9].x = 695.0;
this.wayPoints[9].y = 530.0;
this.wayPoints[9].y_speed = 0.3;
this.wayPoints[9].x_speed = 0.3;
this.wayPoints[9].facing = Constants.NORTH;
// Waypoint
this.wayPoints[10] = new WayPoint();
this.wayPoints[10].x = 0.0;
this.wayPoints[10].y = 720.0;
this.wayPoints[10].y_speed = 0.3;
this.wayPoints[10].x_speed = 0.3;
this.wayPoints[10].facing = Constants.NORTH;


}//init

@Override
public void loop() {
driveTrain.odometer.update();
dashboardtelemtry.update();
// Send information to the display
telemetry.addData("Sequence Step", this.current_step);

Pose2D pos = driveTrain.odometer.getPosition();
String data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", pos.getX(DistanceUnit.MM), pos.getY(DistanceUnit.MM), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Position", data);
data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", driveTrain.getXPosition(), driveTrain.getYPosition(), pos.getHeading(AngleUnit.DEGREES));
telemetry.addData("Function Position", data);
if (this.wayPoints[this.current_step] != null) {
telemetry.addData("At Waypoint", this.at_xy(this.wayPoints[this.current_step]));
telemetry.addData("At Waypoint X", this.at_x(this.wayPoints[this.current_step].x));
telemetry.addData("At Waypoint Y", this.at_y(this.wayPoints[this.current_step].y));
telemetry.addData("Current Waypoint", "X: %.3f, Y %.3f", this.wayPoints[this.current_step].x, this.wayPoints[this.current_step].y);
// ftc-dashboard telemetry

} else {
telemetry.addData("At Waypoint", this.at_xy(this.wayPoints[this.current_step - 1]));
telemetry.addData("At Waypoint X", this.at_x(this.wayPoints[this.current_step - 1].x));
telemetry.addData("At Waypoint Y", this.at_y(this.wayPoints[this.current_step - 1].y));
telemetry.addData("Current Waypoint", "X: %.3f, Y %.3f", this.wayPoints[this.current_step - 1].x, this.wayPoints[this.current_step - 1].y);
// ftc-dashboard telemetry

}
telemetry.addData("heading:", "%.2f", driveTrain.heading);
telemetry.addData("Elevator State:", elevator.getState());
// ftc-dashboard telemetry
dashboardtelemtry.addData("Step:",this.current_step);


//starting waypoint navigation
switch (this.current_step) {
// drive 2 inches form submersible
case 1:
if (!this.at_xy(this.wayPoints[this.current_step])) {
this.goto_xy(this.wayPoints[this.current_step]);
} else {

dashboardtelemtry.addData("made to else", "");
dashboardtelemtry.update();
driveTrain.drive(0.0, 0.0);
this.current_step++;
}
break;
case 2:
// strafe to line up with basketr

if (!this.at_xy(this.wayPoints[this.current_step])) {
this.goto_xy(this.wayPoints[this.current_step]);
} else {
driveTrain.drive(0.0, 0.0);
// this.claw.openClaw();
this.current_step++;
}
break;
case 3://turn to SW
driveTrain.setFacing(this.wayPoints[this.current_step].facing);
if (!this.at_xy(this.wayPoints[this.current_step])) {
this.goto_xy(this.wayPoints[this.current_step]);
} else {
driveTrain.drive(0.0, 0.0);
elevator.setElevatorState(3);
this.current_step++;
}
break;
case 4:// drive to basket at 135 heading
elevator.setElevatorState(3);
if (!this.at_xy(this.wayPoints[this.current_step])) {
this.goto_xy(this.wayPoints[this.current_step]);
} else {
driveTrain.drive(0.0, 0.0);
driveTrain.setFacing(this.wayPoints[this.current_step].facing);
this.claw.openClaw();
this.current_step++;
}
break;

// need to add: back away from basket, lower elevator, drive to submerssable , raise arm to touch bar
// case 5:
// if (!this.at_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]))
// {
// this.goto_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]);
// }
// else
// {
// driveTrain.drive(0.0,0.0);
// this.current_step++;
// }
// break;
// case 6:
// driveTrain.setDirection(this.wayPoints[this.current_step].facing);
// this.current_step++;
// break;
// case 7:
// if (!this.at_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]))
// {
// this.goto_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]);
// }
// else
// {
// driveTrain.drive(0.0,0.0);
// this.current_step++;
// }
// break;
// case 8:
// driveTrain.setDirection(this.wayPoints[this.current_step].facing);
// this.current_step++;
// break;
// case 9:
// if (!this.at_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]))
// {
// this.goto_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]);
// }
// else
// {
// driveTrain.drive(0.0,0.0);
// this.current_step++;
// }
// break;
// case 10:
// if (!this.at_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]))
// {
// this.goto_xy(this.wayPoints[this.current_step-1],this.wayPoints[this.current_step]);
// }
// else
// {
// driveTrain.drive(0.0,0.0);
// this.current_step++;
// }
// break;
default:
elevator.setElevatorState(3);
break;
}
// Done Processing Waypoints
// Process loop
//elevator.setElevatorState(3);
driveTrain.loop();
this.elevator.loop();
}

@Override
public void stop() {
elevator.setElevatorState(0);
super.stop();
}

public boolean at_xy(WayPoint targetWaypoint) {
//return this.at_x(previousWaypoint.x,currentWaypoint.x) && this.at_y(previousWaypoint.y,currentWaypoint.y);
double errorX = Math.abs(targetWaypoint.x - driveTrain.getXPosition());
double errorY = Math.abs(targetWaypoint.y - driveTrain.getYPosition());
//double totalError = Math.sqrt(errorX * errorX + errorY * errorY);
dashboardtelemtry.addData("Error X", errorX);
dashboardtelemtry.addData("Error Y", errorY);
dashboardtelemtry.addData("heading:", driveTrain.heading);
dashboardtelemtry.addData("heading error",driveTrain.headingError);
dashboardtelemtry.addData("heading setpoint",driveTrain.headingSetPoint);
// dashboardtelemtry.addData("Error",totalError);
// return (totalError <= Constants.AT_XY_TOLERANCE);
return (errorX <= Constants.AT_XY_TOLERANCE && errorY <= Constants.AT_XY_TOLERANCE);
}

public boolean at_x(double targetX) {
return (Math.abs(targetX) - Math.abs(driveTrain.getXPosition())) <= Constants.AUTO_X_DISTANCE_ERROR;
}

public boolean at_y(double targetY) {
return (Math.abs(targetY) - Math.abs(driveTrain.getYPosition())) <= Constants.AUTO_Y_DISTANCE_ERROR;
}

public void goto_xy(WayPoint targetWaypoint) {


driveTrain.xControl.setSetPoint(targetWaypoint.x);
driveTrain.yControl.setSetPoint(targetWaypoint.y);
driveTrain.drive(driveTrain.xControl.calculate(driveTrain.getXPosition()) * Constants.AUTO_DRIVE_SPEED, driveTrain.yControl.calculate(driveTrain.getYPosition()) * Constants.AUTO_DRIVE_SPEED);
dashboardtelemtry.addData("X Calc", driveTrain.xControl.calculate());
dashboardtelemtry.addData("Y Calc", driveTrain.yControl.calculate());
dashboardtelemtry.update();

// pack.put("error:",totalError);


// if ( totalError <= Constants.AT_XY_TOLERANCE)
// { return true;}
// else
// {return false;}
return;
}
}
Loading