Valkyrie 2026
Loading...
Searching...
No Matches
LaserProximitySensor.h
1#pragma once
2
3#include <string>
4
5#include <units/length.h>
6#include <valkyrie/sensors/DebounceSensor.h>
7#include <valkyrie/sensors/LidarSensor.h>
8
9namespace valor {
10namespace sensors {
11
16 units::millimeter_t distance;
17 bool triggered;
18};
19
26class LaserProximitySensor : public BaseSensor<LaserProximityData>, public LidarSensor, public DebounceSensor {
27 public:
34
40 inline void SetThresholdDistance(units::millimeter_t threshold) { thresholdDistance = threshold; }
41
47 inline units::millimeter_t GetThresholdDistance() const { return thresholdDistance; }
48
52 void Reset() override;
53
60
66 void SetGetter(std::function<units::millimeter_t()> getter);
67
68 protected:
74 void Calculate() override;
75
76 void Refresh() override;
77
78 private:
79 units::millimeter_t thresholdDistance;
80};
81
82} // namespace sensors
83} // namespace valor
Abstract class that all Valor sensors should implement.
Definition BaseSensor.h:50
T Get() const
Get the current sensor state.
Definition BaseSensor.h:89
DebounceSensor()
Construct a new DebounceSensor object.
void Calculate() override
Perform proximity sensor-specific calculations.
void SetThresholdDistance(units::millimeter_t threshold)
Set the threshold distance for triggering the sensor.
Definition LaserProximitySensor.h:40
LaserProximitySensor()
Construct a new LaserProximitySensor object.
units::millimeter_t GetThresholdDistance() const
Returns the threshold distance for triggering the sensor.
Definition LaserProximitySensor.h:47
void SetGetter(std::function< units::millimeter_t()> getter)
Set the getter function for the Lidar sensor.
void Refresh() override
Refresh the sensor state.
LaserProximityData Get()
Get the current sensor data.
Definition LaserProximitySensor.h:59
void Reset() override
Reset the sensor state, including Lidar and debounce logic.
LidarSensor()
Construct a new LidarSensor object.
Data structure for laser proximity sensor readings.
Definition LaserProximitySensor.h:15
units::millimeter_t distance
Measured distance in millimeters.
Definition LaserProximitySensor.h:16
bool triggered
Whether the sensor is triggered.
Definition LaserProximitySensor.h:17