Skip to content

Commit

Permalink
slight name change to getCurrent methods in Gearbox
Browse files Browse the repository at this point in the history
  • Loading branch information
narmstro2020 committed Nov 26, 2024
1 parent 844135e commit 0d048de
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public double getCurrentDrawAmps() {
double kV = -m_plant.getA().get(1, 1) * kA;
double motorVelocityRadPerSec = m_x.get(1, 0) * kV * m_gearbox.dcMotor.kv.baseUnitMagnitude();
var appliedVoltage = m_u.get(0, 0);
return m_gearbox.getCurrentAmps(
return m_gearbox.getNetCurrentAmps(
m_gearbox.getTorqueNewtonMeters(motorVelocityRadPerSec, appliedVoltage))
* Math.signum(appliedVoltage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public double getTorqueNewtonMeters() {
* @return The flywheel's net current draw.
*/
public double getCurrentDrawAmps() {
return m_gearbox.getCurrentAmps(getTorqueNewtonMeters()) * Math.signum(m_u.get(0, 0));
return m_gearbox.getNetCurrentAmps(getTorqueNewtonMeters()) * Math.signum(m_u.get(0, 0));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public double getTorqueNewtonMeters() {
* @return The Gearbox's net current draw.
*/
public double getCurrentDrawAmps() {
return m_gearbox.getCurrentAmps(getTorqueNewtonMeters()) * Math.signum(m_u.get(0, 0));
return m_gearbox.getNetCurrentAmps(getTorqueNewtonMeters()) * Math.signum(m_u.get(0, 0));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public double getCurrentDrawAmps() {
// Reductions are greater than 1, so a reduction of 10:1 would mean the motor is
// spinning 10x faster than the output
var motorVelocity = m_x.get(1, 0) * m_gearbox.getGearboxReduction();
return m_gearbox.getCurrentAmps(
return m_gearbox.getNetCurrentAmps(
m_gearbox.getTorqueNewtonMeters(motorVelocity, m_u.get(0, 0)) * Math.signum(m_u.get(0, 0)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public Torque getTorque(AngularVelocity angularVelocity, Voltage voltageInput) {
* @param torqueNewtonMeters The torque produced by the gearbox.
* @return The net current drawn by the all of the motors.
*/
public double getCurrentAmps(double torqueNewtonMeters) {
public double getNetCurrentAmps(double torqueNewtonMeters) {
return numMotors * dcMotor.getCurrentAmps(torqueNewtonMeters / numMotors / gearboxReduction);
}

Expand All @@ -204,7 +204,7 @@ public double getCurrentAmps(double torqueNewtonMeters) {
* @param torque The torque produced by the gearbox.
* @return The net current drawn by the all of the motors.
*/
public Current getCurrent(Torque torque) {
return current.mut_setBaseUnitMagnitude(getCurrentAmps(torque.baseUnitMagnitude()));
public Current getNetCurrent(Torque torque) {
return current.mut_setBaseUnitMagnitude(getNetCurrentAmps(torque.baseUnitMagnitude()));
}
}

0 comments on commit 0d048de

Please sign in to comment.