EarlyLambda
vectorlib::EarlyLambda — fields, methods, parameters and return types.
pub struct EarlyLambdaTitanTron's earlyLambda: a callback a motion runs once, in its own task, the first time
the robot gets within the parameter struct's early_lambda_range.
LemLib-TitanTron takes a std::function<void()> and starts it with new pros::Task(...),
so it can block (pros::delay) without stalling the motion. The vexide equivalent of a
task is a future, so the callback returns one:
chassis
.move_to_point(0.0, 48.0, 4000)
.early_lambda_range(12.0)
.early_lambda(move || async move { println!("12 inches out") })
.await;Methods
Prop
Type
new
pub fn new<F, Fut>(f: F) -> Self
where
F: Fn() -> Fut + 'static,
Fut: Future<Output = ()> + 'static,Wrap a closure that produces the future to run.
Parameters
Prop
Type
Returns
Self