|
1 | 1 | --- |
2 | 2 | title: Introduction |
3 | 3 | description: What NextFTC is and how to get started. |
| 4 | +next: |
| 5 | + label: Installation |
| 6 | + link: introduction/installation |
4 | 7 | --- |
5 | 8 |
|
6 | | -Content coming soon. |
| 9 | +import { Tabs, TabItem, CardGrid, Card } from '@astrojs/starlight/components' |
| 10 | + |
| 11 | +NextFTC is a command-based library for programming FTC robots, written in Kotlin with full support for Java. |
| 12 | +It's designed to let you write robot code that's expressive, reusable, and easy to reason about, |
| 13 | +without fighting the FTC SDK. |
| 14 | + |
| 15 | +<CardGrid> |
| 16 | + <Card title="Control" icon="setting"> |
| 17 | + PID, feedforward, motion profiling, and typed geometry and units, usable on their own even outside of an FTC robot. |
| 18 | + </Card> |
| 19 | + <Card title="Hardware" icon="random"> |
| 20 | + Lazily-initialized, caching wrappers around motors, servos, sensors, and vision hardware. |
| 21 | + </Card> |
| 22 | + <Card title="Robot" icon="puzzle"> |
| 23 | + `NextRobot`, `Mechanism`, and `NextOpMode` tie everything together into a command-based robot. |
| 24 | + </Card> |
| 25 | +</CardGrid> |
| 26 | + |
| 27 | +## Why NextFTC? |
| 28 | + |
| 29 | +Most FTC teams write robot code as a pile of `if` statements inside a `while (opModeIsActive())` loop. |
| 30 | +NextFTC replaces that with **mechanisms** (your subsystems, like an arm or intake) and **commands** |
| 31 | +(actions those subsystems can perform), and lets you bind them directly to gamepad input: |
| 32 | + |
| 33 | +<Tabs syncKey="language"> |
| 34 | +<TabItem label="Kotlin"> |
| 35 | +```kotlin |
| 36 | +class Claw : Mechanism { |
| 37 | + val servo = NextServo("clawServo") |
| 38 | + |
| 39 | + fun open() = instant { servo.position = 0.2 } |
| 40 | + fun close() = instant { servo.position = 0.8 } |
| 41 | +} |
| 42 | +``` |
| 43 | +</TabItem> |
| 44 | +<TabItem label="Java"> |
| 45 | +```java |
| 46 | +public class Claw implements Mechanism { |
| 47 | + NextServo servo = new NextServo("clawServo"); |
| 48 | + |
| 49 | + public Command open() { return instant(() -> servo.setPosition(0.2)); } |
| 50 | + public Command close() { return instant(() -> servo.setPosition(0.8)); } |
| 51 | +} |
| 52 | +``` |
| 53 | +</TabItem> |
| 54 | +</Tabs> |
| 55 | + |
| 56 | +## Ivy |
| 57 | + |
| 58 | +NextFTC uses the [Ivy library](https://pedropathing.com/docs/ivy) as its underlying commands framework. |
| 59 | +If you already use Ivy, using NextFTC will be easy! |
| 60 | +If you don't, don't worry. |
| 61 | +Many of the concepts translate cleanly from other command frameworks, |
| 62 | +including NextFTC v1. |
| 63 | + |
| 64 | +## Kotlin and Java |
| 65 | + |
| 66 | +NextFTC is written in Kotlin, but Java is treated as a first-class citizen, not an afterthought. |
| 67 | +Every public API is designed to read naturally from Java, and every code sample in these docs is shown in both languages. |
| 68 | + |
| 69 | +## Ready to get started? |
| 70 | + |
| 71 | +Continue to [Installation](/introduction/installation/) to add NextFTC to your robot project. |
0 commit comments