|
Valkyrie 2026
|
Represents a processed analog controller input. More...
#include <valkyrie/Gamepad.h>
Public Member Functions | |
| void | SetGetter (std::function< double()> getter) |
| Sets the function used to retrieve the raw input value. | |
| void | Reset () override |
| Resets the internal filter state. | |
| bool | Active () const |
| Checks whether the analog input is currently active. | |
| AnalogValue & | SetDeadband (double deadband) |
| Sets the deadband applied to the input. | |
| AnalogValue & | SetRange (double min, double max=1) |
| Sets the output range of the processed analog input. | |
| double | GetDeadband () const |
| Gets the configured deadband threshold. | |
| double | GetMaxValue () const |
| Gets the configured maximum output value. | |
| double | GetMinValue () const |
| Gets the configured minimum output value. | |
| AnalogValue & | SetPolynomial (int poly) |
| Sets the polynomial response curve exponent. | |
| int | GetPolynomial () const |
| Gets the configured polynomial exponent. | |
| void | Calculate () override |
| Updates the internal filter with the current processed value. | |
| double | GetFiltered () const |
| Gets the filtered analog value. | |
| AnalogValue & | SetFilterSize (int size) |
| Sets the moving-average filter window size. | |
| AnalogValue & | SetFilterTime (units::second_t time) |
| Sets the moving-average filter duration. | |
| Public Member Functions inherited from valor::sensors::BaseSensor< double > | |
| void | SetGetter (std::function< double()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | ApplyPostProcessing (std::function< double(double)> func) |
| Set a post-processing function for sensor data. | |
| double | Get () const |
| Get the current sensor state. | |
| void | Refresh () override |
| Refresh the sensor state. | |
| Public Member Functions inherited from valor::Loggable | |
| Loggable (std::string_view name) | |
| Construct a Loggable that registers a top-level table name. | |
| Loggable (std::shared_ptr< nt::NetworkTable > table) | |
| Construct a Loggable that uses an existing NetworkTable. | |
| Loggable ()=default | |
| Default construct an uninitialized Loggable. | |
| void | LogChild (std::string_view name, Loggable *child) |
| Register a child Loggable under a named subtree. | |
| void | LogChild (std::string_view name, wpi::Sendable *child) |
| Register a child Sendable under a named subtree. | |
| bool | WriteLog (std::string_view field, bool data) |
| double | WriteLog (std::string_view field, double data) |
| void | WriteLog (std::string_view field, const std::vector< double > &data) |
|
template<typename U> requires units::traits::is_unit_t_v<U> | |
| U | WriteLog (std::string_view field, U data) |
| void | WriteLog (std::string_view field, std::string_view data) |
|
template<typename E> requires std::is_enum_v<E> | |
| void | WriteLog (std::string_view field, E data) |
|
template<typename T> requires wpi::StructSerializable<T> && (!std::is_arithmetic_v<T>) | |
| void | WriteLog (std::string_view field, const T &data) |
|
template<typename T> requires wpi::StructSerializable<T> && (!std::is_arithmetic_v<T>) | |
| void | WriteLog (std::string_view field, const std::vector< T > &data) |
| bool | ReadLog (std::string_view field, bool defaultValue) |
| double | ReadLog (std::string_view field, double defaultValue) |
|
template<typename U> requires units::traits::is_unit_t_v<U> | |
| U | ReadLog (std::string_view field, U defaultValue) |
Additional Inherited Members | |
| Static Public Member Functions inherited from valor::Loggable | |
| static constexpr Loggable & | GetRoot () |
| Static Public Attributes inherited from valor::sensors::BaseSensorCore | |
| static constexpr units::millisecond_t | LOOP_PERIOD = frc::TimedRobot::kDefaultPeriod / 2 |
| Protected Member Functions inherited from valor::Loggable | |
| virtual void | OnLoggingStart () |
| Hook invoked when logging is started for this object. | |
| virtual void | LoggablePeriodic () |
| Periodic callback for logging updates. | |
| Protected Attributes inherited from valor::sensors::BaseSensor< double > | |
| std::function< double()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< double(double)> | postProcessor |
| Lambda function to post-process sensor data. | |
| double | prevState |
| Previous and current sensor states. | |
| double | currState |
Represents a processed analog controller input.
AnalogValue wraps a raw controller axis and provides optional:
This class inherits from BaseSensor<double> to integrate with the sensor abstraction framework
|
inline |
Checks whether the analog input is currently active.
An input is considered active if its processed value is nonzero.
|
inlineoverridevirtual |
Updates the internal filter with the current processed value.
Will automatically be called periodically by BaseSensor
Reimplemented from valor::sensors::BaseSensorCore.
|
inline |
Gets the configured deadband threshold.
|
inline |
Gets the filtered analog value.
|
inline |
Gets the configured maximum output value.
|
inline |
Gets the configured minimum output value.
|
inline |
Gets the configured polynomial exponent.
|
inlineoverridevirtual |
Resets the internal filter state.
Reimplemented from valor::sensors::BaseSensor< double >.
|
inline |
Sets the deadband applied to the input.
Input values whose magnitude is less than the deadband are treated as zero.
| deadband | Deadband threshold |
|
inline |
Sets the moving-average filter window size.
| size | Number of samples used in the moving average |
|
inline |
Sets the moving-average filter duration.
The filter size is computed using LOOP_PERIOD.
| time | Desired averaging duration |
| void valor::Gamepad::AnalogValue::SetGetter | ( | std::function< double()> | getter | ) |
Sets the function used to retrieve the raw input value.
Typically bound to one of the underlying XboxController axis getter functions.
| getter | Function returning the raw analog value |
|
inline |
Sets the polynomial response curve exponent.
Higher exponents reduce sensitivity near zero while preseving full-scale output
Examples:
|
inline |
Sets the output range of the processed analog input.
The processed input is linearly mapped into the range [min, max] after deadband removal and polynomial scaling.
| min | Minimum output magnitude immediately outside the deadband |
| max | Maximum output magnitude at full input |