Logo

Westside Robotics FTC Java Programming Guide

Report Data with Telemetry

Especially while we’re actively developing new functionality & debugging our code, it’s often helpful to be able to get more information about what the robot is doing. We can use the built-in telemetry object to send bits of data to the Driver Hub.

One of the most valuable pieces of information we should send back to the Driver Hub, especially when we start developing autonomous OpModes, is the current encoder count of a motor. We can get that by calling the getCurrentPosition method on a motor.

Servos also have a getCurrentPosition method, but standard servos don’t actually know their current position, so this function returns where the servo is supposed to be, not where it actually is.

Sending telemetry data is a two-step process. First, we need to provide the telemetry object with a label and the associated data we want to display. At the end of your loop method, add the following line:

telemetry.addData("LF", driveLF.getCurrentPosition());

You can go ahead and add more lines for each of your other motors, too.

After you add all of your telemetry data, you need to send all the data you’ve built up back to the Driver Hub. After all of your telemetry.addData calls, add:

telemetry.update();

Compile and run your code. As you drive your robot around, you should see the values on your Driver Hub change.