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
10#include "valkyrie/sensors/LaserProximitySensor.h"
11
12namespace valor {
13namespace sensors {
14
21class CANrangeSensor : public LaserProximitySensor, public ctre::phoenix6::hardware::core::CoreCANrange {
22 public:
30 CANrangeSensor(int deviceId, std::string canbus);
31
32 inline CANrangeSensor() : ctre::phoenix6::hardware::core::CoreCANrange{-1} {}
33
34 inline void ApplyConfig() { GetConfigurator().Apply(config); }
35
36 void SetThresholdDistance(units::millimeter_t threshold, bool saveImmediately);
37
38 inline void SetThresholdDistance(units::millimeter_t threshold) { SetThresholdDistance(threshold, false); }
39
40 void SetHysteresis(units::millimeter_t hysteresis, bool saveImmediately = false);
41 void SetFOV(std::pair<units::degree_t, units::degree_t> fov = {15_deg, 15_deg},
42 std::pair<units::degree_t, units::degree_t> center = {0_deg, 0_deg}, bool saveImmediately = false);
43
44 bool IsHealthy() const override;
45
46 private:
47 ctre::phoenix6::configs::CANrangeConfiguration config;
48};
49
50} // namespace sensors
51} // 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.