Skip to content

Commit dff4a60

Browse files
james-wardLucienMorey
authored andcommitted
Check wrist is stationary at setpoint
1 parent 95d12bd commit dff4a60

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/wrist.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class WristComponent:
2727
12.0 / 20.0
2828
) * 350.628 # not remeasured and just adjusted by the change in gear reduction
2929
TOLERANCE = math.radians(3.0)
30+
VEL_TOLERANCE = 0.05
3031

3132
def __init__(self, mech_root: wpilib.MechanismRoot2d):
3233
self.wrist_ligament = mech_root.appendLigament(
@@ -122,7 +123,9 @@ def at_setpoint(self) -> bool:
122123
return (
123124
abs(self.desired_state.position - self.inclination())
124125
< WristComponent.TOLERANCE
125-
)
126+
) and abs(
127+
self.desired_state.velocity - self.current_velocity()
128+
) < WristComponent.VEL_TOLERANCE
126129

127130
def tilt_to(self, pos: float) -> None:
128131
clamped_angle = clamp(pos, self.MAXIMUM_DEPRESSION, self.MAXIMUM_ELEVATION)

0 commit comments

Comments
 (0)