mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] ElevatorSim: Fix WouldHitLimit methods (#5057)
This commit is contained in:
@@ -41,11 +41,11 @@ ElevatorSim::ElevatorSim(const DCMotor& gearbox, double gearing,
|
||||
m_simulateGravity(simulateGravity) {}
|
||||
|
||||
bool ElevatorSim::WouldHitLowerLimit(units::meter_t elevatorHeight) const {
|
||||
return elevatorHeight < m_minHeight;
|
||||
return elevatorHeight <= m_minHeight;
|
||||
}
|
||||
|
||||
bool ElevatorSim::WouldHitUpperLimit(units::meter_t elevatorHeight) const {
|
||||
return elevatorHeight > m_maxHeight;
|
||||
return elevatorHeight >= m_maxHeight;
|
||||
}
|
||||
|
||||
bool ElevatorSim::HasHitLowerLimit() const {
|
||||
|
||||
@@ -162,7 +162,7 @@ public class ElevatorSim extends LinearSystemSim<N2, N1, N1> {
|
||||
* @return Whether the elevator would hit the lower limit.
|
||||
*/
|
||||
public boolean wouldHitLowerLimit(double elevatorHeightMeters) {
|
||||
return elevatorHeightMeters < this.m_minHeight;
|
||||
return elevatorHeightMeters <= this.m_minHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ public class ElevatorSim extends LinearSystemSim<N2, N1, N1> {
|
||||
* @return Whether the elevator would hit the upper limit.
|
||||
*/
|
||||
public boolean wouldHitUpperLimit(double elevatorHeightMeters) {
|
||||
return elevatorHeightMeters > this.m_maxHeight;
|
||||
return elevatorHeightMeters >= this.m_maxHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user