Skip to content

Commit

Permalink
only allow task abortion incase of stall during auto
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalsheth committed Mar 8, 2018
1 parent 9754b85 commit 8bcb19c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.lynbrookrobotics.potassium.control.offload.OffloadedSignal
import com.lynbrookrobotics.potassium.streams.Stream
import com.lynbrookrobotics.potassium.tasks.Task
import com.lynbrookrobotics.potassium.{Component, Signal}
import edu.wpi.first.wpilibj.RobotState
import squants.time.Seconds
import squants.{Each, Percent}

Expand Down Expand Up @@ -57,6 +58,7 @@ class DrivetrainComponent(coreTicks: Stream[Unit])(
},
props.get.deltaVelocityStallThreshold
)
.filter(_ => RobotState.isAutonomous)
.filter(_ > props.get.stallTimeout)
.foreach { time =>
println(s"[ERROR] LEFT SIDE OF DRIVETRAIN STALLED FOR $time. ABORTING TASK.")
Expand All @@ -70,6 +72,7 @@ class DrivetrainComponent(coreTicks: Stream[Unit])(
},
props.get.deltaVelocityStallThreshold
)
.filter(_ => RobotState.isAutonomous)
.filter(_ > props.get.stallTimeout)
.foreach { time =>
println(s"[ERROR] RIGHT SIDE OF DRIVETRAIN STALLED FOR $time. ABORTING TASK.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.lynbrookrobotics.potassium.control.offload.OffloadedSignal.OpenLoop
import com.lynbrookrobotics.potassium.streams.Stream
import com.lynbrookrobotics.potassium.tasks.Task
import com.lynbrookrobotics.potassium.{Component, Signal}
import edu.wpi.first.wpilibj.RobotState
import squants.electro.Volts
import squants.{Each, Percent}

Expand All @@ -23,6 +24,7 @@ class CubeLiftComp(val coreTicks: Stream[Unit])(implicit hardware: CubeLiftHardw
hardware.currentDraw,
props.get.maxCurrentDraw
)
.filter(_ => RobotState.isAutonomous)
.filter(_ > props.get.stallTimeout)
.foreach { stallTime =>
println(s"[ERROR] CUBE LIFT STALLED FOR $stallTime. ABORTING TASK.")
Expand Down

0 comments on commit 8bcb19c

Please sign in to comment.