Class 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.public class HootAutoReplay
- Inheritance
-
HootAutoReplay
- Inherited Members
Remarks
"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, aVision
class with a double[] cameraPose input would register the input using:
private readonly HootAutoReplay autoReplay = new HootAutoReplay()
.WithDoubleArray(
"Vision/CameraPose", () => 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 HootReplay and then updated in your robot code using the provided setter.
Methods
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.
public void Update()
WithBoolean(string, Func<bool>, Action<SignalMeasurement<bool>>)
Registers the boolean as a Hoot-Replayed input.
public HootAutoReplay WithBoolean(string name, Func<bool> getter, Action<SignalMeasurement<bool>> setter)
Parameters
namestringName of the signal in the log
getterFunc<bool>Function that returns the current value of the input
setterAction<SignalMeasurement<bool>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithBooleanArray(string, Func<bool[]>, Action<SignalMeasurement<bool[]>>)
Registers the array of booleans as a Hoot-Replayed input.
public HootAutoReplay WithBooleanArray(string name, Func<bool[]> getter, Action<SignalMeasurement<bool[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<bool[]>Function that returns the current value of the input
setterAction<SignalMeasurement<bool[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithDouble(string, Func<double>, Action<SignalMeasurement<double>>)
Registers the double as a Hoot-Replayed input.
public HootAutoReplay WithDouble(string name, Func<double> getter, Action<SignalMeasurement<double>> setter)
Parameters
namestringName of the signal in the log
getterFunc<double>Function that returns the current value of the input
setterAction<SignalMeasurement<double>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithDoubleArray(string, Func<double[]>, Action<SignalMeasurement<double[]>>)
Registers the array of doubles as a Hoot-Replayed input.
public HootAutoReplay WithDoubleArray(string name, Func<double[]> getter, Action<SignalMeasurement<double[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<double[]>Function that returns the current value of the input
setterAction<SignalMeasurement<double[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithFloat(string, Func<float>, Action<SignalMeasurement<float>>)
Registers the float as a Hoot-Replayed input.
public HootAutoReplay WithFloat(string name, Func<float> getter, Action<SignalMeasurement<float>> setter)
Parameters
namestringName of the signal in the log
getterFunc<float>Function that returns the current value of the input
setterAction<SignalMeasurement<float>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithFloatArray(string, Func<float[]>, Action<SignalMeasurement<float[]>>)
Registers the array of floats as a Hoot-Replayed input.
public HootAutoReplay WithFloatArray(string name, Func<float[]> getter, Action<SignalMeasurement<float[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<float[]>Function that returns the current value of the input
setterAction<SignalMeasurement<float[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithInteger(string, Func<long>, Action<SignalMeasurement<long>>)
Registers the integer as a Hoot-Replayed input.
public HootAutoReplay WithInteger(string name, Func<long> getter, Action<SignalMeasurement<long>> setter)
Parameters
namestringName of the signal in the log
getterFunc<long>Function that returns the current value of the input
setterAction<SignalMeasurement<long>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithIntegerArray(string, Func<long[]>, Action<SignalMeasurement<long[]>>)
Registers the array of integers as a Hoot-Replayed input.
public HootAutoReplay WithIntegerArray(string name, Func<long[]> getter, Action<SignalMeasurement<long[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<long[]>Function that returns the current value of the input
setterAction<SignalMeasurement<long[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithRaw(string, Func<byte[]>, Action<SignalMeasurement<byte[]>>)
Registers the raw data bytes as a Hoot-Replayed input.
public HootAutoReplay WithRaw(string name, Func<byte[]> getter, Action<SignalMeasurement<byte[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<byte[]>Function that returns the current value of the input
setterAction<SignalMeasurement<byte[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithSchemaValue(string, string, HootSchemaType, byte[], Func<byte[]>, Action<SignalMeasurement<byte[]>>)
Registers the schema-serialized bytes as a Hoot-Replayed input.
public HootAutoReplay WithSchemaValue(string name, string schemaName, HootSchemaType type, byte[] schema, Func<byte[]> getter, Action<SignalMeasurement<byte[]>> setter)
Parameters
namestringName of the signal in the log
schemaNamestringName of the schema
typeHootSchemaTypeType of the schema, such as struct or protobuf
schemabyte[]Schema bytes to write
getterFunc<byte[]>Function that returns the current value of the input
setterAction<SignalMeasurement<byte[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithSchemaValue(string, string, HootSchemaType, string, Func<byte[]>, Action<SignalMeasurement<byte[]>>)
Registers the schema-serialized bytes as a Hoot-Replayed input.
public HootAutoReplay WithSchemaValue(string name, string schemaName, HootSchemaType type, string schema, Func<byte[]> getter, Action<SignalMeasurement<byte[]>> setter)
Parameters
namestringName of the signal in the log
schemaNamestringName of the schema
typeHootSchemaTypeType of the schema, such as struct or protobuf
schemastringSchema string to write
getterFunc<byte[]>Function that returns the current value of the input
setterAction<SignalMeasurement<byte[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithString(string, Func<string>, Action<SignalMeasurement<string>>)
Registers the string as a Hoot-Replayed input.
public HootAutoReplay WithString(string name, Func<string> getter, Action<SignalMeasurement<string>> setter)
Parameters
namestringName of the signal in the log
getterFunc<string>Function that returns the current value of the input
setterAction<SignalMeasurement<string>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object
WithStringArray(string, Func<string[]>, Action<SignalMeasurement<string[]>>)
Registers the array of strings as a Hoot-Replayed input.
public HootAutoReplay WithStringArray(string name, Func<string[]> getter, Action<SignalMeasurement<string[]>> setter)
Parameters
namestringName of the signal in the log
getterFunc<string[]>Function that returns the current value of the input
setterAction<SignalMeasurement<string[]>>Function that sets the input to a new value
Returns
- HootAutoReplay
this object