AdvantageScope

What is AdvantageScope?

AdvantageScope is a program developed by FRC 6328 to effectively graph data for you robot. Several FRC teams including ourselves use AdvantageScope often, and it will probably save hours and hours of painful and tedious fine-tuning.

There is a tutorial in AdvantageScope itself for the entire page (the 📖 icon), so this will be a brief rundown through AdvantageScope's line graph feature.

circle-info

AdvantageScope needs the AdvantageKit library that comes with WPILIB. Make sure to install it through Vendor Dependencies.

How does AdvantageScope work?

AdvantageScope uses NetworkTables to share data real-time between devices and the computer. Think of NetworkTables as a huge group chat that both the computer and various devices use. Any data they put in the group chat can be accessed by everyone.

How to use Advantage Scope?

To log data onto a NetworkTable you'll use the Logger class that comes with AdvantageKit. First, you'll need to configure the Logger through the Robot class, as well as create an NetworkTable Publisher. All this does is put data into the table. The Logger class does the rest of the heavy-lifting for you.

NetworkTables can be divided into little tabs to help organize them. They can be divided into small tabs, but we'll go over this later.

Setting up AdvantageScope's Code

AdvantageScope requires custom classes from AdvantageKit to run properly, and you'll have to modify some important parts of your code, primarially the Robot class.

circle-info

There are several different libraries you'll use that might share the same name with a class Java already has. Here are the import lines you'll need.

import org.littletonrobotics.junction.LoggedRobot; import org.littletonrobotics.junction.Logger; import org.littletonrobotics.junction.networktables.NT4Publisher;

Firstly, for the Robot class, go to its class declaration, and change "TimedRobot" to "LoggedRobot".

Then, in the Robot class constructor, we'll put these lines in it. These simply configure the Logger class- which does most of the work here.

The method recordMetadata(). Metadata is essentially additional information about data. such as its category. recordMetadata() takes two parameters, "Key" and "Value". "Key" will be the name of the folder created

Set these values to whatever you think fits, as long as they are two strings.

To log data, you simply need to do:

Yep- it's that simple! The key tells the logger where in the NetworkTable you want to store the data given.

NetworkTables can be divided into little tabs to help organize them. Let's show an example here with animals.

If you wanted to store a key in the "Animals" tab, you simply need to set the key to "/Animals". Each of the slashes defines a new tab.

Let's say you wanted to store data in "Dog". To do this, you'll set the key to "/Animals/Dog". Here is an example below.

AdvantageScope logs data in real time, so make sure you clicked you clicked Simulate Robot Code on VSC.

Organizing the AdvantageScope Interface

Open up the AdvantageScope app and your screen will look like this.

To use AdvantageScope you'll also have to open the app itself and connect to the robot, so make sure you are simulating your XRP's code and connected to its WiFi network. Once you did this, go to File and then click Connect to Simulation.

Now, you might notice the sidebar suddenly gets flooded with data, and open the folders until you find RealOutputs. Any data that you decide to log will be stored in this folder. Depending on the data, you have to drag it into one of the three categories on the bottom.

If it is a boolean, you should drag it into Discrete Fields. If it is a number, put it in either the Left Axis or Right Axis.

Last updated