Welcome to Lesson 5 in the FTC Java series.
You should have by now learned how to make an opmode and navigate Android Studio’s interface and gradle files.
What you will learn in this lesson:
- How to install Roadrunner
- How to use the dashboard (installed with roadrunner)
RR Install
There are two ways to install RoadRunner (or RR for short):
- Use the RR Quickstart project (simplest) and migrate your code there
- Import RR with gradle (complicated)
The RR Quickstart is a sample SDK project with RR and a bunch of tuning and sample OpModes. It can be found here. To have your OpenCV opmodes still compile, reinstall OpenCV with the gradle instructions found here.
To install RR manually, follow the instructions here. We will not cover this directly here since it is much more efficient to place OpenCV etc OpModes into RR Quickstart than the reverse.
Your project outline should look something like this:

Dashboard
The dashboard is installed as a part of the RR quickstart, so you don’t have to do anything special.
To access it, hop onto the wifi of the robot controller, and then go to 192.168.43.1:8080/dash. (This link opens in a new tab, and this page won’t disappear if you lose internet connection (which happens with joining the RC wifi without Ethernet or a second wifi card)).
To get a dashboard instance, which allows you to perform actions on the dashboard, you call the following function:

FtcDashboard.getInstance();
The dashboard is useful for graphing telemetry values, and also plotting the robot’s position.
To send telemetry directly to the dashboard, use a telemetryPacket:

TelemetryPacket pack = new TelemetryPacket();
pack.put("Is OpMode running: ",true); // always true if we are in the loop :)
dash.sendTelemetryPacket(pack);
The pack.put();
function is very similar to the telemetry.addData();
function.
On the dashboard interface, you can choose to graph telemetry values. There is no need to tell the dashboard explicitly to allow graphing.
You can also overlay the robot position as follows:

TelemetryPacket pack = new TelemetryPacket();
Canvas field = pack.fieldOverlay();
field.setStroke("#3F51B5"); // change with what you want as color
DashboardUtil.drawRobot(field, new Pose2d(x,y,h)); // change with your robot's position
dash.sendTelemetryPacket(pack);
The dashboard is very useful for tuning PIDs and modifying constants live during a program. You can enable this by each constant being public static
and the class being annotated (i.e. this line goes all the way before the class declaration) with @Config
:

@Config
@TeleOp
public class DashboardTutorialOpMode extends OpMode {
FtcDashboard dash;
public static int x;
public static int y;
public static int h;
@Override
public void init() {
dash = FtcDashboard.getInstance();
}
@Override
public void loop() {
TelemetryPacket pack = new TelemetryPacket();
Canvas field = pack.fieldOverlay();
field.setStroke("#3F51B5");
DashboardUtil.drawRobot(field, new Pose2d(x,y,h));
dash.sendTelemetryPacket(pack);
}
}
Don’t forget the imports!
Thats it for this lesson, check out part 2 here!
©The RoboMentors (Marc and Anne-Sarah)