[wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#4567)

This commit is contained in:
amquake
2022-11-04 17:14:46 -07:00
committed by GitHub
parent 64a7136e08
commit 2c20fd0d09
2 changed files with 4 additions and 4 deletions

View File

@@ -40,11 +40,11 @@ SingleJointedArmSim::SingleJointedArmSim(
simulateGravity, measurementStdDevs) {}
bool SingleJointedArmSim::WouldHitLowerLimit(units::radian_t armAngle) const {
return armAngle < m_minAngle;
return armAngle <= m_minAngle;
}
bool SingleJointedArmSim::WouldHitUpperLimit(units::radian_t armAngle) const {
return armAngle > m_maxAngle;
return armAngle >= m_maxAngle;
}
bool SingleJointedArmSim::HasHitLowerLimit() const {

View File

@@ -177,7 +177,7 @@ public class SingleJointedArmSim extends LinearSystemSim<N2, N1, N1> {
* @return Whether the arm would hit the lower limit.
*/
public boolean wouldHitLowerLimit(double currentAngleRads) {
return currentAngleRads < this.m_minAngle;
return currentAngleRads <= this.m_minAngle;
}
/**
@@ -187,7 +187,7 @@ public class SingleJointedArmSim extends LinearSystemSim<N2, N1, N1> {
* @return Whether the arm would hit the upper limit.
*/
public boolean wouldHitUpperLimit(double currentAngleRads) {
return currentAngleRads > this.m_maxAngle;
return currentAngleRads >= this.m_maxAngle;
}
/**