phoenix6.hoot_auto_replay

Module Contents

Attributes

phoenix6.hoot_auto_replay.USE_WPILIB = 'True'
phoenix6.hoot_auto_replay.T
class phoenix6.hoot_auto_replay.HootAutoReplay

Class for handling automatic logging and replay of custom signal inputs. Each subsystem typically creates a new instance of this class.

Note that all StatusSignals are automatically logged and replayed, so they do not need to be registered with this class. Additionally, the SignalLogger must be separately started at the start of the robot program.

“Inputs” are signals measured directly from devices that should be replayed unmodified. By comparison, a processed signal, such as a signal indicating that a mechanism has reached the target, is considered an “output”. This class should only be used with inputs.

Inputs are registered with a getter that returns a value to log and a setter that updates the value in your robot program. For example, a Vision class with a self._camera_pose: Pose2d input would register the input using:

``` def _set_camera_pose(val: SignalMeasurement[Pose2d]):

self._camera_pose = val.value

self._auto_replay = (

HootAutoReplay() .with_struct(

“Vision/CameraPose”, Pose2d, lambda: self._camera_pose, _set_camera_pose

)

)

After registering all relevant inputs, call self.update() periodically to perform the following:

  • In normal/simulated robot operation, registered inputs will be fetched from your robot code using the provided getter, and then logged using the SignalLogger.

  • During Hoot Replay, registered inputs will be fetched from HootReplay and then updated in your robot code using the provided setter.

update()

Updates the state of the robot program by doing one of the following:

  • In normal/simulated robot operation, registered inputs will be fetched from your robot code using the provided getter, and then logged using the SignalLogger.

  • During Hoot Replay, registered inputs will be fetched from HootReplay and then updated in your robot code using the provided setter.

This should be called periodically, typically in the subsystem.

with_timestamp_replay() HootAutoReplay

Registers Timer.getTimestamp() logging and playback with this instance. This should only be applied to one instance in the robot program.

The update() of this HootAutoReplay instance must be run at the start of robotPeriodic() before the CommandScheduler is run.

Returns:

this object

Return type:

HootAutoReplay

with_joystick_replay() HootAutoReplay

Registers joystick logging and playback with this instance. This should only be applied to one instance in the robot program.

To get joysticks to playback during Hoot Replay, “Turn off DS” must be checked in the simulation GUI (under “DS” at the top of the window). Additionally, the update() of this HootAutoReplay instance must be run at the start of robotPeriodic() before the CommandScheduler is run.

Returns:

this object

Return type:

HootAutoReplay

with_schema_value(name: str, schema_name: str, schema_type: phoenix6.hoot_schema_type.HootSchemaType, schema: bytes | str, getter: Callable[[], bytes], setter: Callable[[phoenix6.status_signal.SignalMeasurement[bytearray]], None]) HootAutoReplay

Registers the schema-serialized bytes as a Hoot-Replayed input.

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

  • schema_name (str) – Name of the schema

  • schema_type (HootSchemaType) – Type of the schema, such as struct or protobuf

  • schema (bytes | str) – Schema bytes to write

  • getter (Callable[[], bytes]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[bytearray]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_struct(name: str, struct: type[T], getter: Callable[[], T], setter: Callable[[phoenix6.status_signal.SignalMeasurement[T]], None]) HootAutoReplay

Registers the WPILib Struct as a Hoot-Replayed input.

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

  • struct (type[T]) – Type of struct to serialize

  • getter (Callable[[], T]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[T]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_struct_array(name: str, struct: type[T], getter: Callable[[], list[T]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[T]]], None]) HootAutoReplay

Registers the array of WPILib Structs as a Hoot-Replayed input.

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

  • struct (type[T]) – Type of struct to serialize

  • getter (Callable[[], list[T]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[T]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_raw(name: str, getter: Callable[[], bytes], setter: Callable[[phoenix6.status_signal.SignalMeasurement[bytearray]], None]) HootAutoReplay

Registers the raw data bytes as a Hoot-Replayed input.

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

  • getter (Callable[[], bytes]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[bytearray]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_boolean(name: str, getter: Callable[[], bool], setter: Callable[[phoenix6.status_signal.SignalMeasurement[bool]], None]) HootAutoReplay

Registers the boolean as a Hoot-Replayed input.

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

  • getter (Callable[[], bool]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[bool]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_integer(name: str, getter: Callable[[], int], setter: Callable[[phoenix6.status_signal.SignalMeasurement[int]], None]) HootAutoReplay

Registers the integer as a Hoot-Replayed input.

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

  • getter (Callable[[], int]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[int]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_float(name: str, getter: Callable[[], float], setter: Callable[[phoenix6.status_signal.SignalMeasurement[float]], None]) HootAutoReplay

Registers the float as a Hoot-Replayed input.

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

  • getter (Callable[[], float]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[float]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_double(name: str, getter: Callable[[], float], setter: Callable[[phoenix6.status_signal.SignalMeasurement[float]], None]) HootAutoReplay

Registers the double as a Hoot-Replayed input.

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

  • getter (Callable[[], float]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[float]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_string(name: str, getter: Callable[[], str], setter: Callable[[phoenix6.status_signal.SignalMeasurement[str]], None]) HootAutoReplay

Registers the string as a Hoot-Replayed input.

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

  • getter (Callable[[], str]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[str]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_boolean_array(name: str, getter: Callable[[], list[bool]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[bool]]], None]) HootAutoReplay

Registers the array of booleans as a Hoot-Replayed input.

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

  • getter (Callable[[], list[bool]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[bool]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_integer_array(name: str, getter: Callable[[], list[int]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[int]]], None]) HootAutoReplay

Registers the array of integers as a Hoot-Replayed input.

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

  • getter (Callable[[], list[int]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[int]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_float_array(name: str, getter: Callable[[], list[float]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[float]]], None]) HootAutoReplay

Registers the array of floats as a Hoot-Replayed input.

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

  • getter (Callable[[], list[float]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[float]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_double_array(name: str, getter: Callable[[], list[float]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[float]]], None]) HootAutoReplay

Registers the array of doubles as a Hoot-Replayed input.

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

  • getter (Callable[[], list[float]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[float]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay

with_string_array(name: str, getter: Callable[[], list[str]], setter: Callable[[phoenix6.status_signal.SignalMeasurement[list[str]]], None]) HootAutoReplay

Registers the array of strings as a Hoot-Replayed input.

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

  • getter (Callable[[], list[str]]) – Function that returns the current value of the input

  • setter (Callable[[SignalMeasurement[list[str]]], None]) – Function that sets the input to a new value

Returns:

this object

Return type:

HootAutoReplay