libPlayingWithFusion 2022.01.12
Playing With Fusion driver library for FRC roboRIO
TimeOfFlight.h
Go to the documentation of this file.
1#pragma once
2
3#include "wpi/sendable/Sendable.h"
4#include "wpi/sendable/SendableHelper.h"
5#include "wpi/sendable/SendableBuilder.h"
6#include "TimeOfFlightApi.h"
7
8namespace frc {
9class TimeOfFlightImpl;
10
11class TimeOfFlight : public wpi::Sendable, public wpi::SendableHelper<TimeOfFlight> {
12public:
14 kShort = 0,
16 kLong = 2
17 };
18
19 enum Status {
23 kValid = 0,
24
31
39
47
52
61
66
70 kInvalid = 14
71 };
72
73
85 explicit TimeOfFlight(uint8_t sensorID);
86 virtual ~TimeOfFlight();
87
88 // Delete Copy constructor and assignment operator
89 TimeOfFlight(const TimeOfFlight&) =delete;
91
92 // Use default Move constructor and assignment operator
95
101 void IdentifySensor();
102
108 uint32_t GetFirmwareVersion() const;
109
115 uint32_t GetSerialNumber() const;
116
122 bool IsRangeValid() const;
123
129 double GetRange() const;
130
136 double GetRangeSigma() const;
137
143 double GetAmbientLightLevel() const;
144
150 Status GetStatus() const;
151
170 void SetRangingMode(RangingMode mode, double sampleTime);
171
202 void SetRangeOfInterest(uint8_t topLeftX, uint8_t topLeftY, uint8_t bottomRightX, uint8_t bottomRightY);
203
204 void InitSendable(wpi::SendableBuilder& builder) override;
205
206private:
207 TimeOfFlight_t *m_timeOfFlightHandle;
208 RangingMode m_rangingMode;
209};
210
211}
Definition: TimeOfFlight.h:11
double GetRangeSigma() const
Definition: TimeOfFlight.cpp:36
double GetAmbientLightLevel() const
Definition: TimeOfFlight.cpp:40
void SetRangingMode(RangingMode mode, double sampleTime)
Definition: TimeOfFlight.cpp:48
TimeOfFlight(uint8_t sensorID)
Definition: TimeOfFlight.cpp:5
Status GetStatus() const
Definition: TimeOfFlight.cpp:44
TimeOfFlight(TimeOfFlight &&)=default
void InitSendable(wpi::SendableBuilder &builder) override
Definition: TimeOfFlight.cpp:56
virtual ~TimeOfFlight()
Definition: TimeOfFlight.cpp:11
uint32_t GetFirmwareVersion() const
Definition: TimeOfFlight.cpp:20
void IdentifySensor()
Definition: TimeOfFlight.cpp:16
TimeOfFlight(const TimeOfFlight &)=delete
TimeOfFlight & operator=(TimeOfFlight &&)=default
uint32_t GetSerialNumber() const
Definition: TimeOfFlight.cpp:24
bool IsRangeValid() const
Definition: TimeOfFlight.cpp:28
Status
Definition: TimeOfFlight.h:19
@ kWrappedTarget
Definition: TimeOfFlight.h:60
@ kReturnPhaseBad
Definition: TimeOfFlight.h:46
@ kValid
Definition: TimeOfFlight.h:23
@ kInternalError
Definition: TimeOfFlight.h:65
@ kInvalid
Definition: TimeOfFlight.h:70
@ kSigmaHigh
Definition: TimeOfFlight.h:30
@ kReturnSignalLow
Definition: TimeOfFlight.h:38
@ kHardwareFailure
Definition: TimeOfFlight.h:51
TimeOfFlight & operator=(const TimeOfFlight &)=delete
void SetRangeOfInterest(uint8_t topLeftX, uint8_t topLeftY, uint8_t bottomRightX, uint8_t bottomRightY)
Definition: TimeOfFlight.cpp:52
double GetRange() const
Definition: TimeOfFlight.cpp:32
RangingMode
Definition: TimeOfFlight.h:13
@ kMedium
Definition: TimeOfFlight.h:15
@ kLong
Definition: TimeOfFlight.h:16
@ kShort
Definition: TimeOfFlight.h:14
Definition: CANVenom.h:10