Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions command-base/command-system/robot-and-commandopmode.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,27 @@ public void initialize() {
```

That is functionally all that needs to be done, everything else is done for the user internally. You can find a sample project utilizing CommandOpMode [here](https://github.com/FTC-23511/SolversLib/blob/master/examples/src/main/java/org/firstinspires/ftc/teamcode/PurePursuitSample.java).

## Running Commands in Init And Run

If you would like to run different commands in init compared to run then you can override the `preRun()` method like so. This is commonly used to home motors.

```java
// in your implementation of CommandOpMode
@Override
public void initialize() {


// Commands to run during init, commonly homing motors
schedule(new HomeCommand());
}

@Override
public void preRun() {
// Cancel any commands left over from init stage
super.reset();

// Schedule commands to execute during run
schedule(new DriveCommand());
}
```