Skip to content
Open
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
5 changes: 5 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:BLAZE_VERSION'
```

<Aside type="tip" title="">
Expand All @@ -32,6 +33,7 @@ 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 the `BLAZE_VERSION` with the latest Blaze version. At the time of writing, this is version `0.1.62`. More up to date info can be found [here](https://github.com/owenpmckenna/blaze_ftc#normal-usage).
</Aside>

Note that the control and hardware modules can be used on their own.
Expand All @@ -43,4 +45,7 @@ add the following to the `repositories` block to allow Gradle to find the necess
maven {
url 'https://repo.dairy.foundation/releases'
}
maven {
url 'https://maven.anygeneric.dev/'
}
```
61 changes: 55 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 BlazeBulkReadHook produces data. |
| `onExpansionHubBulkData()` | Repeatedly, when the BlazeBulkReadHook produces data. |
| `onLocalizationData()` | Work in progress. |

<Tabs syncKey="language">
<TabItem label="Kotlin">
Expand Down Expand Up @@ -110,6 +113,52 @@ public class MyTeleop extends NextOpMode {
</TabItem>
</Tabs>

## `BlazeBulkReadHook`

Using the BlazeFTC library, you may run your code much faster than is typically possible.
Blaze runs in the background, "behind" the SDK and polls data without any user input at all.
On the Control Hub or on a USB Expansion Hub, a slow mode Bulk Read hook can easily provide data at 500 hz.
For more information on how that works, or to accelerate i2c calls, check out the [BlazeFTC Readme](https://github.com/owenpmckenna/blaze_ftc).
To take advantage of Blaze via NextFTC, use the following setup:

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

```kotlin
@NextTeleop(name = "My Teleop")
@BlazeEnabled
class MyTeleop(robot: MyRobot) : NextOpMode(robot, BlazeBulkReadHook(Type.EXPANSION_HUB, false)) {
override fun periodic() {
Telemetry.log("Status", "Running")
}
override fun onExpansionHubBulkData() {
//Run PID loops here
}
}
```

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

```java
@NextTeleop(name = "My Teleop")
@BlazeEnabled
public class MyTeleop extends NextOpMode {
public MyTeleop(MyRobot robot) { super(robot, new BlazeBulkReadHook(Type.EXPANSION_HUB, false)); }
@Override
public void periodic() {
Telemetry.log("Status", "Running");
}
@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
Loading