Skip to content

Commit

Permalink
Add timeouts to lift operations
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinencounter committed Feb 19, 2024
1 parent 5d6d1df commit bbfa092
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class KOdometryDrive(

val correction = (kpFwd * pError + kiFwd * sumError) * switcher
// FIXME timeoutT.time()
val rampBase = ForwardingCurve.ramp(average, distInch - average)
val rampBase = ForwardingCurve.ramp(timeoutT.time(), distInch - average)

var afterFactor = 1.0
if (isCollisionPreventionViable) {
Expand All @@ -165,16 +165,6 @@ class KOdometryDrive(
val powers = speeds.map(Move::rampSpeedToPower).normalNoStretch()
lastPower = powers
powers.apply(driveMotors)

/* Log.i(
"KOD",
"SumOfError ${
String.format(
"%+.8f",
sumError
)
} in*sec ki=$kiFwd, Error ${String.format("%+.8f", pError)} kp=$kpFwd"
) */
}
isCompleted { -> complete || (timeout > 0 && timeoutT.time() >= timeout) }
onFinish { ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ private void scoreYellowPixel(MultitaskScheduler scheduler, RobotConfiguration r
});
e.isCompleted(() -> robot.liftLeft().getCurrentPosition() >= Var.AutoPositions.LiftScoring - 20);
TimingKt.minDuration(e, 100);
TimingKt.maxDuration(e, 3000);
return kvoid;
})
.then(xButton.approach(new InchUnit(3.0)))
Expand Down Expand Up @@ -495,6 +496,7 @@ public void run() {
});
e.isCompleted(() ->
!(robot.liftLeft().isBusy() || robot.liftRight().isBusy()));
TimingKt.maxDuration(e, 3000);
return kvoid;
});

Expand Down Expand Up @@ -527,6 +529,7 @@ public void run() {
});
e.isCompleted(() ->
!(robot.liftLeft().isBusy() || robot.liftRight().isBusy()));
TimingKt.maxDuration(e, 3000);
return kvoid;
});

Expand Down

0 comments on commit bbfa092

Please sign in to comment.