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

HelixEvents

notmattlythgoe edited this page Sep 19, 2019 · 7 revisions

HelixEvents is an event logging tool use to log event messages

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. There are several different source options provided.

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)
public void addDoubleSource(String name, Supplier<Double> supplier)
public void addFloatSource(String name, Supplier<Float> supplier)
public void addShortSource(String name, Supplier<Short> supplier)
public void addIntegerSource(String name, Supplier<Integer> supplier)
public void addLongSource(String name, Supplier<Long> supplier)
public void addBooleanSource(String name, Supplier<Boolean> supplier)
public void addStringSource(String name, Supplier<String> supplier)
public void addCharacterSource(String name, Supplier<Character> supplier)
HelixLogger.getInstance().addDoubleSource("TOTAL CURRENT", pdp::getTotalCurrent);
HelixLogger.getInstance().addDoubleSource("DRIVETRAIN LEFT VOLTAGE", left::getMotorOutputVoltage);
HelixLogger.getInstance().addIntegerSource("DRIVETRAIN LEFT VELOCITY", this::getLeftVelocity);
HelixLogger.getInstance().addDoubleSource("DRIVETRAIN RIGHT VOLTAGE", right::getMotorOutputVoltage);
HelixLogger.getInstance().addIntegerSource("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

Clone this wiki locally