> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nullftc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Using inside OpModes

> CommandKit, a powerful toolkit for building FTC command-based robots.

Using CommandKit inside OpModes is straightforward. The library provides a set of **pre-built commands** that you can combine and extend to build complex robot behaviors.

These commands are designed to be flexible and familiar — especially if you’ve used other command-based frameworks like FTCLib.

***

## Built-In Commands

| Command Name               | Description                                                                      |
| -------------------------- | -------------------------------------------------------------------------------- |
| **ConditionalCommand**     | Runs one of two commands depending on a condition.                               |
| **DeadlineCommandGroup**   | Runs multiple commands in parallel, ending when *one specific command* finishes. |
| **ParallelCommandGroup**   | Runs multiple commands in parallel until *all* of them finish.                   |
| **ParallelRaceGroup**      | Runs multiple commands in parallel, but ends when *any* command finishes.        |
| **ProxyCommand**           | Defers command creation until runtime, useful for dynamic behaviors.             |
| **RepeatCommand**          | Repeats a command a given number of times (or indefinitely).                     |
| **RunnableCommand**        | Wraps a lambda or function as a one-off command.                                 |
| **SequentialCommandGroup** | Runs a list of commands in sequence, one after the other.                        |
| **SwitchCommand**          | Chooses which command to run at runtime based on a key or condition.             |
| **WaitCommand**            | Waits for a fixed amount of time before finishing.                               |
| **WaitUntilCommand**       | Waits until a condition is met before finishing.                                 |

***

These building blocks let you focus on describing *what your robot should do*, instead of writing boilerplate control logic for every loop in your OpMode.

***

## Command-Based OpModes

CommandKit ships with generic command-based extensions of the default FTC `LinearOpMode`.
If you don’t want to create your own abstract OpMode base, you can use one of these directly:

* **`CommandOpMode`** – A Java-friendly base OpMode that integrates with the `CommandScheduler`.
* **`DSLOpMode`** – A Kotlin-friendly base OpMode that provides a DSL for defining and scheduling commands.

***

## Example OpModes

<CodeGroup dropdown>
  ```java theme={null}
  @Autonomous(name = "ExampleAuto", group = "CommandKit")
  public class ExampleAuto extends CommandOpMode {

      @Override
      public void prerun() {
          telemetry.addLine("Initialized, waiting for start...");
          telemetry.update();
      }

      @Override
      public void run() {
          Command autoSequence = new SequentialCommandGroup(
              new RunnableCommand(() -> {
                  telemetry.addLine("Step 1: Drive forward");
                  telemetry.update();
              }, true),
              new WaitCommand(2 * 1000),
              new RunnableCommand(() -> {
                  telemetry.addLine("Step 2: Turn right");
                  telemetry.update();
              }, true),
              new WaitCommand(1.5 * 1000),
              new RunnableCommand(() -> {
                  telemetry.addLine("Step 3: Place game piece");
                  telemetry.update();
              }, true)
          );

          schedule(autoSequence);
      }

      @Override
      public void end() {
          telemetry.addLine("Autonomous finished!");
          telemetry.update();
      }
  }
  ```

  ```kt theme={null}
  @Autonomous(name = "ExampleAutoDSL")
  class ExampleAutoDSL : DSLOpMode({
      +series(
          instant {
              telemetry.addLine("Step 1: Drive forward")
              telemetry.update()
          },
          wait(2.0),
          instant {
              telemetry.addLine("Step 2: Turn right")
              telemetry.update()
          },
          wait(1.5),
          instant {
              telemetry.addLine("Step 3: Place game piece")
              telemetry.update()
          }
      )
  })
  ```
</CodeGroup>

We do not provide built-in Gamepad support. This is intentional: we want you to have complete control over your gamepad mappings and configurations.

Every team’s needs are different. You might want multiple gamepad layers, custom input handling, or integration with coroutines. By leaving this open-ended, CommandKit allows you to build a custom gamepad extension tailored to your specific requirements.
