Valkyrie 2026
Loading...
Searching...
No Matches
LaserProximitySensor.h
1#pragma once
2
3#include <string>
4
5#include <units/length.h>
6
7#include "valkyrie/sensors/DebounceSensor.h"
8#include "valkyrie/sensors/LidarSensor.h"
9
10namespace valor {
11namespace sensors {
12
17 units::millimeter_t distance;
18 bool triggered;
19};
20
27class LaserProximitySensor : public BaseSensor<LaserProximityData>, public LidarSensor, public DebounceSensor {
28 public:
35
41 inline void SetThresholdDistance(units::millimeter_t threshold) { thresholdDistance = threshold; }
42
48 inline units::millimeter_t GetThresholdDistance() const { return thresholdDistance; }
49
53 void Reset() override;
54
61
67 void SetGetter(std::function<units::millimeter_t()> getter);
68
69 protected:
75 void Calculate() override;
76
77 void Refresh() override;
78
79 private:
80 units::millimeter_t thresholdDistance;
81};
82
83} // namespace sensors
84} // namespace valor
Abstract class that all Valor sensors should implement.
Definition BaseSensor.h:52
T Get() const
Get the current sensor state.
Definition BaseSensor.h:91
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:41
LaserProximitySensor()
Construct a new LaserProximitySensor object.
units::millimeter_t GetThresholdDistance() const
Returns the threshold distance for triggering the sensor.
Definition LaserProximitySensor.h:48
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:60
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:16
units::millimeter_t distance
Measured distance in millimeters.
Definition LaserProximitySensor.h:17
bool triggered
Whether the sensor is triggered.
Definition LaserProximitySensor.h:18