Skip to content

Commit

Permalink
fix: made gear ratios non-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnwilkes committed Jan 28, 2024
1 parent 33b1517 commit 671b55a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/team1540/robot2024/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ public static class Drivetrain {
public static final double MAX_ANGULAR_SPEED = MAX_LINEAR_SPEED / DRIVE_BASE_RADIUS;
}
public static class Indexer {
// TODO: fix these constants
public static final int INTAKE_ID = 0;
public static final int FEEDER_ID = 0;
public static final double FEEDER_KP = 0.0;
public static final double FEEDER_KI = 0.0;
public static final double FEEDER_KD = 0.0;
public static final double FEEDER_KS = 0.0;
public static final double FEEDER_KV = 0.0;
public static final double FEEDER_GEAR_RATIO = 0.0;
public static final double INTAKE_GEAR_RATIO = 0.0;
public static final double FEEDER_GEAR_RATIO = 1.0;
public static final double INTAKE_GEAR_RATIO = 1.0;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class IndexerIOInputs {
public double feederVoltage;
public double feederCurrentAmps;
public double feederVelocityRPM;
public boolean noteInIntake;
public boolean noteInIntake = false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class IndexerIOSim implements IndexerIO {

private final DCMotorSim intakeSim = new DCMotorSim(DCMotor.getNEO(1), INTAKE_GEAR_RATIO,0.025);
private final DCMotorSim feederSim = new DCMotorSim(DCMotor.getNEO(1), FEEDER_GEAR_RATIO,0.025);
private final SimDeviceSim beamBreakSim = new SimDeviceSim("Indexer Beam Break");
// private final SimDeviceSim beamBreakSim = new SimDeviceSim("Indexer Beam Break");
private final PIDController feederSimPID = new PIDController(FEEDER_KP, FEEDER_KI,FEEDER_KD);

@Override
Expand All @@ -27,10 +27,10 @@ public void updateInputs(IndexerIOInputs inputs) {
inputs.feederCurrentAmps = feederSim.getCurrentDrawAmps();
// inputs.feederVoltage = feederSim.getBusVoltage() * feederSim.getAppliedOutput();
inputs.feederVelocityRPM = feederSim.getAngularVelocityRPM();
inputs.noteInIntake = beamBreakSim.getBoolean("Indexer Beam Break").get();
// inputs.noteInIntake = beamBreakSim.getBoolean("Indexer Beam Break").get();

// this is a very funny line of code, and absolutely does not belong here, but I don't know how to do this otherwise
feederSim.setState(feederSim.getAngularPositionRad(), feederSimPID.calculate(feederSim.getAngularVelocityRadPerSec()));
feederSim.setState(feederSim.getAngularPositionRad(), feederSimPID.calculate(feederSim.getAngularVelocityRadPerSec()));

}

Expand Down

0 comments on commit 671b55a

Please sign in to comment.