fixed issue - two flywheel instances created a conflict
This commit is contained in:
@@ -70,6 +70,7 @@ public class NewShooterTest extends LinearOpMode {
|
||||
robot.setHoodPos(hoodPos);
|
||||
shooter.setTurretPosition(turretPos);
|
||||
shooter.setFlywheelVelocity(flywheel);
|
||||
rpmFlywheel.manageFlywheel(shooter.getFlywheelVelocity());
|
||||
double voltage = robot.voltage.getVoltage();
|
||||
rpmFlywheel.setPIDF(shooterP, shooterI, shooterD, shooterF / voltage);
|
||||
|
||||
@@ -132,6 +133,7 @@ public class NewShooterTest extends LinearOpMode {
|
||||
TELE.addData("Flywheel Velocity2", (robot.shooter2.getVelocity() * 60) / 28);
|
||||
TELE.addData("Flywheel Averag Velocity", rpmFlywheel.getAverageVelocity());
|
||||
TELE.addData("PIDF Coefficients", Flywheel.shooterPIDF);
|
||||
TELE.addData("Power", rpmFlywheel.getShooterPower());
|
||||
TELE.update();
|
||||
|
||||
shooter.update();
|
||||
|
||||
@@ -107,6 +107,7 @@ public class Flywheel {
|
||||
averageVelocity = sum / velocityHistory.size();
|
||||
}
|
||||
|
||||
double power;
|
||||
public void manageFlywheel(double commandedVelocity) {
|
||||
|
||||
if (Math.abs(targetVelocity - commandedVelocity) > 0.0001) {
|
||||
@@ -114,7 +115,7 @@ public class Flywheel {
|
||||
}
|
||||
|
||||
robot.shooter1.setVelocity(RPM_to_TPS(targetVelocity));
|
||||
double power = robot.shooter1.getPower();
|
||||
power = robot.shooter1.getPower();
|
||||
robot.shooter2.setPower(power);
|
||||
|
||||
velo1 = TPS_to_RPM(robot.shooter1.getVelocity());
|
||||
@@ -127,4 +128,5 @@ public class Flywheel {
|
||||
|
||||
steady = (Math.abs(commandedVelocity - averageVelocity) < 50);
|
||||
}
|
||||
public double getShooterPower(){return power;}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class Shooter {
|
||||
public void setFlywheelVelocity(double input) {
|
||||
this.flywheelVelocity = input;
|
||||
}
|
||||
|
||||
public double getFlywheelVelocity(){return this.flywheelVelocity;}
|
||||
public int getObeliskID() {
|
||||
return turr.getObeliskID();
|
||||
}
|
||||
@@ -80,7 +80,6 @@ public class Shooter {
|
||||
case NOTHING:
|
||||
break;
|
||||
case MANUAL:
|
||||
fly.manageFlywheel(flywheelVelocity);
|
||||
turr.manual(turretPosition);
|
||||
break;
|
||||
case TRACK_GOAL:
|
||||
@@ -104,7 +103,6 @@ public class Shooter {
|
||||
follow.getAcceleration().getYComponent()
|
||||
);
|
||||
|
||||
fly.manageFlywheel(flywheelVelocity);
|
||||
break;
|
||||
case READ_OBELISK:
|
||||
turr.trackObelisk(
|
||||
@@ -122,7 +120,6 @@ public class Shooter {
|
||||
follow.getAcceleration().getYComponent()
|
||||
);
|
||||
|
||||
fly.manageFlywheel(flywheelVelocity);
|
||||
break;
|
||||
|
||||
case MANUAL_TURRET_TRACK_FLY:
|
||||
@@ -136,7 +133,6 @@ public class Shooter {
|
||||
follow.getAcceleration().getYComponent()
|
||||
);
|
||||
|
||||
fly.manageFlywheel(flywheelVelocity);
|
||||
break;
|
||||
|
||||
case MANUAL_FLYWHEEL_TRACK_TURR:
|
||||
@@ -150,7 +146,6 @@ public class Shooter {
|
||||
follow.getVelocity().getYComponent(),
|
||||
follow.getAcceleration().getYComponent()
|
||||
);
|
||||
fly.manageFlywheel(flywheelVelocity);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user