Permalink
Browse files

fixed some of your broken shit menoli

1 parent 2fb9fcf commit 202fe1599cc63a8fdb79bd859995ee4333607b33 @GreenRazor GreenRazor committed Feb 16, 2017
@@ -1,7 +1,7 @@
package org.usfirst.frc.team3070.robot;
public class Auto {
- private Drive drive;
+ private Drive drive = new Drive();
double gyroValue = 0.1;
double[] rotations = drive.getDistanceTraveled();
boolean turn1;
@@ -17,7 +17,11 @@ public void autoSkeleton() {
//if not, drive straight forward and first turn has not happened yet
drive.driveRobotStraight();
turn1 = false;
+ }else if (rotations[2] > 5) {
+
}
+ /*
+
//checks if the robot has gone 5 feet
if (rotations[2] >= 5 && turn1 == false && drive.turn(45, Pronstants.AUTO_DRIVE_SPEED) == false) {
//if it has, turn it (Placeholder) degrees and the first turn has now happened
@@ -28,7 +32,7 @@ public void autoSkeleton() {
if (turn1) {
//if so, start vision here
//TODO: finish vision and implement here
- }
+ }*/
}
public void autoL1() {
@@ -6,8 +6,11 @@
public class Drive {
private static CANTalon talFR, talFL, talBR, talBL;
double startHeading;
+ private ProntoGyro gyro;
public Drive()
{
+
+ gyro = new ProntoGyro();
//defines the talon variables
talFR = new CANTalon(Pronstants.TALON_FRONT_RIGHT_PORT);
talFL = new CANTalon(Pronstants.TALON_FRONT_LEFT_PORT);
@@ -83,12 +86,12 @@ public boolean turn(double angle, double speed) {
//turns the robot until it aligns with an angle on the gyro
//TODO test on robot and see if should use time instead
//checks if the gyro angle is less than the desired angle
- if (ProntoGyro.calculateHeading() < angle) {
+ if (gyro.calculateHeading() < angle) {
//If it is, turn left
drive(speed, -speed);
}
//checks if the gyro angle is greater than the desired angle
- else if (ProntoGyro.calculateHeading() > angle) {
+ else if (gyro.calculateHeading() > angle) {
//if it is, turn right
drive(-speed, speed);
}
@@ -100,17 +103,17 @@ else if (ProntoGyro.calculateHeading() > angle) {
return false;
}
public void driveRobotStraight() {
- if (ProntoGyro.calculateHeading() > startHeading + 5) {
+ if (gyro.calculateHeading() > startHeading + 5) {
drive(Pronstants.AUTO_DRIVE_SPEED + 0.1, Pronstants.AUTO_DRIVE_SPEED);
}
- else if (ProntoGyro.calculateHeading() > (startHeading - 5)) {
+ else if (gyro.calculateHeading() > (startHeading - 5)) {
drive (Pronstants.AUTO_DRIVE_SPEED, Pronstants.AUTO_DRIVE_SPEED + 0.1);
}
else {
drive(Pronstants.AUTO_DRIVE_SPEED, Pronstants.AUTO_DRIVE_SPEED);
}
}
public void setStraightValue() {
- startHeading = ProntoGyro.calculateHeading();
+ startHeading = gyro.calculateHeading();
}
}
@@ -4,7 +4,7 @@
//The modifier of the negative acceleration the robot undergoes at the end of a movement.
static final double RAMP_RATE = 0.5;
//The speed at which the robot travels in autonomous.
- static final double AUTO_DRIVE_SPEED = 0.5;
+ static final double AUTO_DRIVE_SPEED = 0.1;
//The speed at which the robot climbs the rope.
static final double AUTO_CLIMB_SPEED = 0.5;
//The value which the robot doesn't move if the controller value is under.
@@ -10,10 +10,10 @@ public ProntoGyro()
reset();
}
- public static double calculateHeading() {
+ public double calculateHeading() {
double angle = (imu.getHeading()-angleOffset) % 360;
if (angle > 180) {
- angle = angle-360;
+ angle = 360-angle;
}
return angle;
}

0 comments on commit 202fe15

Please sign in to comment.