phoenix6.signal_logger#

Module Contents#

class phoenix6.signal_logger.SignalLogger#

Static class for controlling the Phoenix 6 signal logger.

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.

static set_path(path: str) phoenix6.status_code.StatusCode#

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 (str) – Folder path for the log files; path must exist

Returns:

Status of setting the path and restarting the log

Return type:

StatusCode

static start() phoenix6.status_code.StatusCode#

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 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

Return type:

StatusCode

static stop() phoenix6.status_code.StatusCode#

Stops logging status signals. Stops regardless of auto logging status.

Returns:

Status of stopping the logger

Return type:

StatusCode

static enable_auto_logging(enable: bool) phoenix6.status_code.StatusCode#

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 (bool) – Whether to enable auto logging

Returns:

Status of auto logging enable/disable

Return type:

StatusCode

static write_raw(name: str, data: bytes, size: int, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the raw data bytes to the log file. The data cannot exceed 64 bytes.

Parameters:
  • name (str) – Name of the signal

  • data (bytes) – Raw data bytes

  • size (int) – Size of the raw data (in bytes)

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_boolean(name: str, value: bool, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the boolean to the log file.

Parameters:
  • name (str) – Name of the signal

  • value – Value to write

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_integer(name: str, value: int, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the integer to the log file.

Parameters:
  • name (str) – Name of the signal

  • value – Value to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_float(name: str, value: float, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the float to the log file.

Parameters:
  • name (str) – Name of the signal

  • value – Value to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_double(name: str, value: float, units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the double to the log file.

Parameters:
  • name (str) – Name of the signal

  • value – Value to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_string(name: str, value: str, latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the string to the log file. The string cannot exceed 64 characters.

Parameters:
  • name (str) – Name of the signal

  • value – Value to write

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_boolean_array(name: str, value: list[bool], latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the array of booleans to the log file. The array cannot exceed 64 elements.

Parameters:
  • name (str) – Name of the signal

  • value – Array of values to write

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_integer_array(name: str, value: list[int], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the array of integers to the log file. The array cannot exceed 8 elements.

Parameters:
  • name (str) – Name of the signal

  • value – Array of values to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_float_array(name: str, value: list[float], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the array of floats to the log file. The array cannot exceed 16 elements.

Parameters:
  • name (str) – Name of the signal

  • value – Array of values to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode

static write_double_array(name: str, value: list[float], units: str = '', latency_seconds: phoenix6.units.second = 0) phoenix6.status_code.StatusCode#

Writes the array of doubles to the log file. The array cannot exceed 8 elements.

Parameters:
  • name (str) – Name of the signal

  • value – Array of values to write

  • units (str) – Units of the signal

  • latency_seconds (second) – 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

Return type:

StatusCode