Skip to content

Commit 2db45f2

Browse files
committed
add installation guide and enhance introduction for NextFTC
1 parent 2be1cf2 commit 2db45f2

2 files changed

Lines changed: 107 additions & 1 deletion

File tree

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,71 @@
11
---
22
title: Introduction
33
description: What NextFTC is and how to get started.
4+
next:
5+
label: Installation
6+
link: introduction/installation
47
---
58

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.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Installation
3+
description: How to install NextFTC libraries.
4+
prev:
5+
label: Introduction
6+
link: introduction/index
7+
---
8+
9+
import { Aside } from '@astrojs/starlight/components'
10+
11+
<Aside type='danger'>
12+
Installing NextFTC v2 in a project that already has NextFTC v1 will work,
13+
but run into errors at build-time, as the libraries contain classes with the same name.
14+
15+
It is recommended to remove NextFTC v1 from your project and follow the migration guide (coming soon).
16+
</Aside>
17+
18+
To install NextFTC in an FTC robot project, open `TeamCode/build.gradle`,
19+
and add the following to your `dependencies` block:
20+
21+
```groovy
22+
implementation 'dev.nextftc.v2:control:VERSION'
23+
implementation 'dev.nextftc.v2:hardware:VERSION'
24+
implementation 'dev.nextftc.v2:robot:VERSION'
25+
```
26+
27+
<Aside type='tip' title=''>
28+
Replace the `VERSION` with the latest version from Maven Central (omitting the `v` prefix):
29+
<img alt="Maven Central Version" src="https://img.shields.io/maven-central/v/dev.nextftc.v2/robot?strategy=highestVersion&style=flat&label=%20Version&labelColor=163650&color=b3d3ec"/>
30+
</Aside>
31+
32+
Note that the control and hardware modules can be used on their own.
33+
34+
If you are using the hardware and/or robot modules,
35+
add the following to the `repositories` block to allow Gradle to find the necessary dependencies.
36+
37+
```groovy
38+
maven {
39+
url 'https://repo.dairy.foundation/releases'
40+
}
41+
```

0 commit comments

Comments
 (0)