File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ class ClimberComponent:
1818 winch_voltage = tunable (12.0 )
1919
2020 def __init__ (self ) -> None :
21- self .has_deployed = False
2221 self .START_ANGLE = - 30.0
2322 self .DEPLOY_ANGLE = 11.0
2423 self .RETRACT_ANGLE = - 52.0
@@ -51,7 +50,6 @@ def __init__(self) -> None:
5150
5251 def on_disable (self ) -> None :
5352 self .update_pid = True
54- self .has_deployed = False
5553 self .go_to_neutral ()
5654
5755 def stop (self ) -> None :
@@ -73,8 +71,7 @@ def go_to_deploy(self) -> None:
7371 self .set_angle (math .radians (self .DEPLOY_ANGLE ))
7472
7573 def go_to_retract (self ) -> None :
76- if self .has_deployed :
77- self .set_angle (math .radians (self .RETRACT_ANGLE ))
74+ self .set_angle (math .radians (self .RETRACT_ANGLE ))
7875
7976 @feedback
8077 def raw_encoder_val (self ) -> float :
Original file line number Diff line number Diff line change @@ -14,13 +14,18 @@ class ClimberStateMachine(StateMachine):
1414 chassis : ChassisComponent
1515
1616 def __init__ (self ):
17+ self .has_deployed = False
1718 self .heading_to_cage = 0.0
1819
20+ def on_disable (self ) -> None :
21+ self .has_deployed = False
22+
1923 def deploy (self ) -> None :
2024 self .engage ("deploying" )
2125
2226 def retract (self ) -> None :
23- self .engage ("retracting" , force = True )
27+ if self .has_deployed :
28+ self .engage ("retracting" , force = True )
2429
2530 @state (first = True , must_finish = True )
2631 def deploying (self , initial_call ) -> None :
@@ -30,6 +35,7 @@ def deploying(self, initial_call) -> None:
3035
3136 if self .climber .is_deployed ():
3237 self .climber .stop_pid_update ()
38+ self .has_deployed = True
3339
3440 cage_positions = cage_pos (is_red ())
3541 closest_cage_position = cage_positions [0 ]
You can’t perform that action at this time.
0 commit comments