Skip to content

Commit

Permalink
[wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amquake authored Nov 5, 2022
1 parent 64a7136 commit 2c20fd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public SingleJointedArmSim(
* @return Whether the arm would hit the lower limit.
*/
public boolean wouldHitLowerLimit(double currentAngleRads) {
return currentAngleRads < this.m_minAngle;
return currentAngleRads <= this.m_minAngle;
}

/**
Expand All @@ -187,7 +187,7 @@ public boolean wouldHitLowerLimit(double currentAngleRads) {
* @return Whether the arm would hit the upper limit.
*/
public boolean wouldHitUpperLimit(double currentAngleRads) {
return currentAngleRads > this.m_maxAngle;
return currentAngleRads >= this.m_maxAngle;
}

/**
Expand Down

0 comments on commit 2c20fd0

Please sign in to comment.