Class SignalLogger
public class SignalLogger extends Object
This logs all the signals from the CAN buses into .hoot files. Each file name starts with the CANivore serial number or "rio" for the roboRIO CAN bus, followed by the timestamp. In the header of a hoot file, the CANivore name and firmware version are logged in plain text.
During an FRC match, the log file will be renamed to include the event name, match type, and match number at the start of the file name. The match type will be 'P' for practice matches, 'Q' for qualification matches, and 'E' for elimination matches.
-
Constructor Summary
Constructors Constructor Description SignalLogger()
-
Method Summary
Modifier and Type Method Description static StatusCode
enableAutoLogging(boolean enable)
Enables or disables auto logging.static StatusCode
setPath(String path)
Sets the destination for logging, restarting logger if the path changed.static StatusCode
start()
Starts logging status signals.static StatusCode
stop()
Stops logging status signals.static StatusCode
writeBoolean(String name, boolean value)
Writes the boolean to the log file.static StatusCode
writeBoolean(String name, boolean value, double latencySeconds)
Writes the boolean to the log file.static StatusCode
writeBooleanArray(String name, boolean[] values)
Writes the array of booleans to the log file.static StatusCode
writeBooleanArray(String name, boolean[] values, double latencySeconds)
Writes the array of booleans to the log file.static StatusCode
writeDouble(String name, double value)
Writes the double to the log file.static StatusCode
writeDouble(String name, double value, String units)
Writes the double to the log file.static StatusCode
writeDouble(String name, double value, String units, double latencySeconds)
Writes the double to the log file.static StatusCode
writeDoubleArray(String name, double[] values)
Writes the array of doubles to the log file.static StatusCode
writeDoubleArray(String name, double[] values, String units)
Writes the array of doubles to the log file.static StatusCode
writeDoubleArray(String name, double[] values, String units, double latencySeconds)
Writes the array of doubles to the log file.static StatusCode
writeFloat(String name, float value)
Writes the float to the log file.static StatusCode
writeFloat(String name, float value, String units)
Writes the float to the log file.static StatusCode
writeFloat(String name, float value, String units, double latencySeconds)
Writes the float to the log file.static StatusCode
writeFloatArray(String name, float[] values)
Writes the array of floats to the log file.static StatusCode
writeFloatArray(String name, float[] values, String units)
Writes the array of floats to the log file.static StatusCode
writeFloatArray(String name, float[] values, String units, double latencySeconds)
Writes the array of floats to the log file.static StatusCode
writeInteger(String name, long value)
Writes the integer to the log file.static StatusCode
writeInteger(String name, long value, String units)
Writes the integer to the log file.static StatusCode
writeInteger(String name, long value, String units, double latencySeconds)
Writes the integer to the log file.static StatusCode
writeIntegerArray(String name, long[] values)
Writes the array of integers to the log file.static StatusCode
writeIntegerArray(String name, long[] values, String units)
Writes the array of integers to the log file.static StatusCode
writeIntegerArray(String name, long[] values, String units, double latencySeconds)
Writes the array of integers to the log file.static StatusCode
writeRaw(String name, byte[] data)
Writes the raw data bytes to the log file.static StatusCode
writeRaw(String name, byte[] data, double latencySeconds)
Writes the raw data bytes to the log file.static StatusCode
writeString(String name, String value)
Writes the string to the log file.static StatusCode
writeString(String name, String value, double latencySeconds)
Writes the string to the log file.
-
Constructor Details
-
SignalLogger
public SignalLogger()
-
-
Method Details
-
setPath
Sets the destination for logging, restarting logger if the path changed.If this is not called or the path is left empty, the default path will be used. The default path on the roboRIO is a logs folder on the first USB flash drive found, or /home/lvuser/logs if none is available. The default path on all other platforms is a logs folder in the current working directory.
Typical use for this routine is to use a removable USB flash drive for logging.
- Parameters:
path
- Folder path for the log files; path must exist- Returns:
- Status of setting the path and restarting the log
-
start
Starts logging status signals. Starts regardless of auto logging status.If using a roboRIO 1, we recommend setting the logging path to an external drive using
setPath(java.lang.String)
to avoid running out of internal storage space.If auto logging is enabled, the log will be stopped at the end of the match.
- Returns:
- Status of starting the logger
-
stop
Stops logging status signals. Stops regardless of auto logging status.- Returns:
- Status of stopping the logger
-
enableAutoLogging
Enables or disables auto logging.Auto logging is only supported on the roboRIO. When auto logging is enabled, logging is started at the beginning of an FRC match and stopped at the end.
- Parameters:
enable
- Whether to enable auto logging- Returns:
- Status of auto logging enable/disable
-
writeRaw
Writes the raw data bytes to the log file. The data cannot exceed 64 bytes.- Parameters:
name
- Name of the signaldata
- Raw data bytes- Returns:
- Status of writing the data
-
writeRaw
Writes the raw data bytes to the log file. The data cannot exceed 64 bytes.- Parameters:
name
- Name of the signaldata
- Raw data byteslatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeBoolean
Writes the boolean to the log file.- Parameters:
name
- Name of the signalvalue
- Value to write- Returns:
- Status of writing the data
-
writeBoolean
Writes the boolean to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writelatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeInteger
Writes the integer to the log file.- Parameters:
name
- Name of the signalvalue
- Value to write- Returns:
- Status of writing the data
-
writeInteger
Writes the integer to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signal- Returns:
- Status of writing the data
-
writeInteger
public static StatusCode writeInteger(String name, long value, String units, double latencySeconds)Writes the integer to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signallatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeFloat
Writes the float to the log file.- Parameters:
name
- Name of the signalvalue
- Value to write- Returns:
- Status of writing the data
-
writeFloat
Writes the float to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signal- Returns:
- Status of writing the data
-
writeFloat
Writes the float to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signallatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeDouble
Writes the double to the log file.- Parameters:
name
- Name of the signalvalue
- Value to write- Returns:
- Status of writing the data
-
writeDouble
Writes the double to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signal- Returns:
- Status of writing the data
-
writeDouble
public static StatusCode writeDouble(String name, double value, String units, double latencySeconds)Writes the double to the log file.- Parameters:
name
- Name of the signalvalue
- Value to writeunits
- Units of the signallatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeString
Writes the string to the log file. The string cannot exceed 64 characters.- Parameters:
name
- Name of the signalvalue
- Value to write- Returns:
- Status of writing the data
-
writeString
Writes the string to the log file. The string cannot exceed 64 characters.- Parameters:
name
- Name of the signalvalue
- Value to writelatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeBooleanArray
Writes the array of booleans to the log file. The array cannot exceed 64 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to write- Returns:
- Status of writing the data
-
writeBooleanArray
Writes the array of booleans to the log file. The array cannot exceed 64 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writelatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeIntegerArray
Writes the array of integers to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to write- Returns:
- Status of writing the data
-
writeIntegerArray
Writes the array of integers to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signals- Returns:
- Status of writing the data
-
writeIntegerArray
public static StatusCode writeIntegerArray(String name, long[] values, String units, double latencySeconds)Writes the array of integers to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signalslatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeFloatArray
Writes the array of floats to the log file. The array cannot exceed 16 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to write- Returns:
- Status of writing the data
-
writeFloatArray
Writes the array of floats to the log file. The array cannot exceed 16 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signals- Returns:
- Status of writing the data
-
writeFloatArray
public static StatusCode writeFloatArray(String name, float[] values, String units, double latencySeconds)Writes the array of floats to the log file. The array cannot exceed 16 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signalslatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-
writeDoubleArray
Writes the array of doubles to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to write- Returns:
- Status of writing the data
-
writeDoubleArray
Writes the array of doubles to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signals- Returns:
- Status of writing the data
-
writeDoubleArray
public static StatusCode writeDoubleArray(String name, double[] values, String units, double latencySeconds)Writes the array of doubles to the log file. The array cannot exceed 8 elements.- Parameters:
name
- Name of the signalvalues
- Array of values to writeunits
- Units of the signalslatencySeconds
- Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log- Returns:
- Status of writing the data
-