Skip to content

Commit 527781e

Browse files
committed
use proper requirements functions
1 parent 702af03 commit 527781e

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/nextftc/concepts/commands.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A command has four main components: `isDone`, `start`, `update`, and `stop`.
1414
Additionally, it has two more properties:
1515

1616
- `interruptible` determines whether or not the command is able to be interrupted. A command is interrupted when another command is scheduled that requires a subsystem the command is using. If a command is not interruptible, then the new command will not run.
17-
- `subsystems` is a set of all the subsystems a command uses. This is used for determing when two commands requrie the same subsystem. This is passed to the constructor of most premade commands.
17+
- `requirements` is the set of all the objects a command uses, which are most commonly [subsystems](/subsystems). This is used for determining when two commands require the same subsystem. This is passed to the constructor of most premade commands.
1818

1919
## Creating Commands
2020

@@ -29,10 +29,10 @@ A lambda command is the main way to create a command in NextFTC. A lambda comman
2929

3030
```kotlin
3131
val myLambdaCommand = LambdaCommand()
32-
.setStart {
32+
.setStart {
3333
// Runs on start
3434
}
35-
.setUpdate {
35+
.setUpdate {
3636
// Runs on update
3737
}
3838
.setStop { interrupted ->
@@ -66,7 +66,7 @@ Command myLambdaCommand = new LambdaCommand()
6666
> [!TIP]
6767
> All functions are completely optional. You only need to call the ones you will use. They can be called in any order.
6868
69-
## Commands as Classes
69+
### Commands as Classes
7070

7171
It is unlikely that you will need to use this very often, but you can also create a command as a class. This is useful for cases where you need to reuse your command a lot. An command can be created as a class as follows:
7272

src/nextftc/concepts/subsystems.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ in that subsystem. For example:
6565
== Kotlin
6666

6767
```kotlin
68-
val open = SetPositon(claw, 1.0).setRequirements(this)
68+
val open = SetPositon(claw, 1.0).requires(this)
6969
```
7070

7171
== Java
7272

7373
```java
74-
public Command open = new SetPosition(claw, 1).setRequirements(this);
74+
public Command open = new SetPosition(claw, 1).requires(this);
7575
```
7676

7777
:::
@@ -88,11 +88,11 @@ do this is as follows.
8888
private val claw = Any()
8989
private val pivot = Any()
9090

91-
val openClaw = SetPosition(clawServo, 1.0).setRequirements(claw)
92-
val closeClaw = SetPosition(clawServo, 0.0).setRequirements(claw)
91+
val openClaw = SetPosition(clawServo, 1.0).requires(claw)
92+
val closeClaw = SetPosition(clawServo, 0.0).requires(claw)
9393

94-
val pivotLeft = SetPosition(pivotServo, 0.0).setRequirements(pivot)
95-
val pivotRight = SetPostion(pivotServo, 1.0).setRequirements(left)
94+
val pivotLeft = SetPosition(pivotServo, 0.0).requires(pivot)
95+
val pivotRight = SetPostion(pivotServo, 1.0).requires(pivot)
9696
```
9797

9898
== Java
@@ -101,11 +101,11 @@ val pivotRight = SetPostion(pivotServo, 1.0).setRequirements(left)
101101
private Object claw = new Object();
102102
private Object pivot = new Object();
103103

104-
public Command openClaw = new SetPosition(clawServo, 1).setRequirements(claw);
105-
public Command closeClaw = new SetPosition(clawServo, 0).setRequirements(claw);
104+
public Command openClaw = new SetPosition(clawServo, 1).requires(claw);
105+
public Command closeClaw = new SetPosition(clawServo, 0).requires(claw);
106106

107-
public Command pivotLeft = new SetPosition(pivotServo, 0.0).setRequirements(pivot);
108-
public Command pivotRight = new SetPosition(pivotServo, 0.0).setRequirements(pivot);
107+
public Command pivotLeft = new SetPosition(pivotServo, 0.0).requires(pivot);
108+
public Command pivotRight = new SetPosition(pivotServo, 0.0).requires(pivot);
109109
```
110110

111111
:::

0 commit comments

Comments
 (0)