Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/content/docs/introduction/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and add the following to your `dependencies` block:
implementation 'dev.nextftc.v2:control:VERSION'
implementation 'dev.nextftc.v2:hardware:VERSION'
implementation 'dev.nextftc.v2:robot:VERSION'
implementation 'dev.anygeneric:blazeftc:BLAZEVERSION'
```

<Aside type="tip" title="">
Expand All @@ -32,8 +33,10 @@ implementation 'dev.nextftc.v2:robot:VERSION'
alt="Maven Central Version"
src="https://img.shields.io/maven-central/v/dev.nextftc.v2/robot?strategy=highestVersion&style=flat&label=%20Version&labelColor=0c1014&color=0099ff"
/>
Replace `BLAZEVERSION` with the latest version listed [here](https://github.com/owenpmckenna/blaze_ftc#normal-usage). As of writing, that's `0.1.61`.
</Aside>


Note that the control and hardware modules can be used on their own.

If you are using the hardware and/or robot modules,
Expand All @@ -42,5 +45,6 @@ add the following to the `repositories` block to allow Gradle to find the necess
```groovy
maven {
url 'https://repo.dairy.foundation/releases'
url 'https://maven.anygeneric.dev/'
}
```
67 changes: 61 additions & 6 deletions src/content/docs/robot/nextopmode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ All four are plain fields on the class, so use them directly.
Every one of these is optional.
Override the ones you need:

| Method | Called |
| -------------------- | ------------------------------------------------ |
| `disabledPeriodic()` | Repeatedly, while the Driver Station is in INIT. |
| `start()` | Once, right after the PLAY button is pressed. |
| `periodic()` | Repeatedly, while the OpMode is running. |
| `end()` | Once, when the OpMode finishes. |
| Method | Called |
| -------------------------- | ------------------------------------------------------ |
| `disabledPeriodic()` | Repeatedly, while the Driver Station is in INIT. |
| `start()` | Once, right after the PLAY button is pressed. |
| `periodic()` | Repeatedly, while the OpMode is running. |
| `end()` | Once, when the OpMode finishes. |
| `onControlHubBulkData()` | Repeatedly, when the BulkReadHook produces data. |
| `onExpansionHubBulkData()` | Repeatedly, when the BulkReadHook produces data. |
| `onLocalizationData()` | Repeatedly, when the PinpointHook produces data. (WIP) |

<Tabs syncKey="language">
<TabItem label="Kotlin">
Expand All @@ -39,6 +42,9 @@ class MyTeleop(robot: MyRobot) : NextOpMode(robot) {
override fun periodic() {
Telemetry.log("Status", "Running")
}

//Optional. Don't override or return false to disable Blaze.
override fun enableBlaze() = true
}
```

Expand All @@ -54,6 +60,12 @@ public class MyTeleop extends NextOpMode {
public void periodic() {
Telemetry.log("Status", "Running");
}

//Optional: Don't override or return false to disable Blaze.
@Override
public boolean enableBlaze() {
return true;
}
}
```

Expand Down Expand Up @@ -110,6 +122,49 @@ public class MyTeleop extends NextOpMode {
</TabItem>
</Tabs>

## `BlazeBulkReadHook`

Using the BlazeFTC library, it is possible to run your code at a much higher speed than is typically possible.
On the Control Hub or on a USB Expansion Hub, a slow mode hook can easily provide data at 500 hz.
For more information on how that works, check out the [BlazeFTC Readme](https://github.com/owenpmckenna/blaze_ftc).
To take advantage of this project using NextFTC, use the following setup:

<Tabs syncKey="language">
<TabItem label="Kotlin">

```kotlin
class MyTeleop(robot: MyRobot) : NextOpMode(robot, BlazeBulkReadHook(Type.EXPANSION_HUB, false)) {
//Must be enabled for hook to work
override fun enableBlaze() = true
override fun onExpansionHubBulkData() {
//Run PID loops here
}
}
```

</TabItem>
<TabItem label="Java">

```java
public class MyTeleop extends NextOpMode {
public MyTeleop(MyRobot robot) { super(robot, new BlazeBulkReadHook(Type.EXPANSION_HUB, false)); }

//Must be enabled for hook to work
@Override
public boolean enableBlaze() {
return true;
}
@Override
public void onExpansionHubBulkData() {
//Run PID loops here
}
}
```

</TabItem>
</Tabs>


## Registering with the Driver Station

Annotate your class with `@NextTeleop`, `@NextAutonomous`, or `@NextUtility` to make it
Expand Down