Table of Contents

Class SignalLogger

Namespace
CTRE.Phoenix6
Assembly
Phoenix6.Hardware.dll

Static class for controlling the Phoenix 6 signal logger.

public static class SignalLogger
Inheritance
SignalLogger
Inherited Members

Remarks

This logs all the signals from the CAN buses into .hoot files. Each file name starts with the CANivore serial number or SocketCAN interface for a generic SocketCAN adapter (non-FRC Linux only), followed by the timestamp. In the header of a hoot file, the CANivore name and firmware version are logged in plain text.

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.

Methods

AddSchema(string, HootSchemaType, byte[])

Adds the schema to the log file.

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").
public static StatusCode AddSchema(string name, HootSchemaType type, byte[] data)

Parameters

name string

Name of the schema

type HootSchemaType

Type of the schema, such as struct or protobuf

data byte[]

Schema bytes to write

Returns

StatusCode

Status of adding the schema

AddSchema(string, HootSchemaType, string)

Adds the schema to the log file.

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").
public static StatusCode AddSchema(string name, HootSchemaType type, string data)

Parameters

name string

Name of the schema

type HootSchemaType

Type of the schema, such as struct or protobuf

data string

Schema string to write

Returns

StatusCode

Status of adding the schema

HasSchema(string, HootSchemaType)

Checks if the schema has already been added to the log files.

public static bool HasSchema(string name, HootSchemaType type)

Parameters

name string

Name of the schema

type HootSchemaType

Type of the schema, such as struct or protobuf

Returns

bool

Whether the schema has been added to the log files

SetPath(string)

Sets the destination for logging, restarting logger if the path changed.

public static StatusCode SetPath(string path)

Parameters

path string

Folder path for the log files; path must exist

Returns

StatusCode

Status of setting the path and restarting the log

Remarks

If this is not called or the path is left empty, the default path 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.

Start()

Starts logging status signals.

public static StatusCode Start()

Returns

StatusCode

Status of starting the logger

Remarks

This is ignored during Hoot Replay, where logging is automatically started when Hoot Replay starts running or restarts.

Stop()

Stops logging status signals.

public static StatusCode Stop()

Returns

StatusCode

Status of stopping the logger

Remarks

This is ignored during Hoot Replay, where logging is automatically stopped when Hoot Replay is stopped or reaches the end of the file.

WriteBoolean(string, bool, double)

Writes the boolean to the log file.

public static StatusCode WriteBoolean(string name, bool value, double latencySeconds = 0)

Parameters

name string

Name of the signal

value bool

Value to write

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteBooleanArray(string, bool[], double)

Writes the array of booleans to the log file.

public static StatusCode WriteBooleanArray(string name, bool[] values, double latencySeconds = 0)

Parameters

name string

Name of the signal

values bool[]

Array of values to write

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteDouble(string, double, string, double)

Writes the double to the log file.

public static StatusCode WriteDouble(string name, double value, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

value double

Value to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteDoubleArray(string, double[], string, double)

Writes the array of doubles to the log file.

public static StatusCode WriteDoubleArray(string name, double[] values, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

values double[]

Array of values to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteFloat(string, float, string, double)

Writes the float to the log file.

public static StatusCode WriteFloat(string name, float value, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

value float

Value to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteFloatArray(string, float[], string, double)

Writes the array of floats to the log file.

public static StatusCode WriteFloatArray(string name, float[] values, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

values float[]

Array of values to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteInteger(string, long, string, double)

Writes the integer to the log file.

public static StatusCode WriteInteger(string name, long value, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

value long

Value to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteIntegerArray(string, long[], string, double)

Writes the array of integers to the log file.

public static StatusCode WriteIntegerArray(string name, long[] values, string units = "", double latencySeconds = 0)

Parameters

name string

Name of the signal

values long[]

Array of values to write

units string

Units of the signal

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteRaw(string, byte[], double)

Writes the raw data bytes to the log file.

public static StatusCode WriteRaw(string name, byte[] data, double latencySeconds = 0)

Parameters

name string

Name of the signal

data byte[]

Raw data bytes

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteSchemaValue(string, string, HootSchemaType, byte[], double)

Writes the schema-serialized bytes to the log file.

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(string, HootSchemaType, byte[]) before calling this API.
public static StatusCode WriteSchemaValue(string name, string schema, HootSchemaType type, byte[] data, double latencySeconds = 0)

Parameters

name string

Name of the signal

schema string

Name of the associated schema

type HootSchemaType

Type of the associated schema, such as struct or protobuf

data byte[]

Serialized data bytes

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteString(string, string, double)

Writes the string to the log file.

public static StatusCode WriteString(string name, string value, double latencySeconds = 0)

Parameters

name string

Name of the signal

value string

Value to write

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data

WriteStringArray(string, string[], double)

Writes the array of strings to the log file.

public static StatusCode WriteStringArray(string name, string[] values, double latencySeconds = 0)

Parameters

name string

Name of the signal

values string[]

Array of values to write

latencySeconds double

Latency of the signal in seconds; this value is subtracted from the current time to get the timestamp written to the log

Returns

StatusCode

Status of writing the data