CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
ctre::phoenix6::SignalLogger Class Reference

Static class for controlling the Phoenix 6 signal logger. More...

#include <ctre/phoenix6/SignalLogger.hpp>

Static Public Member Functions

static ctre::phoenix::StatusCode SetPath (const char *path)
 Sets the destination for logging, restarting logger if the path changed.
 
static ctre::phoenix::StatusCode Start ()
 Starts logging status signals.
 
static ctre::phoenix::StatusCode Stop ()
 Stops logging status signals.
 
static ctre::phoenix::StatusCode EnableAutoLogging (bool enable)
 Enables or disables auto logging.
 
static ctre::phoenix::StatusCode WriteRaw (std::string_view name, uint8_t const *data, uint8_t size, units::time::second_t latencySeconds=0_s)
 Writes the raw data bytes to the log file.
 
static ctre::phoenix::StatusCode WriteBoolean (std::string_view name, bool value, units::time::second_t latencySeconds=0_s)
 Writes the boolean to the log file.
 
static ctre::phoenix::StatusCode WriteInteger (std::string_view name, int64_t value, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the integer to the log file.
 
static ctre::phoenix::StatusCode WriteFloat (std::string_view name, float value, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the float to the log file.
 
static ctre::phoenix::StatusCode WriteDouble (std::string_view name, double value, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the double to the log file.
 
static ctre::phoenix::StatusCode WriteString (std::string_view name, std::string_view value, units::time::second_t latencySeconds=0_s)
 Writes the string to the log file.
 
template<typename U , typename = std::enable_if_t<units::traits::is_unit_t_v<U>>>
static ctre::phoenix::StatusCode WriteValue (std::string_view name, U value, units::time::second_t latencySeconds=0_s)
 Writes the unit value to the log file.
 
template<size_t N, typename = std::enable_if_t<(N <= 64U)>>
static ctre::phoenix::StatusCode WriteBooleanArray (std::string_view name, std::array< bool, N > const &values, units::time::second_t latencySeconds=0_s)
 Writes the array of booleans to the log file.
 
template<size_t N, typename = std::enable_if_t<(N <= 64U)>>
static ctre::phoenix::StatusCode WriteBooleanArray (std::string_view name, std::array< uint8_t, N > const &values, units::time::second_t latencySeconds=0_s)
 Writes the array of booleans to the log file.
 
static ctre::phoenix::StatusCode WriteBooleanArray (std::string_view name, std::vector< uint8_t > const &values, units::time::second_t latencySeconds=0_s)
 Writes the array of booleans to the log file.
 
template<size_t N, typename = std::enable_if_t<(N <= 8U)>>
static ctre::phoenix::StatusCode WriteIntegerArray (std::string_view name, std::array< int64_t, N > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of integers to the log file.
 
static ctre::phoenix::StatusCode WriteIntegerArray (std::string_view name, std::vector< int64_t > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of integers to the log file.
 
template<size_t N, typename = std::enable_if_t<(N <= 16U)>>
static ctre::phoenix::StatusCode WriteFloatArray (std::string_view name, std::array< float, N > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of floats to the log file.
 
static ctre::phoenix::StatusCode WriteFloatArray (std::string_view name, std::vector< float > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of floats to the log file.
 
template<size_t N, typename = std::enable_if_t<(N <= 8U)>>
static ctre::phoenix::StatusCode WriteDoubleArray (std::string_view name, std::array< double, N > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of doubles to the log file.
 
static ctre::phoenix::StatusCode WriteDoubleArray (std::string_view name, std::vector< double > const &values, std::string_view units="", units::time::second_t latencySeconds=0_s)
 Writes the array of doubles to the log file.
 

Detailed Description

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.

Member Function Documentation

◆ EnableAutoLogging()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::EnableAutoLogging ( bool enable)
static

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
enableWhether to enable auto logging
Returns
Status of auto logging enable/disable

◆ SetPath()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::SetPath ( const char * path)
static

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
pathFolder path for the log files; path must exist
Returns
Status of setting the path and restarting the log

◆ Start()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::Start ( )
static

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

◆ Stop()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::Stop ( )
static

Stops logging status signals.

Stops regardless of auto logging status.

Returns
Status of stopping the logger

◆ WriteBoolean()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteBoolean ( std::string_view name,
bool value,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the boolean to the log file.

Parameters
nameName of the signal
valueValue to write
latencySecondsLatency 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() [1/3]

template<size_t N, typename = std::enable_if_t<(N <= 64U)>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteBooleanArray ( std::string_view name,
std::array< bool, N > const & values,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of booleans to the log file.

The array cannot exceed 64 elements.

Parameters
nameName of the signal
valuesArray of values to write
latencySecondsLatency 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() [2/3]

template<size_t N, typename = std::enable_if_t<(N <= 64U)>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteBooleanArray ( std::string_view name,
std::array< uint8_t, N > const & values,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of booleans to the log file.

The array cannot exceed 64 elements.

Parameters
nameName of the signal
valuesArray of values to write, passed as an array of bytes
latencySecondsLatency 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() [3/3]

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteBooleanArray ( std::string_view name,
std::vector< uint8_t > const & values,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of booleans to the log file.

The array cannot exceed 64 elements.

Parameters
nameName of the signal
valuesVector of values to write; since vector<bool> is not a boolean array, this is passed as a vector<uint8_t> instead
latencySecondsLatency 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()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteDouble ( std::string_view name,
double value,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the double to the log file.

Parameters
nameName of the signal
valueValue to write
unitsUnits of the signal
latencySecondsLatency 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() [1/2]

template<size_t N, typename = std::enable_if_t<(N <= 8U)>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteDoubleArray ( std::string_view name,
std::array< double, N > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of doubles to the log file.

The array cannot exceed 8 elements.

Parameters
nameName of the signal
valuesArray of values to write
unitsUnits of the signals
latencySecondsLatency 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() [2/2]

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteDoubleArray ( std::string_view name,
std::vector< double > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of doubles to the log file.

The array cannot exceed 8 elements.

Parameters
nameName of the signal
valuesVector of values to write
unitsUnits of the signals
latencySecondsLatency 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()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteFloat ( std::string_view name,
float value,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the float to the log file.

Parameters
nameName of the signal
valueValue to write
unitsUnits of the signal
latencySecondsLatency 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() [1/2]

template<size_t N, typename = std::enable_if_t<(N <= 16U)>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteFloatArray ( std::string_view name,
std::array< float, N > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of floats to the log file.

The array cannot exceed 16 elements.

Parameters
nameName of the signal
valuesArray of values to write
unitsUnits of the signals
latencySecondsLatency 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() [2/2]

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteFloatArray ( std::string_view name,
std::vector< float > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of floats to the log file.

The array cannot exceed 16 elements.

Parameters
nameName of the signal
valuesVector of values to write
unitsUnits of the signals
latencySecondsLatency 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()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteInteger ( std::string_view name,
int64_t value,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the integer to the log file.

Parameters
nameName of the signal
valueValue to write
unitsUnits of the signal
latencySecondsLatency 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() [1/2]

template<size_t N, typename = std::enable_if_t<(N <= 8U)>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteIntegerArray ( std::string_view name,
std::array< int64_t, N > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of integers to the log file.

The array cannot exceed 8 elements.

Parameters
nameName of the signal
valuesArray of values to write
unitsUnits of the signals
latencySecondsLatency 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() [2/2]

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteIntegerArray ( std::string_view name,
std::vector< int64_t > const & values,
std::string_view units = "",
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the array of integers to the log file.

The array cannot exceed 8 elements.

Parameters
nameName of the signal
valuesVector of values to write
unitsUnits of the signals
latencySecondsLatency 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

◆ WriteRaw()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteRaw ( std::string_view name,
uint8_t const * data,
uint8_t size,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the raw data bytes to the log file.

The data cannot exceed 64 bytes.

Parameters
nameName of the signal
dataRaw data bytes
sizeSize of the raw data (in bytes)
latencySecondsLatency 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()

static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteString ( std::string_view name,
std::string_view value,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the string to the log file.

The string cannot exceed 64 characters.

Parameters
nameName of the signal
valueValue to write
latencySecondsLatency 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

◆ WriteValue()

template<typename U , typename = std::enable_if_t<units::traits::is_unit_t_v<U>>>
static ctre::phoenix::StatusCode ctre::phoenix6::SignalLogger::WriteValue ( std::string_view name,
U value,
units::time::second_t latencySeconds = 0_s )
inlinestatic

Writes the unit value to the log file.

Parameters
nameName of the signal
valueValue to write
latencySecondsLatency 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

The documentation for this class was generated from the following file: