Class HootAutoReplay
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 Pose2d cameraPose input would register the input using:
private final HootAutoReplay autoReplay = new HootAutoReplay()
.withStruct(
"Vision/CameraPose", Pose2d.struct,
() -> cameraPose, val -> cameraPose = val.value
);
After registering all relevant inputs, call 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
HootReplayand then updated in your robot code using the provided setter.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidupdate()Updates the state of the robot program by doing one of the following: In normal/simulated robot operation, registered signals will be fetched from your robot code using the provided getter, and then logged using theSignalLogger.final HootAutoReplaywithBoolean(String name, BooleanSupplier getter, Consumer<StatusSignal.SignalMeasurement<Boolean>> setter) Registers the boolean as a Hoot-Replayed input.final HootAutoReplaywithBooleanArray(String name, Supplier<boolean[]> getter, Consumer<StatusSignal.SignalMeasurement<boolean[]>> setter) Registers the array of booleans as a Hoot-Replayed input.final HootAutoReplaywithDouble(String name, DoubleSupplier getter, Consumer<StatusSignal.SignalMeasurement<Double>> setter) Registers the double as a Hoot-Replayed input.final HootAutoReplaywithDoubleArray(String name, Supplier<double[]> getter, Consumer<StatusSignal.SignalMeasurement<double[]>> setter) Registers the array of doubles as a Hoot-Replayed input.final HootAutoReplaywithFloat(String name, FloatSupplier getter, Consumer<StatusSignal.SignalMeasurement<Float>> setter) Registers the float as a Hoot-Replayed input.final HootAutoReplaywithFloatArray(String name, Supplier<float[]> getter, Consumer<StatusSignal.SignalMeasurement<float[]>> setter) Registers the array of floats as a Hoot-Replayed input.final HootAutoReplaywithInteger(String name, LongSupplier getter, Consumer<StatusSignal.SignalMeasurement<Long>> setter) Registers the integer as a Hoot-Replayed input.final HootAutoReplaywithIntegerArray(String name, Supplier<long[]> getter, Consumer<StatusSignal.SignalMeasurement<long[]>> setter) Registers the array of integers as a Hoot-Replayed input.Registers joystick logging and playback with this instance.final <T> HootAutoReplaywithProtobuf(String name, Protobuf<T, ?> proto, Supplier<T> getter, Consumer<StatusSignal.SignalMeasurement<T>> setter) Registers the protobuf as a Hoot-Replayed input.final HootAutoReplaywithRaw(String name, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the raw data bytes as a Hoot-Replayed input.final HootAutoReplaywithSchemaValue(String name, String schemaName, HootSchemaType type, byte[] schema, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the schema-serialized bytes as a Hoot-Replayed input.final HootAutoReplaywithSchemaValue(String name, String schemaName, HootSchemaType type, String schema, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the schema-serialized bytes as a Hoot-Replayed input.final HootAutoReplaywithString(String name, Supplier<String> getter, Consumer<StatusSignal.SignalMeasurement<String>> setter) Registers the string as a Hoot-Replayed input.final HootAutoReplaywithStringArray(String name, Supplier<String[]> getter, Consumer<StatusSignal.SignalMeasurement<String[]>> setter) Registers the array of strings as a Hoot-Replayed input.final <T> HootAutoReplaywithStruct(String name, Struct<T> struct, Supplier<T> getter, Consumer<StatusSignal.SignalMeasurement<T>> setter) Registers the WPILib Struct as a Hoot-Replayed input.final <T> HootAutoReplaywithStructArray(String name, Struct<T> struct, Supplier<T[]> getter, Consumer<StatusSignal.SignalMeasurement<T[]>> setter) Registers the array of WPILib Structs as a Hoot-Replayed input.RegistersTimer.getTimestamp()time logging and playback with this instance.final <U extends Unit,MEAS extends Measure<U>>
HootAutoReplaywithValue(String name, U units, Supplier<MEAS> getter, Consumer<StatusSignal.SignalMeasurement<MEAS>> setter) Registers the unit value as a Hoot-Replayed input.
-
Constructor Details
-
HootAutoReplay
public HootAutoReplay()
-
-
Method Details
-
update
Updates the state of the robot program by doing one of the following:- In normal/simulated robot operation, registered signals will be
fetched from your robot code using the provided getter, and then
logged using the
SignalLogger. - During Hoot Replay, registered signals will be fetched from
HootReplayand then updated in your robot code using the provided setter.
- In normal/simulated robot operation, registered signals will be
fetched from your robot code using the provided getter, and then
logged using the
-
withTimestampReplay
RegistersTimer.getTimestamp()time 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
-
withJoystickReplay
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
-
withSchemaValue
public final HootAutoReplay withSchemaValue(String name, String schemaName, HootSchemaType type, byte[] schema, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the schema-serialized bytes as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logschemaName- Name of the schematype- Type of the schema, such as struct or protobufschema- Schema bytes to writegetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withSchemaValue
public final HootAutoReplay withSchemaValue(String name, String schemaName, HootSchemaType type, String schema, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the schema-serialized bytes as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logschemaName- Name of the schematype- Type of the schema, such as struct or protobufschema- Schema string to writegetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withStruct
public final <T> HootAutoReplay withStruct(String name, Struct<T> struct, Supplier<T> getter, Consumer<StatusSignal.SignalMeasurement<T>> setter) Registers the WPILib Struct as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logstruct- Struct serialization implementationgetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withStructArray
public final <T> HootAutoReplay withStructArray(String name, Struct<T> struct, Supplier<T[]> getter, Consumer<StatusSignal.SignalMeasurement<T[]>> setter) Registers the array of WPILib Structs as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logstruct- Struct serialization implementationgetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withProtobuf
public final <T> HootAutoReplay withProtobuf(String name, Protobuf<T, ?> proto, Supplier<T> getter, Consumer<StatusSignal.SignalMeasurement<T>> setter) Registers the protobuf as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logproto- Protobuf serialization implementationgetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withRaw
public final HootAutoReplay withRaw(String name, Supplier<byte[]> getter, Consumer<StatusSignal.SignalMeasurement<byte[]>> setter) Registers the raw data bytes as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withBoolean
public final HootAutoReplay withBoolean(String name, BooleanSupplier getter, Consumer<StatusSignal.SignalMeasurement<Boolean>> setter) Registers the boolean as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withInteger
public final HootAutoReplay withInteger(String name, LongSupplier getter, Consumer<StatusSignal.SignalMeasurement<Long>> setter) Registers the integer as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withFloat
public final HootAutoReplay withFloat(String name, FloatSupplier getter, Consumer<StatusSignal.SignalMeasurement<Float>> setter) Registers the float as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withDouble
public final HootAutoReplay withDouble(String name, DoubleSupplier getter, Consumer<StatusSignal.SignalMeasurement<Double>> setter) Registers the double as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withString
public final HootAutoReplay withString(String name, Supplier<String> getter, Consumer<StatusSignal.SignalMeasurement<String>> setter) Registers the string as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withValue
public final <U extends Unit,MEAS extends Measure<U>> HootAutoReplay withValue(String name, U units, Supplier<MEAS> getter, Consumer<StatusSignal.SignalMeasurement<MEAS>> setter) Registers the unit value as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the logunits- Units to use for logging the measuregetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withBooleanArray
public final HootAutoReplay withBooleanArray(String name, Supplier<boolean[]> getter, Consumer<StatusSignal.SignalMeasurement<boolean[]>> setter) Registers the array of booleans as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withIntegerArray
public final HootAutoReplay withIntegerArray(String name, Supplier<long[]> getter, Consumer<StatusSignal.SignalMeasurement<long[]>> setter) Registers the array of integers as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withFloatArray
public final HootAutoReplay withFloatArray(String name, Supplier<float[]> getter, Consumer<StatusSignal.SignalMeasurement<float[]>> setter) Registers the array of floats as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withDoubleArray
public final HootAutoReplay withDoubleArray(String name, Supplier<double[]> getter, Consumer<StatusSignal.SignalMeasurement<double[]>> setter) Registers the array of doubles as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-
withStringArray
public final HootAutoReplay withStringArray(String name, Supplier<String[]> getter, Consumer<StatusSignal.SignalMeasurement<String[]>> setter) Registers the array of strings as a Hoot-Replayed input.- Parameters:
name- Name of the signal in the loggetter- Function that returns the current value of the inputsetter- Function that sets the input to a new value- Returns:
- this object
-