Skip to content

Commit 605be89

Browse files
committed
docs: improve clarity and formatting in ext roadrunner documentation
1 parent 4bd089e commit 605be89

3 files changed

Lines changed: 47 additions & 42 deletions

File tree

src/extensions/roadrunner/command-builder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The RoadRunner extension provides a `TrajectoryCommandBuilder` class
44
that makes it easy to create commands that follow trajectories,
5-
similarly to `TrajectoryActionBuilder` in the RoadRunner library.
5+
similar to `TrajectoryActionBuilder` in the RoadRunner library.
66

77
Once you've set up the RoadRunner extension in your project,
88
including the relevant changes to your `MecanumDrive` class,
@@ -30,7 +30,7 @@ class CommandBuilderKt : NextFTCOpMode() {
3030
}
3131

3232
// the onInit blocks are executed in the order they are defined,
33-
// so drive will be initialized before driveCommand
33+
// so `drive` will be initialized before `driveCommand`.
3434
val driveCommand: Command by onInit {
3535
drive.commandBuilder(startPose)
3636
.splineTo(scorePose.position, scorePose.heading)

src/extensions/roadrunner/index.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
# RoadRunner Extension
22

3-
This extension provides integration with the
4-
[RoadRunner Library](https://rr.brott.dev/),
3+
This extension provides integration with the
4+
[RoadRunner Library](https://rr.brott.dev/)
55
and [QuickStart](https://github.com/acmerobotics/road-runner-quickstart).
66

77
## Installation
88

9-
To install the RoadRunner extension,
10-
add the following line to your `build.gradle` file:
9+
Add the following line to your `build.gradle` file
10+
to install the RoadRunner extension:
1111

1212
```groovy
1313
implementation 'dev.nextftc.extensions:roadrunner:1.0.0'
1414
```
1515

1616
::: warning
17-
Version `1.0.0` supports RoadRunner `1.0.1`,
18-
and RoadRunner FTC `0.1.25`,
19-
and is not compatible with earlier versions.
17+
Version `1.0.0` supports RoadRunner `1.0.1`
18+
and RoadRunner FTC `0.1.25`, and is not compatible with earlier versions.
2019

21-
This guide also assumes you are using
22-
the QuickStart for RoadRunner,
20+
This guide also assumes you are using QuickStart for RoadRunner
2321
and its `MecanumDrive` class.
2422
:::
2523

2624
## QuickStart Additions
2725

2826
To use the RoadRunner extension,
29-
you will need to make a few additions to the QuickStart code.
27+
make the following additions to the QuickStart code.
3028

3129
First, make your `MecanumDrive` class extend `NextFTCMecanumDrive`:
3230

@@ -36,8 +34,8 @@ public class MecanumDrive extends NextFTCMecanumDrive {
3634
}
3735
```
3836

39-
You will probably get an error about unimplemented members;
40-
you can copy the following implementations into your class:
37+
You will probably get an error about unimplemented members.
38+
You can copy the following implementations into your class:
4139

4240
```java
4341
HolonomicController controller = new HolonomicController(
@@ -59,17 +57,21 @@ you can copy the following implementations into your class:
5957

6058
@Override
6159
public void setDrivePowersFF(@NotNull PoseVelocity2dDual<Time> powers) {
62-
MecanumKinematics.WheelVelocities<Time> wheelVels = kinematics.inverse(poseVelocity2dDual);
60+
MecanumKinematics.WheelVelocities<Time> wheelVels =
61+
kinematics.inverse(poseVelocity2dDual);
6362
double voltage = voltageSensor.getVoltage();
6463

65-
final MotorFeedforward feedforward = new MotorFeedforward(PARAMS.kS,
66-
PARAMS.kV / PARAMS.inPerTick, PARAMS.kA / PARAMS.inPerTick);
64+
final MotorFeedforward feedforward = new MotorFeedforward(
65+
PARAMS.kS,
66+
PARAMS.kV / PARAMS.inPerTick,
67+
PARAMS.kA / PARAMS.inPerTick
68+
);
6769
double leftFrontPower = feedforward.compute(wheelVels.leftFront) / voltage;
6870
double leftBackPower = feedforward.compute(wheelVels.leftBack) / voltage;
6971
double rightBackPower = feedforward.compute(wheelVels.rightBack) / voltage;
7072
double rightFrontPower = feedforward.compute(wheelVels.rightFront) / voltage;
7173
mecanumCommandWriter.write(new MecanumCommandMessage(
72-
voltage, leftFrontPower, leftBackPower, rightBackPower, rightFrontPower
74+
voltage, leftFrontPower, leftBackPower, rightBackPower, rightFrontPower
7375
));
7476

7577
leftFront.setPower(feedforward.compute(wheelVels.leftFront) / voltage);
@@ -99,7 +101,7 @@ you can copy the following implementations into your class:
99101

100102
Android Studio will probably suggest the necessary imports.
101103

102-
There is an example `MecanumDrive` class in the NextFTC branch of my
104+
There is an example `MecanumDrive` class in the NextFTC branch of my
103105
[RoadRunner QuickStart fork](https://github.com/zachwaffle4/road-runner-quickstart/tree/nextftc).
104-
Do note that this is just an example,
105-
and it may not be updated to the latest version of RoadRunner or NextFTC.
106+
Note that this is just an example and may not be updated
107+
to the latest version of RoadRunner or NextFTC.

src/extensions/roadrunner/other-commands.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,34 @@ The `TrajectoryCommandBuilder` has functions to schedule other commands
44
during trajectory execution. This can be useful for coordinating
55
mechanisms on your robot while following a path.
66

7-
Here are the functions available in `TrajectoryCommandBuilder` for this purpose:
7+
Here are the functions available in `TrajectoryCommandBuilder`
8+
for this purpose:
89
- `waitSeconds(seconds: Double)`: Adds a wait period to the trajectory.
910
An additional overload accepts a `Duration` argument instead of a `Double`.
10-
- `afterTime(seconds: Double, command: Command)`: Schedules a command to run after a specified time into the trajectory.
11-
An additional overload accepts a `Duration` argument instead of a `Double`.
12-
- `afterDisplacement(displacement: Double, command: Command)`:
13-
Schedules a command to run after the robot has traveled a specified distance along the trajectory.
14-
- `stopAndAdd(command: Command)`:
15-
Stops the trajectory following and runs the specified command.
16-
The trajectory will not resume after the command completes.
11+
- `afterTime(seconds: Double, command: Command)`: Schedules a command to run
12+
after a specified time into the trajectory.
13+
An additional overload accepts
14+
a `Duration` argument instead of a `Double`.
15+
- `afterDisplacement(displacement: Double, command: Command)`: Schedules a command
16+
to run after the robot has traveled a specified distance along the trajectory.
17+
- `stopAndAdd(command: Command)`: Stops the trajectory following and runs
18+
the specified command.
19+
The trajectory will resume after the command completes.
1720

1821
`afterTime`, `afterDisplacement`, and `stopAndAdd` also have overloads
1922
that accept a `Runnable` instead of a `Command` object,
2023
which schedules an `InstantCommand`.
2124

2225
Here is an example of using these functions in an OpMode,
23-
using the [lift](../../guide/subsystems/lift) and
26+
using the [lift](../../guide/subsystems/lift) and
2427
[claw](../../guide/subsystems/claw) subsystems from the previous guides.
2528

26-
As you can see, this example requires us to use
27-
the `SubsystemComponent` to add the subsystems to our OpMode,
28-
so that their `periodic` methods are called during the OpMode.
29-
You can add other subsystems to the same `SubsystemComponent` if needed,
30-
and other `Component` types can be added alongside it,
31-
if needed or desired.
29+
As you can see, this example requires you to use the `SubsystemComponent`
30+
to add the subsystems to your OpMode, so that their `periodic` methods
31+
are called during the OpMode.
32+
You can add other subsystems to the same
33+
`SubsystemComponent` if needed, and other `Component` types can be added
34+
alongside it if needed or desired.
3235

3336
::: tabs key:code
3437
== Kotlin
@@ -71,7 +74,7 @@ public class OtherCommands extends NextFTCOpMode {
7174

7275
public OtherCommands() {
7376
addComponents(
74-
new SubsystemComponent(Lift.INSTANCE, Claw.INSTANCE)
77+
new SubsystemComponent(Lift.INSTANCE, Claw.INSTANCE)
7578
);
7679
}
7780

@@ -80,15 +83,15 @@ public class OtherCommands extends NextFTCOpMode {
8083
drive = new MecanumDrive(hardwareMap, startPose);
8184

8285
driveCommand = drive.commandBuilder(startPose)
83-
.splineTo(scorePose.position, scorePose.heading)
84-
.afterTime(0.5, Lift.INSTANCE.toHigh())
85-
.stopAndAdd(Claw.INSTANCE.open())
86-
.build();
86+
.splineTo(scorePose.position, scorePose.heading)
87+
.afterTime(0.5, Lift.INSTANCE.toHigh())
88+
.stopAndAdd(Claw.INSTANCE.open())
89+
.build();
8790
}
8891

8992
@Override
9093
public void onStartButtonPressed() {
9194
driveCommand.schedule();
9295
}
9396
}
94-
```
97+
```

0 commit comments

Comments
 (0)