|
Valor 6800 1.0
|
Combines Lidar distance measurements and debounce logic. More...
#include <LaserProximitySensor.h>
Public Member Functions | |
| LaserProximitySensor (frc::TimedRobot &robot) | |
| Construct a new LaserProximitySensor object. | |
| void | setThresholdDistance (units::millimeter_t threshold) |
| Set the threshold distance for triggering the sensor. | |
| void | reset () override |
| Reset the sensor state, including Lidar and debounce logic. | |
| LaserProximityData | get () |
| Get the current sensor data. | |
| void | setGetter (std::function< units::millimeter_t()> getter) |
| Set the getter function for the Lidar sensor. | |
Public Member Functions inherited from valor::BaseSensor< LaserProximityData > | |
| void | setGetter (std::function< LaserProximityData()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | applyPostProcessing (std::function< LaserProximityData(LaserProximityData)> func) |
| Set a post-processing function for sensor data. | |
| LaserProximityData | 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) |
Public Member Functions inherited from valor::LidarSensor | |
| LidarSensor (frc::TimedRobot &robot) | |
| Construct a new LidarSensor object. | |
| units::millimeter_t | getMaxDistance () |
| Get the maximum distance threshold for the Lidar sensor. | |
| void | setMaxDistance (units::millimeter_t maxDistance) |
| Set the maximum distance threshold for the Lidar sensor. | |
| void | setupSim (std::function< frc::Pose2d()> robotPoseGetter, frc::Transform2d sensorPosition, std::vector< sim::FieldFeature > features) |
| void | setGetter (std::function< units::millimeter_t()> getter) |
Public Member Functions inherited from valor::BaseSensor< units::millimeter_t > | |
| void | setGetter (std::function< units::millimeter_t()> _lambda) |
| Set the lambda function to fetch sensor data. | |
| void | applyPostProcessing (std::function< units::millimeter_t(units::millimeter_t)> func) |
| Set a post-processing function for sensor data. | |
| units::millimeter_t | get () |
| Get the current sensor state. | |
Public Member Functions inherited from valor::DebounceSensor | |
| 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 > | |
| 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. | |
Protected Member Functions | |
| void | calculate () override |
| Perform proximity sensor-specific calculations. | |
| void | refresh () override |
| Refresh the sensor state. | |
Protected Member Functions inherited from valor::BaseSensor< LaserProximityData > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
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. | |
Protected Member Functions inherited from valor::LidarSensor | |
| void | calculate () override |
| Perform Lidar-specific calculations. | |
Protected Member Functions inherited from valor::BaseSensor< units::millimeter_t > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
Protected Member Functions inherited from valor::BaseSensor< bool > | |
| BaseSensor (frc::TimedRobot &robot) | |
| Construct a new BaseSensor object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from valor::Loggable | |
| static units::millisecond_t | GetLoggingTime () |
Protected Attributes inherited from valor::BaseSensor< LaserProximityData > | |
| std::function< LaserProximityData()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< LaserProximityData(LaserProximityData)> | postProcessor |
| Lambda function to post-process sensor data. | |
| LaserProximityData | prevState |
| Previous and current sensor states. | |
| LaserProximityData | currState |
| frc::Timer | profiler |
Protected Attributes inherited from valor::LidarSensor | |
| std::unique_ptr< SimState > | simState |
Protected Attributes inherited from valor::BaseSensor< units::millimeter_t > | |
| std::function< units::millimeter_t()> | sensorLambda |
| Lambda function to fetch sensor data. | |
| std::function< units::millimeter_t(units::millimeter_t)> | postProcessor |
| Lambda function to post-process sensor data. | |
| units::millimeter_t | prevState |
| Previous and current sensor states. | |
| units::millimeter_t | currState |
| frc::Timer | profiler |
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 |
Combines Lidar distance measurements and debounce logic.
This class integrates Lidar sensor data with debounce functionality to provide reliable proximity sensing.
|
explicit |
Construct a new LaserProximitySensor object.
| robot | Reference to the robot, used to schedule the calculate method. |
|
overrideprotectedvirtual |
Perform proximity sensor-specific calculations.
This method is called every 10ms and processes the sensor data.
Implements valor::BaseSensor< LaserProximityData >.
|
inline |
Get the current sensor data.
|
overrideprotectedvirtual |
Refresh the sensor state.
Updates prevState and currState by fetching new data using the lambda function. If a post-processing function is set, it is applied to the fetched data.
Reimplemented from valor::BaseSensor< LaserProximityData >.
|
overridevirtual |
Reset the sensor state, including Lidar and debounce logic.
Reimplemented from valor::BaseSensor< LaserProximityData >.
| void valor::LaserProximitySensor::setGetter | ( | std::function< units::millimeter_t()> | getter | ) |
Set the getter function for the Lidar sensor.
| getter | Lambda function to fetch Lidar distance data. |
| void valor::LaserProximitySensor::setThresholdDistance | ( | units::millimeter_t | threshold | ) |
Set the threshold distance for triggering the sensor.
| threshold | Distance in millimeters. |