Class LambdaModule

java.lang.Object
com.cdarobotics.cdalib.opmodes.modules.Module
com.cdarobotics.cdalib.opmodes.modules.LambdaModule

public class LambdaModule extends Module
A Module whose four lifecycle phases (init/start/loop/stop) are supplied as lambdas, for quick inline behavior without declaring a dedicated module class.
  • Constructor Details

    • LambdaModule

      public LambdaModule(Runnable init, Runnable start, Runnable loop, Runnable stop)
      Parameters:
      init - runs once on OpMode init
      start - runs once when the OpMode starts
      loop - runs every loop
      stop - runs once when the OpMode ends
  • Method Details

    • init

      public void init()
      Description copied from class: Module
      Called once when the OpMode initializes.
      Specified by:
      init in class Module
    • init_loop

      public void init_loop()
      No-op; LambdaModule has no init-loop lambda.
      Specified by:
      init_loop in class Module
    • start

      public void start()
      Description copied from class: Module
      Called once when the OpMode starts (play pressed).
      Specified by:
      start in class Module
    • loop

      public void loop()
      Description copied from class: Module
      Called every loop.
      Specified by:
      loop in class Module
    • stop

      public void stop()
      Description copied from class: Module
      Called once when the OpMode ends.
      Specified by:
      stop in class Module