Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

HelixLogger

notmattlythgoe edited this page Feb 21, 2020 · 10 revisions

HelixLogger is a logging tool used to log data to a csv file located on the roboRIO.

Set up dependencies

  1. Add the following to your build.gradle, This allows you to pull the dependencies needed from a github repository:
   repositories {
      jcenter()
      maven { url "https://jitpack.io" }
   }
  1. Add these lines to the dependencies block:
    compile 'com.github.TripleHelixProgramming:HelixUtilities:v2020.1'

Setup

The first thing you will need to do before you start logging data is setup what data the logger will save. To do this you'll access the Singleton instance of HelixLogger and add Sources to it.

The name is what the name of the column will be for that data in the csv file and the Supplier is where the data will be grabbed when the logger is told to log data.

public void addSource(String name, Supplier<Object> supplier)
HelixLogger.getInstance().addSource("TOTAL CURRENT", pdp::getTotalCurrent);
HelixLogger.getInstance().addSource("DRIVETRAIN LEFT VOLTAGE", left::getMotorOutputVoltage);
HelixLogger.getInstance().addSource("DRIVETRAIN LEFT VELOCITY", this::getLeftVelocity);
HelixLogger.getInstance().addSource("DRIVETRAIN RIGHT VOLTAGE", right::getMotorOutputVoltage);
HelixLogger.getInstance().addSource("DRIVETRAIN RIGHT VELOCITY", this::getRightVelocity);

Starting The Logger

After the initialization of the sources is completed you'll need to set up when logs are saved. We like to save data during the autonomous and teleoperated periods only.

@Override
public void autonomousPeriodic() {
  Scheduler.getInstance().run();
  HelixLogger.getInstance().saveLogs();
}

@Override
public void teleopPeriodic() {
  Scheduler.getInstance().run();
  HelixLogger.getInstance().saveLogs();
}

Accessing Your Logged Data

Logs Location

Your logs will be saved in one of two places: roboRio or USB stick. If you have a USB stick plugged into the roboRio your logs will automatically be saved to it in logs/. If there is no USB stick then the logs will be saved on the roboRio under /home/lvuser/logs/

Logs Name

If you are not connected to an FMS your log will be saved as test.csv and will be overwritten each time the robot is restarted. However if you are at an event your logs will be saved in the following format: eventCode_matchType + matchNumber.csv

Examples:

VAPOR_Practice1.csv
VAPOR_Elimination1.csv
VAPOR_Practice4.csv

Example Log

Clone this wiki locally