|
Valor 6800 1.0
|
Sensor for debouncing and detecting rising/falling edges of boolean inputs. More...
#include <DebounceSensor.h>
Public Member Functions | |
| DebounceSensor (frc::TimedRobot &robot) | |
| Construct a new DebounceSensor object. | |
| void | setEdgeCallback (std::function< void()> _lambda) |
| Set a callback function for detecting any edge (rising or falling). | |
| void | setRisingEdgeCallback (std::function< void()> _lambda) |
| Set a callback function for detecting a rising edge. | |
| void | setFallingEdgeCallback (std::function< void()> _lambda) |
| Set a callback function for detecting a falling edge. | |
Public Member Functions inherited from valor::BaseSensor< bool > | |
| virtual void | reset () |
| Reset the sensor state. | |
| void | setGetter (std::function< bool()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | applyPostProcessing (std::function< bool(bool)> func) |
| Set a post-processing function for sensor data. | |
| bool | get () |
| Get the current sensor state. | |
Public Member Functions inherited from valor::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. | |
| void | setLoggingPeriod (units::millisecond_t period) |
| Set the minimum period between LoggablePeriodic() invocations. | |
| template<> | |
| decltype(Loggable::subscribers) ::iterator | addSubscriber (std::string_view field, const std::vector< bool > &defaultValue) |
| template<> | |
| void | WriteLogImpl (nt::Publisher *pub, const std::vector< bool > &data) |
| template<> | |
| std::vector< bool > | ReadLogImpl (nt::Subscriber *sub) |
Protected Member Functions | |
| void | calculate () override |
| Perform debounce-specific calculations. | |
Protected Member Functions inherited from valor::BaseSensor< bool > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
| virtual void | refresh () |
| Refresh the sensor state. | |
Protected Member Functions inherited from valor::Loggable | |
| Loggable (std::string_view name) | |
| Construct a Loggable that registers a top-level table name. | |
| Loggable () | |
| Default construct an uninitialized Loggable. | |
| virtual | ~Loggable ()=default |
| Virtual destructor. | |
| virtual void | OnLoggingStart () |
| Hook invoked when logging is started for this object. | |
| virtual void | LoggablePeriodic () |
| Periodic callback for logging updates. | |
| template<typename T > | |
| T | WriteLog (std::string_view field, const T &data) |
| Publish a value to NetworkTables under the given field. | |
| template<typename T > | |
| T | ReadLog (std::string_view field, const T &defaultValue={}) |
| Read a value from NetworkTables for the given field. | |
Additional Inherited Members | |
Static Public Member Functions inherited from valor::Loggable | |
| static units::millisecond_t | GetLoggingTime () |
Protected Attributes inherited from valor::BaseSensor< bool > | |
| std::function< bool()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< bool(bool)> | postProcessor |
| Lambda function to post-process sensor data. | |
| bool | prevState |
| Previous and current sensor states. | |
| bool | currState |
| frc::Timer | profiler |
Sensor for debouncing and detecting rising/falling edges of boolean inputs.
This class filters out noise in boolean inputs and detects edges (state changes).
Debouncing ensures that rapid state changes are treated as a single edge.
|
explicit |
Construct a new DebounceSensor object.
| robot | Reference to the robot, used to schedule the calculate method. |
|
overrideprotectedvirtual |
Perform debounce-specific calculations.
This method is called every 10ms and processes the boolean input to detect edges.
Implements valor::BaseSensor< bool >.
Reimplemented in valor::LaserProximitySensor.
Set a callback function for detecting any edge (rising or falling).
| _lambda | Lambda function to execute when an edge is detected. |
Set a callback function for detecting a falling edge.
| _lambda | Lambda function to execute when a falling edge is detected. |
Set a callback function for detecting a rising edge.
| _lambda | Lambda function to execute when a rising edge is detected. |