|
CTRE Phoenix 6 C++ 26.0.0-beta-1
|
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 | AddSchema (std::string_view name, HootSchemaType type, std::span< uint8_t const > schema) |
| Adds the schema to the log file. | |
| static ctre::phoenix::StatusCode | AddSchema (std::string_view name, HootSchemaType type, std::string_view schema) |
| Adds the schema to the log file. | |
| static bool | HasSchema (std::string_view name, HootSchemaType type) |
| Checks if the schema has already been added to the log files. | |
| static ctre::phoenix::StatusCode | WriteSchemaValue (std::string_view name, std::string_view schema, HootSchemaType type, std::span< uint8_t const > data, units::time::second_t latencySeconds=0_s) |
| Writes the schema-serialized bytes to the log file. | |
| template<typename T , typename... I> requires wpi::StructSerializable<T, I...> | |
| static ctre::phoenix::StatusCode | WriteStruct (std::string_view name, T const &value, I const &... info, units::time::second_t latencySeconds=0_s) |
| Writes the WPILib Struct to the log file. | |
| template<typename T , typename... I> requires wpi::StructSerializable<T, I...> | |
| static ctre::phoenix::StatusCode | WriteStructArray (std::string_view name, std::span< T const > values, I const &... info, units::time::second_t latencySeconds=0_s) |
| Writes the array of WPILib Structs to the log file. | |
| template<wpi::ProtobufSerializable T> | |
| static ctre::phoenix::StatusCode | WriteProtobuf (std::string_view name, T const &value, units::time::second_t latencySeconds=0_s) |
| Writes the protobuf to the log file. | |
| static ctre::phoenix::StatusCode | WriteRaw (std::string_view name, std::span< uint8_t const > data, 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 > requires 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. | |
| static ctre::phoenix::StatusCode | WriteBooleanArray (std::string_view name, std::span< bool 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::span< uint8_t const > values, units::time::second_t latencySeconds=0_s) |
| Writes the array of booleans to the log file. | |
| static ctre::phoenix::StatusCode | WriteIntegerArray (std::string_view name, std::span< int64_t 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 | WriteFloatArray (std::string_view name, std::span< float 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 | WriteDoubleArray (std::string_view name, std::span< double 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 | WriteStringArray (std::string_view name, std::span< std::string_view const > values, units::time::second_t latencySeconds=0_s) |
| Writes the array of strings to the log file. | |
| static ctre::phoenix::StatusCode | WriteStringArray (std::string_view name, std::span< std::string const > values, units::time::second_t latencySeconds=0_s) |
| Writes the array of strings to the log file. | |
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.
During Hoot Replay, the signal logger always runs while replay is running. All custom signals written during replay will be automatically placed under hoot_replay/. Additionally, the log will contain all status signals and custom signals from the original log.
|
static |
Adds the schema to the log file.
In an FRC robot program, users can call WriteStruct and WriteProtobuf to directly write schema values instead.
The schema name should typically exactly match the name of the type (without any extra prefix or suffix).
For protobuf, first register all relevant file descriptors by file name (such as "geometry2d.proto"). Then, for each top-level type being used, add a separate empty schema with the full name of the type (such as "wpi.proto.ProtobufPose2d").
| name | Name of the schema |
| type | Type of the schema, such as struct or protobuf |
| schema | Schema bytes to write |
|
inlinestatic |
Adds the schema to the log file.
In an FRC robot program, users can call WriteStruct and WriteProtobuf to directly write schema values instead.
The schema name should typically exactly match the name of the type (without any extra prefix or suffix).
For protobuf, first register all relevant file descriptors by file name (such as "geometry2d.proto"). Then, for each top-level type being used, add a separate empty schema with the full name of the type (such as "wpi.proto.ProtobufPose2d").
| name | Name of the schema |
| type | Type of the schema, such as struct or protobuf |
| schema | Schema string to write |
|
static |
Enables or disables auto logging.
Auto logging is only supported on the roboRIO. Additionally, on a roboRIO 1, auto logging will only be active if a USB flash drive is present.
When auto logging is enabled, logging is started by any of the following (whichever occurs first):
After auto logging has started the log once, logging will not be automatically stopped or restarted by auto logging.
| enable | Whether to enable auto logging |
|
static |
Checks if the schema has already been added to the log files.
| name | Name of the schema |
| type | Type of the schema, such as struct or protobuf |
|
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.
This is ignored during Hoot Replay, where the hoot log will always be written to a subfolder next to the log being replayed.
| path | Folder path for the log files; path must exist |
|
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.
This is ignored during Hoot Replay, where logging is automatically started when Hoot Replay starts running or restarts.
|
static |
Stops logging status signals.
Stops regardless of auto logging status.
This is ignored during Hoot Replay, where logging is automatically stopped when Hoot Replay is stopped or reaches the end of the file.
|
inlinestatic |
Writes the boolean to the log file.
| name | Name of the signal |
| value | Value to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of booleans to the log file.
| name | Name of the signal |
| values | Span of values to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of booleans to the log file.
| name | Name of the signal |
| values | Span of values to write, passed as a span of bytes |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the double to the log file.
| name | Name of the signal |
| value | Value to write |
| units | Units of the signal |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of doubles to the log file.
| name | Name of the signal |
| values | Span of values to write |
| units | Units of the signals |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the float to the log file.
| name | Name of the signal |
| value | Value to write |
| units | Units of the signal |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of floats to the log file.
| name | Name of the signal |
| values | Span of values to write |
| units | Units of the signals |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the integer to the log file.
| name | Name of the signal |
| value | Value to write |
| units | Units of the signal |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of integers to the log file.
| name | Name of the signal |
| values | Span of values to write |
| units | Units of the signals |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the protobuf to the log file.
| name | Name of the signal |
| value | Value to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the raw data bytes to the log file.
| name | Name of the signal |
| data | Span of raw data bytes |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the schema-serialized bytes to the log file.
In an FRC robot program, users can call WriteStruct, WriteStructArray, and WriteProtobuf to directly write schema values instead.
The name of the associated schema must exactly match the type of the data (such as "Pose2d" or "wpi.proto.ProtobufPose2d"). Additionally, the schema name must be registered with AddSchema before calling this API.
| name | Name of the signal |
| schema | Name of the associated schema |
| type | Type of the associated schema, such as struct or protobuf |
| data | Span of serialized data bytes |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the string to the log file.
| name | Name of the signal |
| value | Value to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of strings to the log file.
| name | Name of the signal |
| values | Span of values to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of strings to the log file.
| name | Name of the signal |
| values | Span of values to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the WPILib Struct to the log file.
| name | Name of the signal |
| value | Value to write |
| info | Optional struct type info |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the array of WPILib Structs to the log file.
| name | Name of the signal |
| values | Values to write |
| info | Optional struct type info |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |
|
inlinestatic |
Writes the unit value to the log file.
| name | Name of the signal |
| value | Value to write |
| latencySeconds | Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log |