Valkyrie 2026
Loading...
Searching...
No Matches
CANrangeSensor.h
1#pragma once
2
3#include <memory>
4#include <string>
5
6#include <ctre/phoenix6/core/CoreCANrange.hpp>
7#include <frc/TimedRobot.h>
8#include <units/length.h>
9#include <valkyrie/sensors/LaserProximitySensor.h>
10
11namespace valor {
12namespace sensors {
13
20class CANrangeSensor : public LaserProximitySensor, public ctre::phoenix6::hardware::core::CoreCANrange {
21 public:
29 CANrangeSensor(int deviceId, std::string canbus);
30
31 inline CANrangeSensor() : ctre::phoenix6::hardware::core::CoreCANrange{-1} {}
32
33 inline void ApplyConfig() { GetConfigurator().Apply(config); }
34
35 void SetThresholdDistance(units::millimeter_t threshold, bool saveImmediately);
36
37 inline void SetThresholdDistance(units::millimeter_t threshold) { SetThresholdDistance(threshold, false); }
38
39 void SetHysteresis(units::millimeter_t hysteresis, bool saveImmediately = false);
40 void SetFOV(std::pair<units::degree_t, units::degree_t> fov = {15_deg, 15_deg},
41 std::pair<units::degree_t, units::degree_t> center = {0_deg, 0_deg}, bool saveImmediately = false);
42
43 bool IsHealthy() const override;
44
45 private:
46 ctre::phoenix6::configs::CANrangeConfiguration config;
47};
48
49} // namespace sensors
50} // namespace valor
CANrangeSensor(int deviceId, std::string canbus)
Construct a new CANrangeSensor object.
bool IsHealthy() const override
Represents whether the sensor data is healthy.
LaserProximitySensor()
Construct a new LaserProximitySensor object.