mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[sim] Create Left/Right drivetrain current accessors (#3001)
This commit is contained in:
@@ -201,18 +201,26 @@ public class DifferentialDrivetrainSim {
|
||||
return getOutput(State.kLeftVelocity);
|
||||
}
|
||||
|
||||
public double getCurrentDrawAmps() {
|
||||
public double getLeftCurrentDrawAmps() {
|
||||
var loadIleft = m_motor.getCurrent(
|
||||
getState(State.kLeftVelocity) * m_currentGearing / m_wheelRadiusMeters,
|
||||
m_u.get(0, 0)) * Math.signum(m_u.get(0, 0));
|
||||
return loadIleft;
|
||||
}
|
||||
|
||||
public double getRightCurrentDrawAmps() {
|
||||
var loadIright = m_motor.getCurrent(
|
||||
getState(State.kRightVelocity) * m_currentGearing / m_wheelRadiusMeters,
|
||||
m_u.get(1, 0)) * Math.signum(m_u.get(1, 0));
|
||||
|
||||
return loadIleft + loadIright;
|
||||
return loadIright;
|
||||
}
|
||||
|
||||
public double getCurrentDrawAmps() {
|
||||
return getLeftCurrentDrawAmps() + getRightCurrentDrawAmps();
|
||||
}
|
||||
|
||||
|
||||
public double getCurrentGearing() {
|
||||
return m_currentGearing;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user