Skip to content

Commit

Permalink
Auton now reliably scores gears; PID changes, offset value changes,
Browse files Browse the repository at this point in the history
shooter PID
  • Loading branch information
Mercury 1089 committed Nov 8, 2017
1 parent aa5f4b6 commit f56f66f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/org/usfirst/frc/team1089/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.usfirst.frc.team1089.robot.auton.AutonPosition;
import org.usfirst.frc.team1089.robot.auton.AutonSecondAction;
import org.usfirst.frc.team1089.robot.auton.AutonSecondMovement;
import org.usfirst.frc.team1089.robot.commands.AutoAlign;
import org.usfirst.frc.team1089.robot.commands.AutoShoot;
import org.usfirst.frc.team1089.robot.commands.BasicGearDelivery;
import org.usfirst.frc.team1089.robot.commands.CalibrateGyro;
import org.usfirst.frc.team1089.robot.commands.DriveWithJoysticks;
Expand Down Expand Up @@ -128,8 +130,8 @@ public OI() {
start = new JoystickButton(gamePad, RobotMap.GamepadButtons.START);
start.whenPressed(new CalibrateGyro());

//rightStick1 = new JoystickButton(rightStick, RobotMap.JoystickButtons.BTN1);
//rightStick1.whenPressed(new AutoAlign(TargetType.HIGH_GOAL));
rightStick1 = new JoystickButton(rightStick, RobotMap.JoystickButtons.BTN1);
rightStick1.whenPressed(new AutoShoot());

leftStick1 = new JoystickButton(leftStick, RobotMap.JoystickButtons.BTN1);
leftStick1.whenPressed(new BasicGearDelivery());
Expand All @@ -146,7 +148,7 @@ public OI() {
leftStick7 = new JoystickButton(leftStick, RobotMap.JoystickButtons.BTN7);
leftStick7.whenPressed(new RunClimber(false));

/* rightStick3 = new JoystickButton(rightStick, RobotMap.JoystickButtons.BTN3);
/*rightStick3 = new JoystickButton(rightStick, RobotMap.JoystickButtons.BTN3);
rightStick3.whenPressed(new AutoAlign(TargetType.HIGH_GOAL));*/

rightStick6 = new JoystickButton(rightStick, RobotMap.JoystickButtons.BTN6);
Expand Down
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team1089/robot/commands/AutoAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public AutoAlign(TargetType t) {
// Called just before this Command runs the first time
protected void initialize() {
if (target.equals(TargetType.GEAR_VISION))
_heading = Robot.visionProcessor.angleGear - 6;
_heading = Robot.visionProcessor.angleGear - 5;
else if (target.equals(TargetType.HIGH_GOAL))
_heading = Robot.visionProcessor.angleHigh;
_heading = Robot.visionProcessor.angleHigh - 3;
else
_heading = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DegreeRotate extends PIDCommand {
private final double MIN_PERCENT_VBUS = 0.15;

protected DegreeRotate() {
super(0.195, 0.0008, 0.0);
super(0.460, 0.002, 0.0); //super(0.195 -> 0.225 -> 0.260 -> 0.360, 0.0008 -> 0.001 -> 0.002, 0.0);
_heading = 0.0;
requires(Robot.driveTrain);
LiveWindow.addActuator("Robot.driveTrain", "DegreeRotate", getPIDController());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public RunAllShooters() {
// arm.

this.addParallel(new ShootWithDistance(Robot.leftShooter, new BoilerTargetProvider(Robot.visionProcessor)));
//this.addParallel(new ShootWithDistance(Robot.rightShooter, new BoilerTargetProvider(Robot.visionProcessor)));
this.addParallel(new ShootWithDistance(Robot.rightShooter, new BoilerTargetProvider(Robot.visionProcessor)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ protected void execute() {

if ( distance >= 6 && distance <= 14) {
speed = -0.00283*Math.pow(distance, 2)+0.914*distance+16.926; //temporary, will work for 12 ft and under
speed = speed/29.1585 * 3600; //XXX Attempt at converting big boy to little enc
speed = speed/29.1585 * 3600; //XXX Attempt at converting big boy to little enc
speed = speed + 100; //Offset value
} else {
speed = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public double getAverageDistanceToGearTargetsHorizontal() {
}

public double getAdjustedAverageDistanceToGearTargetsHorizontal() {
return -(getAverageDistanceToGearTargetsHorizontal() - 0.5);
return -(getAverageDistanceToGearTargetsHorizontal() - 0.5 - 0.25);
}

public boolean isOnTarget(TargetType target) {
Expand Down

0 comments on commit f56f66f

Please sign in to comment.