Skip to content

Commit f501fe6

Browse files
committed
move stationary check to chassis and add rotational velocity
1 parent 21562c4 commit f501fe6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

components/chassis.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,15 @@ def stop_snapping(self) -> None:
390390
"""stops the heading_controller"""
391391
self.snapping_to_heading = False
392392

393+
@feedback
394+
def is_stationary(self) -> bool:
395+
velocity = self.get_velocity()
396+
return (
397+
math.isclose(velocity.vx, 0.0)
398+
and math.isclose(velocity.vy, 0.0)
399+
and math.isclose(velocity.omega, 0.0)
400+
)
401+
393402
def execute(self) -> None:
394403
# rotate desired velocity to compensate for skew caused by discretization
395404
# see https://www.chiefdelphi.com/t/field-relative-swervedrive-drift-even-with-simulated-perfect-modules/413892/

controllers/algae_shooter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def preparing(self):
6161
self.wrist.at_setpoint()
6262
and self.shooter_component.top_flywheels_up_to_speed()
6363
and self.shooter_component.bottom_flywheels_up_to_speed()
64-
and math.isclose(self.chassis.get_velocity().vx, 0)
65-
and math.isclose(self.chassis.get_velocity().vy, 0)
64+
and self.chassis.is_stationary()
6665
):
6766
self.next_state(self.shooting)
6867

0 commit comments

Comments
 (0)