@@ -25,7 +25,7 @@ class WristComponent:
2525 COM_DIFFERENCE = 0.54722467321
2626 MAXIMUM_DEPRESSION = math .radians (- 112.0 ) + COM_DIFFERENCE
2727 MAXIMUM_ELEVATION = math .radians (0 ) + COM_DIFFERENCE
28- NEUTRAL_ANGLE = math .radians (- 90.0 ) + COM_DIFFERENCE
28+ NEUTRAL_ANGLE = math .radians (- 90.0 )
2929
3030 WRIST_MAX_VEL = math .radians (180.0 )
3131 WRIST_MAX_ACC = math .radians (360.0 )
@@ -123,7 +123,7 @@ def inclination_deg(self) -> float:
123123 return math .degrees (self .inclination ())
124124
125125 @feedback
126- def test_inclination (self ) -> float :
126+ def shooter_FOR_inclination (self ) -> float :
127127 return math .degrees (self .inclination () - self .COM_DIFFERENCE )
128128
129129 @feedback
@@ -143,6 +143,18 @@ def at_setpoint(self) -> bool:
143143 self .desired_state .velocity - self .current_velocity ()
144144 ) < WristComponent .VEL_TOLERANCE
145145
146+ # Tilts to an angle with regards to the shooter frame of reference.
147+ # Shooter FOR takes the arm as in-line with the backplate of the shooter
148+ # SHould be called with angles in the shooter FOR
149+ def tilt_to_shooter_FOR (self , pos : float ) -> None :
150+ clamped_angle = clamp (
151+ (pos + self .COM_DIFFERENCE ), self .MAXIMUM_DEPRESSION , self .MAXIMUM_ELEVATION
152+ )
153+ # If the new setpoint is within the tolerance we wouldn't move anyway
154+ if abs (clamped_angle - self .desired_state .position ) > self .TOLERANCE :
155+ self ._tilt_to (clamped_angle )
156+
157+ # Tilts to an angle with respect to the COM FOR
146158 def tilt_to (self , pos : float ) -> None :
147159 clamped_angle = clamp (pos , self .MAXIMUM_DEPRESSION , self .MAXIMUM_ELEVATION )
148160
@@ -160,7 +172,7 @@ def _tilt_to(self, pos: float):
160172 )
161173
162174 def go_to_neutral (self ) -> None :
163- self .tilt_to (WristComponent .NEUTRAL_ANGLE )
175+ self .tilt_to_shooter_FOR (WristComponent .NEUTRAL_ANGLE )
164176
165177 @feedback
166178 def at_limit (self ) -> bool :
@@ -178,9 +190,7 @@ def execute(self) -> None:
178190 self .pid .calculate (self .inclination (), tracked_state .position ) + ff
179191 )
180192
181- self .wrist_ligament .setAngle (
182- self .inclination_deg () - math .degrees (WristComponent .COM_DIFFERENCE )
183- )
193+ self .wrist_ligament .setAngle (self .shooter_FOR_inclination ())
184194
185195 self .wrist_COM_ligament .setAngle (self .inclination_deg ())
186196 # self.wrist_ligament.setAngle(math.degrees(desired_state.position))
0 commit comments