Skip to content

Commit 9810278

Browse files
committed
refactor: reorganize command documentation and update links
1 parent d70b427 commit 9810278

10 files changed

Lines changed: 98 additions & 177 deletions

File tree

.vitepress/sidebar/guide.mts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ export default [
2525
{text: "TeleOp", link: "/guide/opmodes/teleop"},
2626
]
2727
},
28-
{
29-
text: "Commands",
30-
items: [
31-
{text: "Overview", link: "/guide/commands/custom-commands"},
32-
]
33-
},
3428
{
3529
text: "Further Reading",
3630
link: "/guide/further-reading"

.vitepress/sidebar/nextftc.mts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export default [
2727
{
2828
text: "Units",
2929
link: "/nextftc/concepts/units"
30+
},
31+
{
32+
text: "Subsystem Groups",
33+
link: "/nextftc/concepts/subsystem-groups"
3034
}
3135
]
3236
},
@@ -36,19 +40,23 @@ export default [
3640
items: [
3741
{
3842
text: "Command Groups",
39-
link: "/nextftc/helpful-commands/groups"
43+
link: "/nextftc/commands/groups"
4044
},
4145
{
4246
text: "Utilities",
43-
link: "/nextftc/helpful-commands/utilities"
47+
link: "/nextftc/commands/utilities"
4448
},
4549
{
4650
text: "Conditionals",
47-
link: "/nextftc/helpful-commands/conditionals"
51+
link: "/nextftc/commands/conditionals"
4852
},
4953
{
5054
text: "Delays",
51-
link: "/nextftc/helpful-commands/delays"
55+
link: "/nextftc/commands/delays"
56+
},
57+
{
58+
text: "Custom Commands",
59+
link: "/nextftc/commands/custom-commands"
5260
}
5361
]
5462
},

src/guide/subsystems/groups-and-robot.md

Lines changed: 0 additions & 166 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Subsystem Groups
2+
3+
NextFTC offers a [`SubsystemGroup`](https://javadoc.io/doc/dev.nextftc/core/latest/-next-f-t-c%20-core/dev.nextftc.core.subsystems/-subsystem-group/index.html) class,
4+
which allows you to group multiple subsystems together for easier management and control.
5+
This is particularly useful for complex robots with many subsystems,
6+
as it enables you to treat them as a single unit.
7+
8+
This can be used in multiple ways.
9+
Some examples include a double-jointed arm mechanism,
10+
or a swerve drive train with multiple modules that can be controlled independently.
11+
This example also illustrates using a `SubsystemGroup` to represent your robot as a whole,
12+
allowing for more streamlined control and coordination between subsystems.
13+
14+
Just like regular subsystems,
15+
subsystem groups have an `initialize` and `periodic` function;
16+
in addition, the `initialize` function of each subsystem in the group
17+
will be called when the group is initialized,
18+
and the `periodic` function of each subsystem will be called every loop.
19+
20+
## Creating a Subsystem Group
21+
22+
To create a `SubsystemGroup`,
23+
you must create a subclass of `SubsystemGroup`,
24+
and provide the necessary subsystem instances to its constructor.
25+
26+
:::tabs key:code
27+
28+
== Kotlin
29+
30+
```kotlin
31+
object MySubsystemGroup() : SubsystemGroup(
32+
MyFirstSubsystem,
33+
MySecondSubsystem
34+
)
35+
```
36+
37+
== Java
38+
39+
Just like regular subsystems,
40+
we must provide some boilerplate code to create a `SubsystemGroup` in Java.
41+
42+
```java
43+
public class MySubsystemGroup extends SubsystemGroup {
44+
public static final MySubsystemGroup INSTANCE = new MySubsystemGroup();
45+
46+
private MySubsystemGroup() {
47+
super(
48+
MyFirstSubsystem.INSTANCE,
49+
MySecondSubsystem.INSTANCE
50+
);
51+
}
52+
}
53+
```
54+
55+
:::
56+
57+
## Using a Subsystem Group
58+
59+
To register a subsystem group, you can simply pass its instance
60+
to the `SubsystemComponent` constructor in a NextFtcOpMode
61+
the way you would with a regular subsystem:
62+
63+
:::tabs key:code
64+
65+
== Kotlin
66+
67+
```kotlin
68+
init {
69+
addComponents(
70+
SubsystemComponent(MySubsystemGroup)
71+
)
72+
}
73+
```
74+
75+
== Java
76+
77+
```java
78+
public MyOpMode() {
79+
addComponents(
80+
SubsystemComponent(MySubsystemGroup.INSTANCE)
81+
);
82+
}
83+
```
84+
85+
:::

src/nextftc/concepts/subsystems.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ It can also be used to simplify the process of adding multiple
115115
subsystems to a `SubsystemComponent`.
116116

117117
For examples of SubsystemGroups,
118-
see the [corresponding guide page](../../guide/subsystems/groups-and-robot).
118+
see the [corresponding guide page](subsystem-groups.md).

0 commit comments

Comments
 (0)