-
Notifications
You must be signed in to change notification settings - Fork 5
HelixLogger
HelixLogger is a logging tool used to log data to a csv file located on the roboRIO.
- 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" }
}
- Add these lines to the dependencies block:
compile 'com.github.TripleHelixProgramming:HelixUtilities:v2020.1'
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);
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();
}
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/
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