|
CTRE Phoenix 6 C++ 26.0.0-beta-1
|
Class for handling automatic logging and replay of custom signal inputs. More...
#include <ctre/phoenix6/HootAutoReplay.hpp>
Public Member Functions | |
| void | Update () const |
| Updates the state of the robot program by doing one of the following: | |
| HootAutoReplay & | WithTimestampReplay () |
| Registers Timer::GetTimestamp() logging and playback with this instance. | |
| HootAutoReplay & | WithJoystickReplay () |
| Registers joystick logging and playback with this instance. | |
| HootAutoReplay & | WithSchemaValue (std::string name, std::string schemaName, HootSchemaType type, std::span< uint8_t const > schema, std::function< std::span< uint8_t const >()> getter, std::function< void(SignalMeasurement< std::vector< uint8_t > >)> setter) |
| Registers the schema-serialized bytes as a Hoot-Replayed input. | |
| HootAutoReplay & | WithSchemaValue (std::string name, std::string schemaName, HootSchemaType type, std::string_view schema, std::function< std::span< uint8_t const >()> getter, std::function< void(SignalMeasurement< std::vector< uint8_t > >)> setter) |
| Registers the schema-serialized bytes as a Hoot-Replayed input. | |
| template<typename T , typename... I> requires wpi::StructSerializable<T, I...> | |
| HootAutoReplay & | WithStruct (std::string name, I &&... info, std::function< T const &()> getter, std::function< void(SignalMeasurement< T >)> setter) |
| Registers the WPILib Struct as a Hoot-Replayed input. | |
| template<typename T , typename... I> requires wpi::StructSerializable<T, I...> | |
| HootAutoReplay & | WithStructArray (std::string name, I &&... info, std::function< std::span< T const >()> getter, std::function< void(SignalMeasurement< std::vector< T > >)> setter) |
| Registers the array of WPILib Structs as a Hoot-Replayed input. | |
| template<wpi::ProtobufSerializable T> | |
| HootAutoReplay & | WithProtobuf (std::string name, std::function< T const &()> getter, std::function< void(SignalMeasurement< T >)> setter) |
| Registers the protobuf as a Hoot-Replayed input. | |
| HootAutoReplay & | WithRaw (std::string name, std::function< std::span< uint8_t const >()> getter, std::function< void(SignalMeasurement< std::vector< uint8_t > >)> setter) |
| Registers the raw data bytes as a Hoot-Replayed input. | |
| HootAutoReplay & | WithBoolean (std::string name, std::function< bool()> getter, std::function< void(SignalMeasurement< bool >)> setter) |
| Registers the boolean as a Hoot-Replayed input. | |
| HootAutoReplay & | WithInteger (std::string name, std::function< int64_t()> getter, std::function< void(SignalMeasurement< int64_t >)> setter) |
| Registers the integer as a Hoot-Replayed input. | |
| HootAutoReplay & | WithFloat (std::string name, std::function< float()> getter, std::function< void(SignalMeasurement< float >)> setter) |
| Registers the float as a Hoot-Replayed input. | |
| HootAutoReplay & | WithDouble (std::string name, std::function< double()> getter, std::function< void(SignalMeasurement< double >)> setter) |
| Registers the double as a Hoot-Replayed input. | |
| HootAutoReplay & | WithString (std::string name, std::function< std::string_view()> getter, std::function< void(SignalMeasurement< std::string >)> setter) |
| Registers the string as a Hoot-Replayed input. | |
| template<typename U > requires units::traits::is_unit_t_v<U> | |
| HootAutoReplay & | WithValue (std::string name, std::function< U()> getter, std::function< void(SignalMeasurement< U >)> setter) |
| Registers the unit value as a Hoot-Replayed input. | |
| HootAutoReplay & | WithBooleanArray (std::string name, std::function< std::span< bool const >()> getter, std::function< void(SignalMeasurement< std::vector< uint8_t > >)> setter) |
| Registers the array of booleans as a Hoot-Replayed input. | |
| HootAutoReplay & | WithBooleanArray (std::string name, std::function< std::span< uint8_t const >()> getter, std::function< void(SignalMeasurement< std::vector< uint8_t > >)> setter) |
| Registers the array of booleans as a Hoot-Replayed input. | |
| HootAutoReplay & | WithIntegerArray (std::string name, std::function< std::span< int64_t const >()> getter, std::function< void(SignalMeasurement< std::vector< int64_t > >)> setter) |
| Registers the array of integers as a Hoot-Replayed input. | |
| HootAutoReplay & | WithFloatArray (std::string name, std::function< std::span< float const >()> getter, std::function< void(SignalMeasurement< std::vector< float > >)> setter) |
| Registers the array of floats as a Hoot-Replayed input. | |
| HootAutoReplay & | WithDoubleArray (std::string name, std::function< std::span< double const >()> getter, std::function< void(SignalMeasurement< std::vector< double > >)> setter) |
| Registers the array of doubles as a Hoot-Replayed input. | |
| HootAutoReplay & | WithStringArray (std::string name, std::function< std::span< std::string_view const >()> getter, std::function< void(SignalMeasurement< std::vector< std::string > >)> setter) |
| Registers the array of strings as a Hoot-Replayed input. | |
| HootAutoReplay & | WithStringArray (std::string name, std::function< std::span< std::string const >()> getter, std::function< void(SignalMeasurement< std::vector< std::string > >)> setter) |
| Registers the array of strings as a Hoot-Replayed input. | |
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 Pose2d cameraPose input would register the input using:
After registering all relevant inputs, call Update() periodically to perform the following:
Note that for non-primitive types, the getter function must return a reference to or std::span over the original data. As a result, they cannot return temporary values. If a getter lambda must return a temporary value, capture a unique_ptr or shared_ptr in the lambda, then modify and return the value of the unique_ptr/shared_ptr.
|
inline |
Updates the state of the robot program by doing one of the following:
This should be called periodically, typically in the subsystem.
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithBoolean | ( | std::string | name, |
| std::function< bool()> | getter, | ||
| std::function< void(SignalMeasurement< bool >)> | setter ) |
Registers the boolean as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithBooleanArray | ( | std::string | name, |
| std::function< std::span< bool const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< uint8_t > >)> | setter ) |
Registers the array of booleans as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithBooleanArray | ( | std::string | name, |
| std::function< std::span< uint8_t const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< uint8_t > >)> | setter ) |
Registers the array of booleans as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithDouble | ( | std::string | name, |
| std::function< double()> | getter, | ||
| std::function< void(SignalMeasurement< double >)> | setter ) |
Registers the double as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithDoubleArray | ( | std::string | name, |
| std::function< std::span< double const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< double > >)> | setter ) |
Registers the array of doubles as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithFloat | ( | std::string | name, |
| std::function< float()> | getter, | ||
| std::function< void(SignalMeasurement< float >)> | setter ) |
Registers the float as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithFloatArray | ( | std::string | name, |
| std::function< std::span< float const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< float > >)> | setter ) |
Registers the array of floats as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithInteger | ( | std::string | name, |
| std::function< int64_t()> | getter, | ||
| std::function< void(SignalMeasurement< int64_t >)> | setter ) |
Registers the integer as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithIntegerArray | ( | std::string | name, |
| std::function< std::span< int64_t const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< int64_t > >)> | setter ) |
Registers the array of integers as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::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.
|
inline |
Registers the protobuf as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithRaw | ( | std::string | name, |
| std::function< std::span< uint8_t const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< uint8_t > >)> | setter ) |
Registers the raw data bytes as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithSchemaValue | ( | std::string | name, |
| std::string | schemaName, | ||
| HootSchemaType | type, | ||
| std::span< uint8_t const > | schema, | ||
| std::function< std::span< uint8_t const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< uint8_t > >)> | setter ) |
Registers the schema-serialized bytes as a Hoot-Replayed input.
| name | Name of the signal in the log |
| schemaName | Name of the schema |
| type | Type of the schema, such as struct or protobuf |
| schema | Schema bytes to write |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithSchemaValue | ( | std::string | name, |
| std::string | schemaName, | ||
| HootSchemaType | type, | ||
| std::string_view | schema, | ||
| std::function< std::span< uint8_t const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< uint8_t > >)> | setter ) |
Registers the schema-serialized bytes as a Hoot-Replayed input.
| name | Name of the signal in the log |
| schemaName | Name of the schema |
| type | Type of the schema, such as struct or protobuf |
| schema | Schema string to write |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithString | ( | std::string | name, |
| std::function< std::string_view()> | getter, | ||
| std::function< void(SignalMeasurement< std::string >)> | setter ) |
Registers the string as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithStringArray | ( | std::string | name, |
| std::function< std::span< std::string const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< std::string > >)> | setter ) |
Registers the array of strings as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithStringArray | ( | std::string | name, |
| std::function< std::span< std::string_view const >()> | getter, | ||
| std::function< void(SignalMeasurement< std::vector< std::string > >)> | setter ) |
Registers the array of strings as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
|
inline |
Registers the WPILib Struct as a Hoot-Replayed input.
| name | Name of the signal in the log |
| info | Optional struct type info |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
|
inline |
Registers the array of WPILib Structs as a Hoot-Replayed input.
| name | Name of the signal in the log |
| info | Optional struct type info |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |
| HootAutoReplay & ctre::phoenix6::HootAutoReplay::WithTimestampReplay | ( | ) |
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.
|
inline |
Registers the unit value as a Hoot-Replayed input.
| name | Name of the signal in the log |
| getter | Function that returns the current value of the input |
| setter | Function that sets the input to a new value |