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