Check gear ratio

This commit is contained in:
mimigamin
2026-03-18 13:39:27 -06:00
parent 86b36a687e
commit 85fe11c8bd
3 changed files with 16 additions and 14 deletions
@@ -7,12 +7,12 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = ""; public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "2026KPopRobotHunters"; public static final String MAVEN_NAME = "2026KPopRobotHunters";
public static final String VERSION = "unspecified"; public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 164; public static final int GIT_REVISION = 166;
public static final String GIT_SHA = "f4a42f02eed0fa3b0950a05da55174b9f4b89ce7"; public static final String GIT_SHA = "86b36a687e0338ed3ae5c6d035fb0f5b7404c27b";
public static final String GIT_DATE = "2026-03-14 20:39:45 MDT"; public static final String GIT_DATE = "2026-03-16 16:13:53 MDT";
public static final String GIT_BRANCH = "MiraOrg"; public static final String GIT_BRANCH = "MiraOrg";
public static final String BUILD_DATE = "2026-03-15 11:14:11 MDT"; public static final String BUILD_DATE = "2026-03-18 13:27:40 MDT";
public static final long BUILD_UNIX_TIME = 1773594851399L; public static final long BUILD_UNIX_TIME = 1773862060483L;
public static final int DIRTY = 1; public static final int DIRTY = 1;
private BuildConstants(){} private BuildConstants(){}
@@ -15,8 +15,8 @@ import frc4388.utility.status.CanDevice;
public class ShooterConstants { public class ShooterConstants {
// Motor conversions // Motor conversions
public static final double SHOOTERMOTOR_GEAR_RATIO = 1.5; public static final double SHOOTERMOTOR_GEAR_RATIO = 1.29; // TODO: supposed to be 9 rotations in to 7 out
public static final double INDEXER_GEAR_RATIO = 1.; public static final double INDEXER_GEAR_RATIO = 1.72; // TODO: change it is supposed to be 18 to 31
public static final double T_CONSTANT = 2; public static final double T_CONSTANT = 2;
public static final double SHOOTER_RADIUS = 2/39.37; public static final double SHOOTER_RADIUS = 2/39.37;
public static final double INDEXER_RADIUS = 0.625/39.37; public static final double INDEXER_RADIUS = 0.625/39.37;
@@ -25,6 +25,7 @@ public class ShooterConstants {
// public static final ConfigurableDouble SHOOTER_FEED_VELOCITY = new ConfigurableDouble("Shooter Feed Velocity", -35); // public static final ConfigurableDouble SHOOTER_FEED_VELOCITY = new ConfigurableDouble("Shooter Feed Velocity", -35);
// public static final ConfigurableDouble SHOOTER_RESTING_VELOCITY = new ConfigurableDouble("Shooter Resting Velocity", 0.0); // public static final ConfigurableDouble SHOOTER_RESTING_VELOCITY = new ConfigurableDouble("Shooter Resting Velocity", 0.0);
public static final ConfigurableDouble SHOOTER_IDLE_PERCENT_OUTPUT = new ConfigurableDouble("Shooter idle % output", -0.15); public static final ConfigurableDouble SHOOTER_IDLE_PERCENT_OUTPUT = new ConfigurableDouble("Shooter idle % output", -0.15);
// public static final ConfigurableDouble SHOOTER_IDLE_TARGET_VEL = new ConfigurableDouble("Shooter idle target velocity", 20.); // public static final ConfigurableDouble SHOOTER_IDLE_TARGET_VEL = new ConfigurableDouble("Shooter idle target velocity", 20.);
// public static final ConfigurableDouble SHOOTER_IDLE_MAX_CURRENT = new ConfigurableDouble("Shooter Idle max current", 10); // public static final ConfigurableDouble SHOOTER_IDLE_MAX_CURRENT = new ConfigurableDouble("Shooter Idle max current", 10);
@@ -411,10 +411,11 @@ public class SwerveDrive extends SubsystemBase implements Queryable {
if (ballVelocity > 1E-3 && Math.abs(chassisSpeeds.vyMetersPerSecond) > 1E-3){ if (ballVelocity > 1E-3 && Math.abs(chassisSpeeds.vyMetersPerSecond) > 1E-3){
double aimOffset = chassisSpeeds.vyMetersPerSecond*distanceToHub/(Math.abs(ballVelocity)); double aimOffset = chassisSpeeds.vyMetersPerSecond*distanceToHub/(Math.abs(ballVelocity));
// double aimOffset = (chassisSpeeds.vyMetersPerSecond * distanceToHub) / (Math.abs(ballVelocity) * Math.cos(Math.atan((-1.4478 - (2.8956 + 4 * (0.03724333 * distanceToHub + 0.64797583) - Math.sqrt(Math.pow(2.8956 + 4 * (0.03724333 * distanceToHub + 0.64797583), 2) - 8.3863)) / 2) / distanceToHub))); double aimOffsetComplext = (chassisSpeeds.vyMetersPerSecond * distanceToHub) / (Math.abs(ballVelocity) * Math.cos(Math.atan((-1.4478 - (2.8956 + 4 * (0.03724333 * distanceToHub + 0.64797583) - Math.sqrt(Math.pow(2.8956 + 4 * (0.03724333 * distanceToHub + 0.64797583), 2) - 8.3863)) / 2) / distanceToHub)));
fieldPos = new Translation2d(fieldPos.getX(), fieldPos.getY() - aimOffset); fieldPos = new Translation2d(fieldPos.getX(), fieldPos.getY() - aimOffset);
Logger.recordOutput("Offset", aimOffset); Logger.recordOutput("Offset Simple", aimOffset);
Logger.recordOutput("Offset Complex", aimOffsetComplext);
} }
@@ -532,11 +533,11 @@ public class SwerveDrive extends SubsystemBase implements Queryable {
vision.setLastOdomPose(state.currentPose); vision.setLastOdomPose(state.currentPose);
setLastOdomSpeed(state.currentPose, state.lastPose, state.odometryRate); setLastOdomSpeed(state.currentPose, state.lastPose, state.odometryRate);
// if (state.speeds != null) { if (state.speeds != null) {
// this.chassisSpeeds = state.speeds; this.chassisSpeeds = state.speeds;
// } else { } else {
// this.chassisSpeeds = new ChassisSpeeds(); this.chassisSpeeds = new ChassisSpeeds();
// } }
if (vision.isTag()) { if (vision.isTag()) {
Pose2d pose = vision.getPose2d(); Pose2d pose = vision.getPose2d();