}
}
- public static class DeadReckoning {
- public static final double DEFAULT_SPEED = 0.5;
- public static boolean isUsingTimeToPassDefense = true;
-
- // dead reckoning time and speed constants for driving through defenses
- public static double passRockWallTime = 0;
- public static double passRockWallSpeed = 0;
- public static double passRockWallDistance = 0;
- public static double passLowBarTime = 0;
- public static double passLowBarSpeed = 0;
- public static double passLowBarDistance = 0;
- public static double passMoatTime = 0;
- public static double passMoatSpeed = 0;
- public static double passMoatDistance = 0;
- public static double passRampartTime = 0;
- public static double passRampartSpeed = 0;
- public static double passRampartDistance = 0;
- public static double passRoughTerrainTime = 0;
- public static double passRoughTerrainSpeed = 0;
- public static double passRoughTerrainDistance = 0;
-
- }
-
public static class IntakeArm {
public static final int ROLLER_PORT = 0;
public static final int ARM_PORT = 1;
public static final double POS5_TURN1_TIME = 60;
public static final double POS5_TURN_MAXSPEED = 0.5;
public static final double POS5_DIST2_TIME = 0;
+
+ // Passing Defenses Constants
+
+ public static final double DEFAULT_SPEED = 0.5;
+ public static boolean isUsingTimeToPassDefense = true;
+
+ // dead reckoning time and speed constants for driving through defenses
+ public static double passRockWallTime = 0;
+ public static double passRockWallSpeed = 0;
+ public static double passRockWallDistance = 0;
+ public static double passLowBarTime = 0;
+ public static double passLowBarSpeed = 0;
+ public static double passLowBarDistance = 0;
+ public static double passMoatTime = 0;
+ public static double passMoatSpeed = 0;
+ public static double passMoatDistance = 0;
+ public static double passRampartTime = 0;
+ public static double passRampartSpeed = 0;
+ public static double passRampartDistance = 0;
+ public static double passRoughTerrainTime = 0;
+ public static double passRoughTerrainSpeed = 0;
+ public static double passRoughTerrainDistance = 0;
}
public enum Direction {
public double horizontalDistToGoal;
public AlignToScore(int position) {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
+ if (Constants.Auton.isUsingTimeToPassDefense) {
if (position == 1) {
addSequential(new DriveForTime(Constants.Auton.POS1_DIST1_TIME,
Constants.Auton.POS1_DRIVE_MAXSPEED));
* double horizontalDistToGoal) {
* double leftDist = Robot.driveTrain.getLeftLidarDistance();
* double rightDist = Robot.driveTrain.getRightLidarDistance();
- *
+ *
* double errorAngle = Math.atan(Math.abs(leftDist - rightDist) / 2);
* double distToTower;
* // TODO: figure out if we do want to shoot into the side goal if we are
* .cos(CENTER_OF_MASS_TO_ROBOT_FRONT + (leftDist - rightDist) / 2)
* - DIST_CASTLE_WALL_TO_SIDE_GOAL;
* }
- *
+ *
* // TODO: figure out if we do want to shoot into the font goal if we are
* // in position 3, 4, 5, or if we want to change that
* else {
* .cos(CENTER_OF_MASS_TO_ROBOT_FRONT + (leftDist - rightDist) / 2)
* - DIST_CASTLE_WALL_TO_SIDE_GOAL;
* }
- *
+ *
* double angleToTurn = Math.atan(distToTower / horizontalDistToGoal);
- *
+ *
* return angleToTurn;
* }
*/
public class PassLowBar extends CommandGroup {
public PassLowBar() {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
- addSequential(new DriveForTime(Constants.DeadReckoning.passLowBarTime,
- Constants.DeadReckoning.passLowBarSpeed));
+ if (Constants.Auton.isUsingTimeToPassDefense) {
+ addSequential(new DriveForTime(Constants.Auton.passLowBarTime,
+ Constants.Auton.passLowBarSpeed));
}
else {
addSequential(new DriveDistance(
- Constants.DeadReckoning.passLowBarDistance,
+ Constants.Auton.passLowBarDistance,
Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
}
}
public class PassMoat extends CommandGroup {
public PassMoat() {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
- addSequential(new DriveForTime(Constants.DeadReckoning.passMoatTime,
- Constants.DeadReckoning.passMoatSpeed));
+ if (Constants.Auton.isUsingTimeToPassDefense) {
+ addSequential(new DriveForTime(Constants.Auton.passMoatTime,
+ Constants.Auton.passMoatSpeed));
}
else {
- addSequential(new DriveDistance(Constants.DeadReckoning.passMoatDistance,
+ addSequential(new DriveDistance(Constants.Auton.passMoatDistance,
Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
}
public PassRampart() {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
- addSequential(new DriveForTime(Constants.DeadReckoning.passRockWallTime,
- Constants.DeadReckoning.passRockWallSpeed));
+ if (Constants.Auton.isUsingTimeToPassDefense) {
+ addSequential(new DriveForTime(Constants.Auton.passRockWallTime,
+ Constants.Auton.passRockWallSpeed));
}
else {
addSequential(new DriveDistance(
- Constants.DeadReckoning.passRampartDistance,
+ Constants.Auton.passRampartDistance,
Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
}
public class PassRockWall extends CommandGroup {
public PassRockWall() {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
- addSequential(new DriveForTime(Constants.DeadReckoning.passRockWallTime,
- Constants.DeadReckoning.passRockWallSpeed));
+ if (Constants.Auton.isUsingTimeToPassDefense) {
+ addSequential(new DriveForTime(Constants.Auton.passRockWallTime,
+ Constants.Auton.passRockWallSpeed));
}
else {
addSequential(new DriveDistance(
- Constants.DeadReckoning.passRockWallDistance,
+ Constants.Auton.passRockWallDistance,
Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
}
public PassRoughTerrain() {
- if (Constants.DeadReckoning.isUsingTimeToPassDefense) {
- addSequential(new DriveForTime(Constants.DeadReckoning.passRockWallTime,
- Constants.DeadReckoning.passRockWallSpeed));
+ if (Constants.Auton.isUsingTimeToPassDefense) {
+ addSequential(new DriveForTime(Constants.Auton.passRockWallTime,
+ Constants.Auton.passRockWallSpeed));
}
else {
addSequential(new DriveDistance(
- Constants.DeadReckoning.passRoughTerrainDistance,
+ Constants.Auton.passRoughTerrainDistance,
Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
}
package org.usfirst.frc.team3501.robot.commands.driving;
-import org.usfirst.frc.team3501.robot.Constants.DeadReckoning;
+import org.usfirst.frc.team3501.robot.Constants;
import org.usfirst.frc.team3501.robot.Constants.Direction;
import org.usfirst.frc.team3501.robot.Robot;
}
public TurnForTime(double seconds, Direction direction) {
- this(seconds, direction, DeadReckoning.DEFAULT_SPEED);
+ this(seconds, direction, Constants.Auton.DEFAULT_SPEED);
}
@Override
}
/*
- * Checks the drive mode
+ * Checks the drive mode <<<<<<< 9728080f491e9fb09795494349dba1297f447c0f
*
* @return the current state of the robot in each state Average distance from
* both sides of tank drive for Encoder Mode Angle from the gyro in GYRO_MODE
+ * =======
+ *
+ * @return the current state of the robot in each state Average distance from
+ * both sides of tank drive for Encoder Mode Angle from the gyro in GYRO_MODE
+ * >>>>>>> Move all constants in DeadReckoning to Auton class because it makes
+ * more sense
*/
private double sensorFeedback() {
if (DRIVE_MODE == Constants.DriveTrain.ENCODER_MODE)
leftGearPiston.set(gear);
rightGearPiston.set(gear);
}
+
+ public void toggleTimeDeadReckoning() {
+ Constants.Auton.isUsingTimeToPassDefense = !Constants.Auton.isUsingTimeToPassDefense;
+ }
}