Skip to content

Commit f28ed1b

Browse files
authored
Merge pull request #296 from thedropbears/make_reef_intake_safer
limit safing to longitudinal velocity
2 parents 75982f8 + 4c49930 commit f28ed1b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

components/chassis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ def drive_local(self, vx: float, vy: float, omega: float) -> None:
381381
"""Robot oriented drive commands"""
382382
self.chassis_speeds = ChassisSpeeds(vx, vy, omega)
383383

384+
def limit_to_longitudinal_velocity(self) -> None:
385+
self.chassis_speeds.vy = 0.0
386+
self.chassis_speeds.omega = 0.0
387+
384388
def snap_to_heading(self, heading: float) -> None:
385389
"""set a heading target for the heading controller"""
386390
self.snapping_to_heading = True

controllers/reef_intake.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ def safing(self, initial_call: bool):
9999
robot_pose.translation()
100100
)
101101

102+
if not wpilib.DriverStation.isAutonomous() and distance < self.RETREAT_DISTANCE:
103+
self.chassis.limit_to_longitudinal_velocity()
104+
102105
if (
103106
distance >= self.RETREAT_DISTANCE
104107
and not self.algae_measurement.is_executing

0 commit comments

Comments
 (0)