private double turretOffset = 0.0;
private double distanceFromTarget = 0.0;
- private double shuttlingTOFMultiplier = 0.8;
// private double TOFAdjustment = 0.85;
// private double TOFAdjustment = 1.1;
* So we make a bunch of guesses until it converges
* Early exit when change < 1mm to avoid unnecessary iterations
*/
- boolean shuttling = target.equals(FieldConstants.getHubTranslation().toTranslation2d());
for (int i = 0; i < 20; i++) {
Translation3d lookahead3d = new Translation3d(lookaheadPose.getX(), lookaheadPose.getY(), TurretConstants.DISTANCE_FROM_ROBOT_CENTER.getZ());
Translation3d target3d = new Translation3d(target.getX(), target.getY(),
- shuttling ?
+ target.equals(FieldConstants.getHubTranslation().toTranslation2d()) ?
FieldConstants.getHubTranslation().getZ() : 0.0); // Height of 0 if it's not the hub
goalState = ShooterPhysics.getShotParams(
target3d.minus(lookahead3d),
2.0);
- if (!shuttling) {
- timeOfFlight = goalState.timeOfFlight() * TOFAdjustment.get();
- } else {
- double distance = target.getDistance(lookaheadPose.getTranslation());
- timeOfFlight = distance * shuttlingTOFMultiplier;
- }
-
+ timeOfFlight = goalState.timeOfFlight() * TOFAdjustment.get();
double offsetX = turretVelocityX * timeOfFlight;
double offsetY = turretVelocityY * timeOfFlight;
Pose2d newLookaheadPose =
turretOffset = SmartDashboard.getNumber("OPERATOR: Turret Offset", turretOffset);
SmartDashboard.putNumber("OPERATOR: Turret Offset", turretOffset);
- shuttlingTOFMultiplier = SmartDashboard.getNumber("Shuttling TOF Multiplier", shuttlingTOFMultiplier);
- SmartDashboard.putNumber("Shuttling TOF Multiplier", shuttlingTOFMultiplier);
-
if (phaseManager.isIdle()) {
underLadder();
} else {
// we can be less aggressive: y = 0.65 * (1.34959x + 9.79618)
// will likely be this that requires tuning.
shooterVelocityMap.put(0.0, 9.0);
- shooterVelocityMap.put(4.0, 12.0 * 1.3); // tuned
- shooterVelocityMap.put(8.0, 22.0 * 1.075); // tuned
- shooterVelocityMap.put(16.0, 44.0); // untuned
+ shooterVelocityMap.put(4.0, 12.8);
+ shooterVelocityMap.put(7.6, 19.0);
+ shooterVelocityMap.put(11.4, 28.1); // was 25.2 before
+ shooterVelocityMap.put(16.54, 44.8); // untested
// always shoot at low angle to ground.
- newHoodMap.put(0.0, 55.0);
- newHoodMap.put(27.99, 55.0);
+ newHoodMap.put(0.0, 60.0);
+ newHoodMap.put(27.99, 60.0);
}
}